mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #75805 from brahmaroutu/nfs_metrics
Adding metrics to nfs driver
This commit is contained in:
commit
748849bbb9
@ -32,7 +32,12 @@ import (
|
|||||||
utilstrings "k8s.io/utils/strings"
|
utilstrings "k8s.io/utils/strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
|
||||||
|
return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(nfsPluginName), volName)
|
||||||
|
}
|
||||||
|
|
||||||
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
|
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
|
||||||
|
// This is the primary entrypoint for volume plugins.
|
||||||
// The volumeConfig arg provides the ability to configure recycler behavior. It is implemented as a pointer to allow nils.
|
// The volumeConfig arg provides the ability to configure recycler behavior. It is implemented as a pointer to allow nils.
|
||||||
// The nfsPlugin is used to store the volumeConfig and give it, when needed, to the func that creates NFS Recyclers.
|
// The nfsPlugin is used to store the volumeConfig and give it, when needed, to the func that creates NFS Recyclers.
|
||||||
// Tests that exercise recycling should not use this func but instead use ProbeRecyclablePlugins() to override default behavior.
|
// Tests that exercise recycling should not use this func but instead use ProbeRecyclablePlugins() to override default behavior.
|
||||||
@ -120,10 +125,11 @@ func (plugin *nfsPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, moun
|
|||||||
|
|
||||||
return &nfsMounter{
|
return &nfsMounter{
|
||||||
nfs: &nfs{
|
nfs: &nfs{
|
||||||
volName: spec.Name(),
|
volName: spec.Name(),
|
||||||
mounter: mounter,
|
mounter: mounter,
|
||||||
pod: pod,
|
pod: pod,
|
||||||
plugin: plugin,
|
plugin: plugin,
|
||||||
|
MetricsProvider: volume.NewMetricsStatFS(getPath(pod.UID, spec.Name(), plugin.host)),
|
||||||
},
|
},
|
||||||
server: source.Server,
|
server: source.Server,
|
||||||
exportPath: source.Path,
|
exportPath: source.Path,
|
||||||
@ -138,10 +144,11 @@ func (plugin *nfsPlugin) NewUnmounter(volName string, podUID types.UID) (volume.
|
|||||||
|
|
||||||
func (plugin *nfsPlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface) (volume.Unmounter, error) {
|
func (plugin *nfsPlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface) (volume.Unmounter, error) {
|
||||||
return &nfsUnmounter{&nfs{
|
return &nfsUnmounter{&nfs{
|
||||||
volName: volName,
|
volName: volName,
|
||||||
mounter: mounter,
|
mounter: mounter,
|
||||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: podUID}},
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: podUID}},
|
||||||
plugin: plugin,
|
plugin: plugin,
|
||||||
|
MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, volName, plugin.host)),
|
||||||
}}, nil
|
}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +191,7 @@ type nfs struct {
|
|||||||
pod *v1.Pod
|
pod *v1.Pod
|
||||||
mounter mount.Interface
|
mounter mount.Interface
|
||||||
plugin *nfsPlugin
|
plugin *nfsPlugin
|
||||||
volume.MetricsNil
|
volume.MetricsProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nfsVolume *nfs) GetPath() string {
|
func (nfsVolume *nfs) GetPath() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user