mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 18:28:13 +00:00 
			
		
		
		
	change import alias of utils/strings
This commit is contained in:
		| @@ -32,7 +32,7 @@ import ( | |||||||
| 	volumetesting "k8s.io/kubernetes/pkg/volume/testing" | 	volumetesting "k8s.io/kubernetes/pkg/volume/testing" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/operationexecutor" | 	"k8s.io/kubernetes/pkg/volume/util/operationexecutor" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/types" | 	"k8s.io/kubernetes/pkg/volume/util/types" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -738,7 +738,7 @@ func Test_ReportMultiAttachError(t *testing.T) { | |||||||
| 				volumeSpec := controllervolumetesting.GetTestVolumeSpec(string(volumeName), volumeName) | 				volumeSpec := controllervolumetesting.GetTestVolumeSpec(string(volumeName), volumeName) | ||||||
| 				volumeSpec.PersistentVolume.Spec.AccessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce} | 				volumeSpec.PersistentVolume.Spec.AccessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce} | ||||||
| 				uid := string(n.name) + "-" + podName // unique UID | 				uid := string(n.name) + "-" + podName // unique UID | ||||||
| 				namespace, name := utilsstrings.SplitQualifiedName(podName) | 				namespace, name := utilstrings.SplitQualifiedName(podName) | ||||||
| 				pod := controllervolumetesting.NewPod(uid, name) | 				pod := controllervolumetesting.NewPod(uid, name) | ||||||
| 				pod.Namespace = namespace | 				pod.Namespace = namespace | ||||||
| 				_, err := dsw.AddPod(types.UniquePodName(uid), pod, volumeSpec, n.name) | 				_, err := dsw.AddPod(types.UniquePodName(uid), pod, volumeSpec, n.name) | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ import ( | |||||||
| 	"k8s.io/api/core/v1" | 	"k8s.io/api/core/v1" | ||||||
| 	"k8s.io/kubernetes/pkg/kubelet/config" | 	"k8s.io/kubernetes/pkg/kubelet/config" | ||||||
| 	kubepod "k8s.io/kubernetes/pkg/kubelet/pod" | 	kubepod "k8s.io/kubernetes/pkg/kubelet/pod" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Manager is an interface that tracks pods with mount utilities for individual | // Manager is an interface that tracks pods with mount utilities for individual | ||||||
| @@ -68,7 +68,7 @@ func NewManager(rootDirectory string, podManager kubepod.Manager) (Manager, erro | |||||||
|  |  | ||||||
| func (m *basicManager) getVolumePluginRegistrationPath(pluginName string) string { | func (m *basicManager) getVolumePluginRegistrationPath(pluginName string) string { | ||||||
| 	// sanitize plugin name so it does not escape directory | 	// sanitize plugin name so it does not escape directory | ||||||
| 	safePluginName := strings.EscapeQualifiedName(pluginName) + ".json" | 	safePluginName := utilstrings.EscapeQualifiedName(pluginName) + ".json" | ||||||
| 	return path.Join(m.registrationDirectory, safePluginName) | 	return path.Join(m.registrationDirectory, safePluginName) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -44,7 +44,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations" | 	"k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/operationexecutor" | 	"k8s.io/kubernetes/pkg/volume/util/operationexecutor" | ||||||
| 	volumetypes "k8s.io/kubernetes/pkg/volume/util/types" | 	volumetypes "k8s.io/kubernetes/pkg/volume/util/types" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Reconciler runs a periodic loop to reconcile the desired state of the world | // Reconciler runs a periodic loop to reconcile the desired state of the world | ||||||
| @@ -678,7 +678,7 @@ func getVolumesFromPodDir(podDir string) ([]podVolume, error) { | |||||||
| 					klog.Errorf("Could not read volume plugin directory %q: %v", volumePluginPath, err) | 					klog.Errorf("Could not read volume plugin directory %q: %v", volumePluginPath, err) | ||||||
| 					continue | 					continue | ||||||
| 				} | 				} | ||||||
| 				unescapePluginName := utilsstrings.UnescapeQualifiedName(pluginName) | 				unescapePluginName := utilstrings.UnescapeQualifiedName(pluginName) | ||||||
| 				for _, volumeName := range volumePluginDirs { | 				for _, volumeName := range volumePluginDirs { | ||||||
| 					mountPath := path.Join(volumePluginPath, volumeName) | 					mountPath := path.Join(volumePluginPath, volumeName) | ||||||
| 					klog.V(5).Infof("podName: %v, mount path from volume plugin directory: %v, ", podName, mountPath) | 					klog.V(5).Infof("podName: %v, mount path from volume plugin directory: %v, ", podName, mountPath) | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary entrypoint for volume plugins. | // ProbeVolumePlugins is the primary entrypoint for volume plugins. | ||||||
| @@ -60,7 +60,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(awsElasticBlockStorePluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(awsElasticBlockStorePluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *awsElasticBlockStorePlugin) Init(host volume.VolumeHost) error { | func (plugin *awsElasticBlockStorePlugin) Init(host volume.VolumeHost) error { | ||||||
|   | |||||||
| @@ -22,16 +22,15 @@ import ( | |||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
|  |  | ||||||
| 	"k8s.io/klog" |  | ||||||
|  |  | ||||||
| 	"k8s.io/api/core/v1" | 	"k8s.io/api/core/v1" | ||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
|  | 	"k8s.io/klog" | ||||||
| 	"k8s.io/kubernetes/pkg/cloudprovider/providers/aws" | 	"k8s.io/kubernetes/pkg/cloudprovider/providers/aws" | ||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var _ volume.BlockVolumePlugin = &awsElasticBlockStorePlugin{} | var _ volume.BlockVolumePlugin = &awsElasticBlockStorePlugin{} | ||||||
| @@ -172,5 +171,5 @@ func (ebs *awsElasticBlockStore) GetGlobalMapPath(spec *volume.Spec) (string, er | |||||||
| // path: pods/{podUid}/volumeDevices/kubernetes.io~aws | // path: pods/{podUid}/volumeDevices/kubernetes.io~aws | ||||||
| func (ebs *awsElasticBlockStore) GetPodDeviceMapPath() (string, string) { | func (ebs *awsElasticBlockStore) GetPodDeviceMapPath() (string, string) { | ||||||
| 	name := awsElasticBlockStorePluginName | 	name := awsElasticBlockStorePluginName | ||||||
| 	return ebs.plugin.host.GetPodVolumeDeviceDir(ebs.podUID, utilsstrings.EscapeQualifiedName(name)), ebs.volName | 	return ebs.plugin.host.GetPodVolumeDeviceDir(ebs.podUID, utilstrings.EscapeQualifiedName(name)), ebs.volName | ||||||
| } | } | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/cloudprovider/providers/azure" | 	"k8s.io/kubernetes/pkg/cloudprovider/providers/azure" | ||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -66,7 +66,7 @@ var ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(azureDataDiskPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(azureDataDiskPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // creates a unique path for disks (even if they share the same *.vhd name) | // creates a unique path for disks (even if they share the same *.vhd name) | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var _ volume.VolumePlugin = &azureDataDiskPlugin{} | var _ volume.VolumePlugin = &azureDataDiskPlugin{} | ||||||
| @@ -157,5 +157,5 @@ func (disk *dataDisk) GetGlobalMapPath(spec *volume.Spec) (string, error) { | |||||||
| // path: pods/{podUid}/volumeDevices/kubernetes.io~azure | // path: pods/{podUid}/volumeDevices/kubernetes.io~azure | ||||||
| func (disk *dataDisk) GetPodDeviceMapPath() (string, string) { | func (disk *dataDisk) GetPodDeviceMapPath() (string, string) { | ||||||
| 	name := azureDataDiskPluginName | 	name := azureDataDiskPluginName | ||||||
| 	return disk.plugin.host.GetPodVolumeDeviceDir(disk.podUID, utilsstrings.EscapeQualifiedName(name)), disk.volumeName | 	return disk.plugin.host.GetPodVolumeDeviceDir(disk.podUID, utilstrings.EscapeQualifiedName(name)), disk.volumeName | ||||||
| } | } | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	volutil "k8s.io/kubernetes/pkg/volume/util" | 	volutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary endpoint for volume plugins | // ProbeVolumePlugins is the primary endpoint for volume plugins | ||||||
| @@ -53,7 +53,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(azureFilePluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(azureFilePluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *azureFilePlugin) Init(host volume.VolumeHost) error { | func (plugin *azureFilePlugin) Init(host volume.VolumeHost) error { | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/cloudprovider/providers/azure" | 	"k8s.io/kubernetes/pkg/cloudprovider/providers/azure" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var _ volume.DeletableVolumePlugin = &azureFilePlugin{} | var _ volume.DeletableVolumePlugin = &azureFilePlugin{} | ||||||
| @@ -116,7 +116,7 @@ var _ volume.Deleter = &azureFileDeleter{} | |||||||
|  |  | ||||||
| func (f *azureFileDeleter) GetPath() string { | func (f *azureFileDeleter) GetPath() string { | ||||||
| 	name := azureFilePluginName | 	name := azureFilePluginName | ||||||
| 	return f.plugin.host.GetPodVolumeDir(f.podUID, utilsstrings.EscapeQualifiedName(name), f.volName) | 	return f.plugin.host.GetPodVolumeDir(f.podUID, utilstrings.EscapeQualifiedName(name), f.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (f *azureFileDeleter) Delete() error { | func (f *azureFileDeleter) Delete() error { | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary entrypoint for volume plugins. | // ProbeVolumePlugins is the primary entrypoint for volume plugins. | ||||||
| @@ -289,13 +289,13 @@ func (cephfsVolume *cephfsUnmounter) TearDownAt(dir string) error { | |||||||
| // GetPath creates global mount path | // GetPath creates global mount path | ||||||
| func (cephfsVolume *cephfs) GetPath() string { | func (cephfsVolume *cephfs) GetPath() string { | ||||||
| 	name := cephfsPluginName | 	name := cephfsPluginName | ||||||
| 	return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilsstrings.EscapeQualifiedName(name), cephfsVolume.volName) | 	return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilstrings.EscapeQualifiedName(name), cephfsVolume.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // GetKeyringPath creates cephfuse keyring path | // GetKeyringPath creates cephfuse keyring path | ||||||
| func (cephfsVolume *cephfs) GetKeyringPath() string { | func (cephfsVolume *cephfs) GetKeyringPath() string { | ||||||
| 	name := cephfsPluginName | 	name := cephfsPluginName | ||||||
| 	volumeDir := cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilsstrings.EscapeQualifiedName(name), cephfsVolume.volName) | 	volumeDir := cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilstrings.EscapeQualifiedName(name), cephfsVolume.volName) | ||||||
| 	volumeKeyringDir := volumeDir + "~keyring" | 	volumeKeyringDir := volumeDir + "~keyring" | ||||||
| 	return volumeKeyringDir | 	return volumeKeyringDir | ||||||
| } | } | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/utils/keymutex" | 	"k8s.io/utils/keymutex" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -82,7 +82,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(cinderVolumePluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(cinderVolumePluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *cinderPlugin) Init(host volume.VolumeHost) error { | func (plugin *cinderPlugin) Init(host volume.VolumeHost) error { | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var _ volume.VolumePlugin = &cinderPlugin{} | var _ volume.VolumePlugin = &cinderPlugin{} | ||||||
| @@ -163,5 +163,5 @@ func (cd *cinderVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { | |||||||
| // path: pods/{podUid}/volumeDevices/kubernetes.io~cinder | // path: pods/{podUid}/volumeDevices/kubernetes.io~cinder | ||||||
| func (cd *cinderVolume) GetPodDeviceMapPath() (string, string) { | func (cd *cinderVolume) GetPodDeviceMapPath() (string, string) { | ||||||
| 	name := cinderVolumePluginName | 	name := cinderVolumePluginName | ||||||
| 	return cd.plugin.host.GetPodVolumeDeviceDir(cd.podUID, utilsstrings.EscapeQualifiedName(name)), cd.volName | 	return cd.plugin.host.GetPodVolumeDeviceDir(cd.podUID, utilstrings.EscapeQualifiedName(name)), cd.volName | ||||||
| } | } | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the entry point for plugin detection in a package. | // ProbeVolumePlugins is the entry point for plugin detection in a package. | ||||||
| @@ -48,7 +48,7 @@ type configMapPlugin struct { | |||||||
| var _ volume.VolumePlugin = &configMapPlugin{} | var _ volume.VolumePlugin = &configMapPlugin{} | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(configMapPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(configMapPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *configMapPlugin) Init(host volume.VolumeHost) error { | func (plugin *configMapPlugin) Init(host volume.VolumeHost) error { | ||||||
| @@ -142,7 +142,7 @@ type configMapVolume struct { | |||||||
| var _ volume.Volume = &configMapVolume{} | var _ volume.Volume = &configMapVolume{} | ||||||
|  |  | ||||||
| func (sv *configMapVolume) GetPath() string { | func (sv *configMapVolume) GetPath() string { | ||||||
| 	return sv.plugin.host.GetPodVolumeDir(sv.podUID, strings.EscapeQualifiedName(configMapPluginName), sv.volName) | 	return sv.plugin.host.GetPodVolumeDir(sv.podUID, utilstrings.EscapeQualifiedName(configMapPluginName), sv.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // configMapVolumeMounter handles retrieving secrets from the API server | // configMapVolumeMounter handles retrieving secrets from the API server | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ import ( | |||||||
| 	"k8s.io/client-go/kubernetes" | 	"k8s.io/client-go/kubernetes" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	ioutil "k8s.io/kubernetes/pkg/volume/util" | 	ioutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type csiBlockMapper struct { | type csiBlockMapper struct { | ||||||
| @@ -62,21 +62,21 @@ func (m *csiBlockMapper) GetGlobalMapPath(spec *volume.Spec) (string, error) { | |||||||
| // getStagingPath returns a staging path for a directory (on the node) that should be used on NodeStageVolume/NodeUnstageVolume | // getStagingPath returns a staging path for a directory (on the node) that should be used on NodeStageVolume/NodeUnstageVolume | ||||||
| // Example: plugins/kubernetes.io/csi/volumeDevices/staging/{pvname} | // Example: plugins/kubernetes.io/csi/volumeDevices/staging/{pvname} | ||||||
| func (m *csiBlockMapper) getStagingPath() string { | func (m *csiBlockMapper) getStagingPath() string { | ||||||
| 	sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(m.specName) | 	sanitizedSpecVolID := utilstrings.EscapeQualifiedName(m.specName) | ||||||
| 	return path.Join(m.plugin.host.GetVolumeDevicePluginDir(csiPluginName), "staging", sanitizedSpecVolID) | 	return path.Join(m.plugin.host.GetVolumeDevicePluginDir(csiPluginName), "staging", sanitizedSpecVolID) | ||||||
| } | } | ||||||
|  |  | ||||||
| // getPublishPath returns a publish path for a file (on the node) that should be used on NodePublishVolume/NodeUnpublishVolume | // getPublishPath returns a publish path for a file (on the node) that should be used on NodePublishVolume/NodeUnpublishVolume | ||||||
| // Example: plugins/kubernetes.io/csi/volumeDevices/publish/{pvname} | // Example: plugins/kubernetes.io/csi/volumeDevices/publish/{pvname} | ||||||
| func (m *csiBlockMapper) getPublishPath() string { | func (m *csiBlockMapper) getPublishPath() string { | ||||||
| 	sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(m.specName) | 	sanitizedSpecVolID := utilstrings.EscapeQualifiedName(m.specName) | ||||||
| 	return path.Join(m.plugin.host.GetVolumeDevicePluginDir(csiPluginName), "publish", sanitizedSpecVolID) | 	return path.Join(m.plugin.host.GetVolumeDevicePluginDir(csiPluginName), "publish", sanitizedSpecVolID) | ||||||
| } | } | ||||||
|  |  | ||||||
| // GetPodDeviceMapPath returns pod's device file which will be mapped to a volume | // GetPodDeviceMapPath returns pod's device file which will be mapped to a volume | ||||||
| // returns: pods/{podUid}/volumeDevices/kubernetes.io~csi, {pvname} | // returns: pods/{podUid}/volumeDevices/kubernetes.io~csi, {pvname} | ||||||
| func (m *csiBlockMapper) GetPodDeviceMapPath() (string, string) { | func (m *csiBlockMapper) GetPodDeviceMapPath() (string, string) { | ||||||
| 	path := m.plugin.host.GetPodVolumeDeviceDir(m.podUID, utilsstrings.EscapeQualifiedName(csiPluginName)) | 	path := m.plugin.host.GetPodVolumeDeviceDir(m.podUID, utilstrings.EscapeQualifiedName(csiPluginName)) | ||||||
| 	specName := m.specName | 	specName := m.specName | ||||||
| 	klog.V(4).Infof(log("blockMapper.GetPodDeviceMapPath [path=%s; name=%s]", path, specName)) | 	klog.V(4).Infof(log("blockMapper.GetPodDeviceMapPath [path=%s; name=%s]", path, specName)) | ||||||
| 	return path, specName | 	return path, specName | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ import ( | |||||||
| 	"k8s.io/client-go/kubernetes" | 	"k8s.io/client-go/kubernetes" | ||||||
| 	"k8s.io/kubernetes/pkg/features" | 	"k8s.io/kubernetes/pkg/features" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| //TODO (vladimirvivien) move this in a central loc later | //TODO (vladimirvivien) move this in a central loc later | ||||||
| @@ -79,8 +79,8 @@ func (c *csiMountMgr) GetPath() string { | |||||||
| } | } | ||||||
|  |  | ||||||
| func getTargetPath(uid types.UID, specVolumeID string, host volume.VolumeHost) string { | func getTargetPath(uid types.UID, specVolumeID string, host volume.VolumeHost) string { | ||||||
| 	specVolID := utilsstrings.EscapeQualifiedName(specVolumeID) | 	specVolID := utilstrings.EscapeQualifiedName(specVolumeID) | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(csiPluginName), specVolID) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(csiPluginName), specVolID) | ||||||
| } | } | ||||||
|  |  | ||||||
| // volume.Mounter methods | // volume.Mounter methods | ||||||
|   | |||||||
| @@ -21,7 +21,6 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path" | 	"path" | ||||||
|  |  | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	api "k8s.io/api/core/v1" | 	api "k8s.io/api/core/v1" | ||||||
| @@ -29,7 +28,7 @@ import ( | |||||||
| 	"k8s.io/client-go/kubernetes" | 	"k8s.io/client-go/kubernetes" | ||||||
| 	"k8s.io/klog" | 	"k8s.io/klog" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -117,7 +116,7 @@ func log(msg string, parts ...interface{}) string { | |||||||
| // symlink for a block device associated with a given specVolumeID. | // symlink for a block device associated with a given specVolumeID. | ||||||
| // path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/dev | // path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/dev | ||||||
| func getVolumeDevicePluginDir(specVolID string, host volume.VolumeHost) string { | func getVolumeDevicePluginDir(specVolID string, host volume.VolumeHost) string { | ||||||
| 	sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(specVolID) | 	sanitizedSpecVolID := utilstrings.EscapeQualifiedName(specVolID) | ||||||
| 	return path.Join(host.GetVolumeDevicePluginDir(csiPluginName), sanitizedSpecVolID, "dev") | 	return path.Join(host.GetVolumeDevicePluginDir(csiPluginName), sanitizedSpecVolID, "dev") | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -125,7 +124,7 @@ func getVolumeDevicePluginDir(specVolID string, host volume.VolumeHost) string { | |||||||
| // volume data for a block device associated with a given specVolumeID. | // volume data for a block device associated with a given specVolumeID. | ||||||
| // path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/data | // path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/data | ||||||
| func getVolumeDeviceDataDir(specVolID string, host volume.VolumeHost) string { | func getVolumeDeviceDataDir(specVolID string, host volume.VolumeHost) string { | ||||||
| 	sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(specVolID) | 	sanitizedSpecVolID := utilstrings.EscapeQualifiedName(specVolID) | ||||||
| 	return path.Join(host.GetVolumeDevicePluginDir(csiPluginName), sanitizedSpecVolID, "data") | 	return path.Join(host.GetVolumeDevicePluginDir(csiPluginName), sanitizedSpecVolID, "data") | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/fieldpath" | 	"k8s.io/kubernetes/pkg/fieldpath" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the entry point for plugin detection in a package. | // ProbeVolumePlugins is the entry point for plugin detection in a package. | ||||||
| @@ -48,7 +48,7 @@ type downwardAPIPlugin struct { | |||||||
| var _ volume.VolumePlugin = &downwardAPIPlugin{} | var _ volume.VolumePlugin = &downwardAPIPlugin{} | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(downwardAPIPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(downwardAPIPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func wrappedVolumeSpec() volume.Spec { | func wrappedVolumeSpec() volume.Spec { | ||||||
| @@ -288,7 +288,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu | |||||||
| } | } | ||||||
|  |  | ||||||
| func (d *downwardAPIVolume) GetPath() string { | func (d *downwardAPIVolume) GetPath() string { | ||||||
| 	return d.plugin.host.GetPodVolumeDir(d.podUID, utilsstrings.EscapeQualifiedName(downwardAPIPluginName), d.volName) | 	return d.plugin.host.GetPodVolumeDir(d.podUID, utilstrings.EscapeQualifiedName(downwardAPIPluginName), d.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // downwardAPIVolumeCleaner handles cleaning up downwardAPI volumes | // downwardAPIVolumeCleaner handles cleaning up downwardAPI volumes | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // TODO: in the near future, this will be changed to be more restrictive | // TODO: in the near future, this will be changed to be more restrictive | ||||||
| @@ -59,7 +59,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(emptyDirPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(emptyDirPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *emptyDirPlugin) Init(host volume.VolumeHost) error { | func (plugin *emptyDirPlugin) Init(host volume.VolumeHost) error { | ||||||
| @@ -420,7 +420,7 @@ func (ed *emptyDir) teardownTmpfsOrHugetlbfs(dir string) error { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (ed *emptyDir) getMetaDir() string { | func (ed *emptyDir) getMetaDir() string { | ||||||
| 	return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, utilsstrings.EscapeQualifiedName(emptyDirPluginName)), ed.volName) | 	return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, utilstrings.EscapeQualifiedName(emptyDirPluginName)), ed.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func getVolumeSource(spec *volume.Spec) (*v1.EmptyDirVolumeSource, bool) { | func getVolumeSource(spec *volume.Spec) (*v1.EmptyDirVolumeSource, bool) { | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary entrypoint for volume plugins. | // ProbeVolumePlugins is the primary entrypoint for volume plugins. | ||||||
| @@ -360,7 +360,7 @@ type fcDisk struct { | |||||||
|  |  | ||||||
| func (fc *fcDisk) GetPath() string { | func (fc *fcDisk) GetPath() string { | ||||||
| 	// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up | 	// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up | ||||||
| 	return fc.plugin.host.GetPodVolumeDir(fc.podUID, utilsstrings.EscapeQualifiedName(fcPluginName), fc.volName) | 	return fc.plugin.host.GetPodVolumeDir(fc.podUID, utilstrings.EscapeQualifiedName(fcPluginName), fc.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (fc *fcDisk) fcGlobalMapPath(spec *volume.Spec) (string, error) { | func (fc *fcDisk) fcGlobalMapPath(spec *volume.Spec) (string, error) { | ||||||
| @@ -373,7 +373,7 @@ func (fc *fcDisk) fcGlobalMapPath(spec *volume.Spec) (string, error) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (fc *fcDisk) fcPodDeviceMapPath() (string, string) { | func (fc *fcDisk) fcPodDeviceMapPath() (string, string) { | ||||||
| 	return fc.plugin.host.GetPodVolumeDeviceDir(fc.podUID, utilsstrings.EscapeQualifiedName(fcPluginName)), fc.volName | 	return fc.plugin.host.GetPodVolumeDeviceDir(fc.podUID, utilstrings.EscapeQualifiedName(fcPluginName)), fc.volName | ||||||
| } | } | ||||||
|  |  | ||||||
| type fcDiskMounter struct { | type fcDiskMounter struct { | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/utils/exec" | 	"k8s.io/utils/exec" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -71,7 +71,7 @@ type pluginFactory struct{} | |||||||
| func (pluginFactory) NewFlexVolumePlugin(pluginDir, name string, runner exec.Interface) (volume.VolumePlugin, error) { | func (pluginFactory) NewFlexVolumePlugin(pluginDir, name string, runner exec.Interface) (volume.VolumePlugin, error) { | ||||||
| 	execPath := path.Join(pluginDir, name) | 	execPath := path.Join(pluginDir, name) | ||||||
|  |  | ||||||
| 	driverName := utilsstrings.UnescapeQualifiedName(name) | 	driverName := utilstrings.UnescapeQualifiedName(name) | ||||||
|  |  | ||||||
| 	flexPlugin := &flexVolumePlugin{ | 	flexPlugin := &flexVolumePlugin{ | ||||||
| 		driverName:          driverName, | 		driverName:          driverName, | ||||||
| @@ -185,7 +185,7 @@ func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *api.P | |||||||
| 	var metricsProvider volume.MetricsProvider | 	var metricsProvider volume.MetricsProvider | ||||||
| 	if plugin.capabilities.SupportsMetrics { | 	if plugin.capabilities.SupportsMetrics { | ||||||
| 		metricsProvider = volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir( | 		metricsProvider = volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir( | ||||||
| 			pod.UID, utilsstrings.EscapeQualifiedName(sourceDriver), spec.Name())) | 			pod.UID, utilstrings.EscapeQualifiedName(sourceDriver), spec.Name())) | ||||||
| 	} else { | 	} else { | ||||||
| 		metricsProvider = &volume.MetricsNil{} | 		metricsProvider = &volume.MetricsNil{} | ||||||
| 	} | 	} | ||||||
| @@ -219,7 +219,7 @@ func (plugin *flexVolumePlugin) newUnmounterInternal(volName string, podUID type | |||||||
| 	var metricsProvider volume.MetricsProvider | 	var metricsProvider volume.MetricsProvider | ||||||
| 	if plugin.capabilities.SupportsMetrics { | 	if plugin.capabilities.SupportsMetrics { | ||||||
| 		metricsProvider = volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir( | 		metricsProvider = volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir( | ||||||
| 			podUID, utilsstrings.EscapeQualifiedName(plugin.driverName), volName)) | 			podUID, utilstrings.EscapeQualifiedName(plugin.driverName), volName)) | ||||||
| 	} else { | 	} else { | ||||||
| 		metricsProvider = &volume.MetricsNil{} | 		metricsProvider = &volume.MetricsNil{} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ import ( | |||||||
| 	utilfs "k8s.io/kubernetes/pkg/util/filesystem" | 	utilfs "k8s.io/kubernetes/pkg/util/filesystem" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/utils/exec" | 	"k8s.io/utils/exec" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type flexVolumeProber struct { | type flexVolumeProber struct { | ||||||
| @@ -139,7 +139,7 @@ func (prober *flexVolumeProber) newProbeEvent(driverDirName string, op volume.Pr | |||||||
| 		probeEvent.Plugin = plugin | 		probeEvent.Plugin = plugin | ||||||
| 		probeEvent.PluginName = plugin.GetPluginName() | 		probeEvent.PluginName = plugin.GetPluginName() | ||||||
| 	} else if op == volume.ProbeRemove { | 	} else if op == volume.ProbeRemove { | ||||||
| 		driverName := utilsstrings.UnescapeQualifiedName(driverDirName) | 		driverName := utilstrings.UnescapeQualifiedName(driverDirName) | ||||||
| 		probeEvent.PluginName = flexVolumePluginNamePrefix + driverName | 		probeEvent.PluginName = flexVolumePluginNamePrefix + driverName | ||||||
|  |  | ||||||
| 	} else { | 	} else { | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ import ( | |||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type flexVolume struct { | type flexVolume struct { | ||||||
| @@ -51,5 +51,5 @@ type flexVolume struct { | |||||||
|  |  | ||||||
| func (f *flexVolume) GetPath() string { | func (f *flexVolume) GetPath() string { | ||||||
| 	name := f.driverName | 	name := f.driverName | ||||||
| 	return f.plugin.host.GetPodVolumeDir(f.podUID, utilsstrings.EscapeQualifiedName(name), f.volName) | 	return f.plugin.host.GetPodVolumeDir(f.podUID, utilstrings.EscapeQualifiedName(name), f.volName) | ||||||
| } | } | ||||||
|   | |||||||
| @@ -22,15 +22,15 @@ import ( | |||||||
| 	"path" | 	"path" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
|  | 	flockerapi "github.com/clusterhq/flocker-go" | ||||||
|  |  | ||||||
| 	"k8s.io/api/core/v1" | 	"k8s.io/api/core/v1" | ||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
| 	"k8s.io/klog" | 	"k8s.io/klog" | ||||||
| 	"k8s.io/kubernetes/pkg/util/env" | 	"k8s.io/kubernetes/pkg/util/env" | ||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
|  |  | ||||||
| 	flockerapi "github.com/clusterhq/flocker-go" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary entrypoint for volume plugins. | // ProbeVolumePlugins is the primary entrypoint for volume plugins. | ||||||
| @@ -77,7 +77,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(flockerPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(flockerPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func makeGlobalFlockerPath(datasetUUID string) string { | func makeGlobalFlockerPath(datasetUUID string) string { | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary entrypoint for volume plugins. | // ProbeVolumePlugins is the primary entrypoint for volume plugins. | ||||||
| @@ -72,7 +72,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(gcePersistentDiskPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(gcePersistentDiskPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *gcePersistentDiskPlugin) Init(host volume.VolumeHost) error { | func (plugin *gcePersistentDiskPlugin) Init(host volume.VolumeHost) error { | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var _ volume.VolumePlugin = &gcePersistentDiskPlugin{} | var _ volume.VolumePlugin = &gcePersistentDiskPlugin{} | ||||||
| @@ -170,5 +170,5 @@ func (pd *gcePersistentDisk) GetGlobalMapPath(spec *volume.Spec) (string, error) | |||||||
| // path: pods/{podUid}/volumeDevices/kubernetes.io~aws | // path: pods/{podUid}/volumeDevices/kubernetes.io~aws | ||||||
| func (pd *gcePersistentDisk) GetPodDeviceMapPath() (string, string) { | func (pd *gcePersistentDisk) GetPodDeviceMapPath() (string, string) { | ||||||
| 	name := gcePersistentDiskPluginName | 	name := gcePersistentDiskPluginName | ||||||
| 	return pd.plugin.host.GetPodVolumeDeviceDir(pd.podUID, utilsstrings.EscapeQualifiedName(name)), pd.volName | 	return pd.plugin.host.GetPodVolumeDeviceDir(pd.podUID, utilstrings.EscapeQualifiedName(name)), pd.volName | ||||||
| } | } | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/utils/exec" | 	"k8s.io/utils/exec" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // This is the primary entrypoint for volume plugins. | // This is the primary entrypoint for volume plugins. | ||||||
| @@ -147,7 +147,7 @@ var _ volume.Volume = &gitRepoVolume{} | |||||||
|  |  | ||||||
| func (gr *gitRepoVolume) GetPath() string { | func (gr *gitRepoVolume) GetPath() string { | ||||||
| 	name := gitRepoPluginName | 	name := gitRepoPluginName | ||||||
| 	return gr.plugin.host.GetPodVolumeDir(gr.podUID, utilsstrings.EscapeQualifiedName(name), gr.volName) | 	return gr.plugin.host.GetPodVolumeDir(gr.podUID, utilstrings.EscapeQualifiedName(name), gr.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // gitRepoVolumeMounter builds git repo volumes. | // gitRepoVolumeMounter builds git repo volumes. | ||||||
| @@ -248,7 +248,7 @@ func (b *gitRepoVolumeMounter) SetUpAt(dir string, fsGroup *int64) error { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (b *gitRepoVolumeMounter) getMetaDir() string { | func (b *gitRepoVolumeMounter) getMetaDir() string { | ||||||
| 	return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilsstrings.EscapeQualifiedName(gitRepoPluginName)), b.volName) | 	return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilstrings.EscapeQualifiedName(gitRepoPluginName)), b.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (b *gitRepoVolumeMounter) execCommand(command string, args []string, dir string) ([]byte, error) { | func (b *gitRepoVolumeMounter) execCommand(command string, args []string, dir string) ([]byte, error) { | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	volutil "k8s.io/kubernetes/pkg/volume/util" | 	volutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary entrypoint for volume plugins. | // ProbeVolumePlugins is the primary entrypoint for volume plugins. | ||||||
| @@ -200,7 +200,7 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp | |||||||
| 			mounter:         mounter, | 			mounter:         mounter, | ||||||
| 			pod:             pod, | 			pod:             pod, | ||||||
| 			plugin:          plugin, | 			plugin:          plugin, | ||||||
| 			MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, strings.EscapeQualifiedName(glusterfsPluginName), spec.Name())), | 			MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, utilstrings.EscapeQualifiedName(glusterfsPluginName), spec.Name())), | ||||||
| 		}, | 		}, | ||||||
| 		hosts:        ep, | 		hosts:        ep, | ||||||
| 		path:         volPath, | 		path:         volPath, | ||||||
| @@ -219,7 +219,7 @@ func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types | |||||||
| 		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(plugin.host.GetPodVolumeDir(podUID, strings.EscapeQualifiedName(glusterfsPluginName), volName)), | 		MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, utilstrings.EscapeQualifiedName(glusterfsPluginName), volName)), | ||||||
| 	}}, nil | 	}}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -301,7 +301,7 @@ func (b *glusterfsMounter) SetUpAt(dir string, fsGroup *int64) error { | |||||||
|  |  | ||||||
| func (glusterfsVolume *glusterfs) GetPath() string { | func (glusterfsVolume *glusterfs) GetPath() string { | ||||||
| 	name := glusterfsPluginName | 	name := glusterfsPluginName | ||||||
| 	return glusterfsVolume.plugin.host.GetPodVolumeDir(glusterfsVolume.pod.UID, strings.EscapeQualifiedName(name), glusterfsVolume.volName) | 	return glusterfsVolume.plugin.host.GetPodVolumeDir(glusterfsVolume.pod.UID, utilstrings.EscapeQualifiedName(name), glusterfsVolume.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| type glusterfsUnmounter struct { | type glusterfsUnmounter struct { | ||||||
| @@ -542,7 +542,7 @@ type glusterfsVolumeDeleter struct { | |||||||
|  |  | ||||||
| func (d *glusterfsVolumeDeleter) GetPath() string { | func (d *glusterfsVolumeDeleter) GetPath() string { | ||||||
| 	name := glusterfsPluginName | 	name := glusterfsPluginName | ||||||
| 	return d.plugin.host.GetPodVolumeDir(d.glusterfsMounter.glusterfs.pod.UID, strings.EscapeQualifiedName(name), d.glusterfsMounter.glusterfs.volName) | 	return d.plugin.host.GetPodVolumeDir(d.glusterfsMounter.glusterfs.pod.UID, utilstrings.EscapeQualifiedName(name), d.glusterfsMounter.glusterfs.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // Traverse the PVs, fetching all the GIDs from those | // Traverse the PVs, fetching all the GIDs from those | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ import ( | |||||||
| 	ioutil "k8s.io/kubernetes/pkg/volume/util" | 	ioutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	"k8s.io/utils/keymutex" | 	"k8s.io/utils/keymutex" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // This is the primary entrypoint for volume plugins. | // This is the primary entrypoint for volume plugins. | ||||||
| @@ -181,7 +181,7 @@ func (plugin *iscsiPlugin) newUnmounterInternal(volName string, podUID types.UID | |||||||
| 			VolName:         volName, | 			VolName:         volName, | ||||||
| 			manager:         manager, | 			manager:         manager, | ||||||
| 			plugin:          plugin, | 			plugin:          plugin, | ||||||
| 			MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, utilsstrings.EscapeQualifiedName(iscsiPluginName), volName)), | 			MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, utilstrings.EscapeQualifiedName(iscsiPluginName), volName)), | ||||||
| 		}, | 		}, | ||||||
| 		mounter:    mounter, | 		mounter:    mounter, | ||||||
| 		exec:       exec, | 		exec:       exec, | ||||||
| @@ -285,7 +285,7 @@ type iscsiDisk struct { | |||||||
| func (iscsi *iscsiDisk) GetPath() string { | func (iscsi *iscsiDisk) GetPath() string { | ||||||
| 	name := iscsiPluginName | 	name := iscsiPluginName | ||||||
| 	// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up | 	// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up | ||||||
| 	return iscsi.plugin.host.GetPodVolumeDir(iscsi.podUID, utilsstrings.EscapeQualifiedName(name), iscsi.VolName) | 	return iscsi.plugin.host.GetPodVolumeDir(iscsi.podUID, utilstrings.EscapeQualifiedName(name), iscsi.VolName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (iscsi *iscsiDisk) iscsiGlobalMapPath(spec *volume.Spec) (string, error) { | func (iscsi *iscsiDisk) iscsiGlobalMapPath(spec *volume.Spec) (string, error) { | ||||||
| @@ -299,7 +299,7 @@ func (iscsi *iscsiDisk) iscsiGlobalMapPath(spec *volume.Spec) (string, error) { | |||||||
|  |  | ||||||
| func (iscsi *iscsiDisk) iscsiPodDeviceMapPath() (string, string) { | func (iscsi *iscsiDisk) iscsiPodDeviceMapPath() (string, string) { | ||||||
| 	name := iscsiPluginName | 	name := iscsiPluginName | ||||||
| 	return iscsi.plugin.host.GetPodVolumeDeviceDir(iscsi.podUID, utilsstrings.EscapeQualifiedName(name)), iscsi.VolName | 	return iscsi.plugin.host.GetPodVolumeDeviceDir(iscsi.podUID, utilstrings.EscapeQualifiedName(name)), iscsi.VolName | ||||||
| } | } | ||||||
|  |  | ||||||
| type iscsiDiskMounter struct { | type iscsiDiskMounter struct { | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/validation" | 	"k8s.io/kubernetes/pkg/volume/validation" | ||||||
| 	"k8s.io/utils/keymutex" | 	"k8s.io/utils/keymutex" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -132,7 +132,7 @@ func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ vo | |||||||
| 			mounter:         plugin.host.GetMounter(plugin.GetPluginName()), | 			mounter:         plugin.host.GetMounter(plugin.GetPluginName()), | ||||||
| 			plugin:          plugin, | 			plugin:          plugin, | ||||||
| 			globalPath:      globalLocalPath, | 			globalPath:      globalLocalPath, | ||||||
| 			MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, utilsstrings.EscapeQualifiedName(localVolumePluginName), spec.Name())), | 			MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, utilstrings.EscapeQualifiedName(localVolumePluginName), spec.Name())), | ||||||
| 		}, | 		}, | ||||||
| 		mountOptions: util.MountOptionFromSpec(spec), | 		mountOptions: util.MountOptionFromSpec(spec), | ||||||
| 		readOnly:     readOnly, | 		readOnly:     readOnly, | ||||||
| @@ -392,7 +392,7 @@ type localVolume struct { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (l *localVolume) GetPath() string { | func (l *localVolume) GetPath() string { | ||||||
| 	return l.plugin.host.GetPodVolumeDir(l.podUID, utilsstrings.EscapeQualifiedName(localVolumePluginName), l.volName) | 	return l.plugin.host.GetPodVolumeDir(l.podUID, utilstrings.EscapeQualifiedName(localVolumePluginName), l.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| type localVolumeMounter struct { | type localVolumeMounter struct { | ||||||
| @@ -584,7 +584,7 @@ func (u *localVolumeUnmapper) TearDownDevice(mapPath, _ string) error { | |||||||
| // GetGlobalMapPath returns global map path and error. | // GetGlobalMapPath returns global map path and error. | ||||||
| // path: plugins/kubernetes.io/kubernetes.io/local-volume/volumeDevices/{volumeName} | // path: plugins/kubernetes.io/kubernetes.io/local-volume/volumeDevices/{volumeName} | ||||||
| func (lv *localVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { | func (lv *localVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { | ||||||
| 	return filepath.Join(lv.plugin.host.GetVolumeDevicePluginDir(utilsstrings.EscapeQualifiedName(localVolumePluginName)), | 	return filepath.Join(lv.plugin.host.GetVolumeDevicePluginDir(utilstrings.EscapeQualifiedName(localVolumePluginName)), | ||||||
| 		lv.volName), nil | 		lv.volName), nil | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -593,5 +593,5 @@ func (lv *localVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { | |||||||
| // volName: local-pv-ff0d6d4 | // volName: local-pv-ff0d6d4 | ||||||
| func (lv *localVolume) GetPodDeviceMapPath() (string, string) { | func (lv *localVolume) GetPodDeviceMapPath() (string, string) { | ||||||
| 	return lv.plugin.host.GetPodVolumeDeviceDir(lv.podUID, | 	return lv.plugin.host.GetPodVolumeDeviceDir(lv.podUID, | ||||||
| 		utilsstrings.EscapeQualifiedName(localVolumePluginName)), lv.volName | 		utilstrings.EscapeQualifiedName(localVolumePluginName)), lv.volName | ||||||
| } | } | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/recyclerclient" | 	"k8s.io/kubernetes/pkg/volume/util/recyclerclient" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // This is the primary entrypoint for volume plugins. | // This is the primary entrypoint for volume plugins. | ||||||
| @@ -189,7 +189,7 @@ type nfs struct { | |||||||
|  |  | ||||||
| func (nfsVolume *nfs) GetPath() string { | func (nfsVolume *nfs) GetPath() string { | ||||||
| 	name := nfsPluginName | 	name := nfsPluginName | ||||||
| 	return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, strings.EscapeQualifiedName(name), nfsVolume.volName) | 	return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, utilstrings.EscapeQualifiedName(name), nfsVolume.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // Checks prior to mount operations to verify that the required components (binaries, etc.) | // Checks prior to mount operations to verify that the required components (binaries, etc.) | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // This is the primary entrypoint for volume plugins. | // This is the primary entrypoint for volume plugins. | ||||||
| @@ -290,7 +290,7 @@ func makeGlobalPDPath(host volume.VolumeHost, devName string) string { | |||||||
|  |  | ||||||
| func (ppd *photonPersistentDisk) GetPath() string { | func (ppd *photonPersistentDisk) GetPath() string { | ||||||
| 	name := photonPersistentDiskPluginName | 	name := photonPersistentDiskPluginName | ||||||
| 	return ppd.plugin.host.GetPodVolumeDir(ppd.podUID, utilsstrings.EscapeQualifiedName(name), ppd.volName) | 	return ppd.plugin.host.GetPodVolumeDir(ppd.podUID, utilstrings.EscapeQualifiedName(name), ppd.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // TODO: supporting more access mode for PhotonController persistent disk | // TODO: supporting more access mode for PhotonController persistent disk | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -58,7 +58,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(portworxVolumePluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(portworxVolumePluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *portworxVolumePlugin) Init(host volume.VolumeHost) error { | func (plugin *portworxVolumePlugin) Init(host volume.VolumeHost) error { | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume/downwardapi" | 	"k8s.io/kubernetes/pkg/volume/downwardapi" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/secret" | 	"k8s.io/kubernetes/pkg/volume/secret" | ||||||
| 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the entry point for plugin detection in a package. | // ProbeVolumePlugins is the entry point for plugin detection in a package. | ||||||
| @@ -66,7 +66,7 @@ func wrappedVolumeSpec() volume.Spec { | |||||||
| } | } | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(projectedPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(projectedPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *projectedPlugin) Init(host volume.VolumeHost) error { | func (plugin *projectedPlugin) Init(host volume.VolumeHost) error { | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary entrypoint for volume plugins. | // ProbeVolumePlugins is the primary entrypoint for volume plugins. | ||||||
| @@ -92,7 +92,7 @@ func (plugin *quobytePlugin) CanSupport(spec *volume.Spec) bool { | |||||||
| 	// If Quobyte is already mounted we don't need to check if the binary is installed | 	// If Quobyte is already mounted we don't need to check if the binary is installed | ||||||
| 	if mounter, err := plugin.newMounterInternal(spec, nil, plugin.host.GetMounter(plugin.GetPluginName())); err == nil { | 	if mounter, err := plugin.newMounterInternal(spec, nil, plugin.host.GetMounter(plugin.GetPluginName())); err == nil { | ||||||
| 		qm, _ := mounter.(*quobyteMounter) | 		qm, _ := mounter.(*quobyteMounter) | ||||||
| 		pluginDir := plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) | 		pluginDir := plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName)) | ||||||
| 		if mounted, err := qm.pluginDirIsMounted(pluginDir); mounted && err == nil { | 		if mounted, err := qm.pluginDirIsMounted(pluginDir); mounted && err == nil { | ||||||
| 			klog.V(4).Infof("quobyte: can support") | 			klog.V(4).Infof("quobyte: can support") | ||||||
| 			return true | 			return true | ||||||
| @@ -238,7 +238,7 @@ func (mounter *quobyteMounter) CanMount() error { | |||||||
|  |  | ||||||
| // SetUp attaches the disk and bind mounts to the volume path. | // SetUp attaches the disk and bind mounts to the volume path. | ||||||
| func (mounter *quobyteMounter) SetUp(fsGroup *int64) error { | func (mounter *quobyteMounter) SetUp(fsGroup *int64) error { | ||||||
| 	pluginDir := mounter.plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) | 	pluginDir := mounter.plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName)) | ||||||
| 	return mounter.SetUpAt(pluginDir, fsGroup) | 	return mounter.SetUpAt(pluginDir, fsGroup) | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -284,7 +284,7 @@ func (quobyteVolume *quobyte) GetPath() string { | |||||||
|  |  | ||||||
| 	// Quobyte has only one mount in the PluginDir where all Volumes are mounted | 	// Quobyte has only one mount in the PluginDir where all Volumes are mounted | ||||||
| 	// The Quobyte client does a fixed-user mapping | 	// The Quobyte client does a fixed-user mapping | ||||||
| 	pluginDir := quobyteVolume.plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) | 	pluginDir := quobyteVolume.plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName)) | ||||||
| 	return path.Join(pluginDir, fmt.Sprintf("%s#%s@%s", user, group, quobyteVolume.volume)) | 	return path.Join(pluginDir, fmt.Sprintf("%s#%s@%s", user, group, quobyteVolume.volume)) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	volutil "k8s.io/kubernetes/pkg/volume/util" | 	volutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var ( | var ( | ||||||
| @@ -75,7 +75,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(rbdPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(rbdPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *rbdPlugin) Init(host volume.VolumeHost) error { | func (plugin *rbdPlugin) Init(host volume.VolumeHost) error { | ||||||
| @@ -930,7 +930,7 @@ func (rbd *rbd) rbdGlobalMapPath(spec *volume.Spec) (string, error) { | |||||||
|  |  | ||||||
| func (rbd *rbd) rbdPodDeviceMapPath() (string, string) { | func (rbd *rbd) rbdPodDeviceMapPath() (string, string) { | ||||||
| 	name := rbdPluginName | 	name := rbdPluginName | ||||||
| 	return rbd.plugin.host.GetPodVolumeDeviceDir(rbd.podUID, strings.EscapeQualifiedName(name)), rbd.volName | 	return rbd.plugin.host.GetPodVolumeDeviceDir(rbd.podUID, utilstrings.EscapeQualifiedName(name)), rbd.volName | ||||||
| } | } | ||||||
|  |  | ||||||
| type rbdDiskUnmapper struct { | type rbdDiskUnmapper struct { | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type sioVolume struct { | type sioVolume struct { | ||||||
| @@ -61,7 +61,7 @@ var _ volume.Volume = &sioVolume{} | |||||||
| func (v *sioVolume) GetPath() string { | func (v *sioVolume) GetPath() string { | ||||||
| 	return v.plugin.host.GetPodVolumeDir( | 	return v.plugin.host.GetPodVolumeDir( | ||||||
| 		v.podUID, | 		v.podUID, | ||||||
| 		utilsstrings.EscapeQualifiedName(sioPluginName), | 		utilstrings.EscapeQualifiedName(sioPluginName), | ||||||
| 		v.volSpecName) | 		v.volSpecName) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | 	volumeutil "k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the entry point for plugin detection in a package. | // ProbeVolumePlugins is the entry point for plugin detection in a package. | ||||||
| @@ -54,7 +54,7 @@ func wrappedVolumeSpec() volume.Spec { | |||||||
| } | } | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(secretPluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(secretPluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *secretPlugin) Init(host volume.VolumeHost) error { | func (plugin *secretPlugin) Init(host volume.VolumeHost) error { | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // ProbeVolumePlugins is the primary entrypoint for volume plugins. | // ProbeVolumePlugins is the primary entrypoint for volume plugins. | ||||||
| @@ -63,9 +63,9 @@ const ( | |||||||
|  |  | ||||||
| func getPath(uid types.UID, volNamespace string, volName string, pvName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volNamespace string, volName string, pvName string, host volume.VolumeHost) string { | ||||||
| 	if len(volNamespace) != 0 && len(volName) != 0 && strings.Count(volName, ".") == 0 { | 	if len(volNamespace) != 0 && len(volName) != 0 && strings.Count(volName, ".") == 0 { | ||||||
| 		return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName+"."+volNamespace+"."+volName) | 		return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(storageosPluginName), pvName+"."+volNamespace+"."+volName) | ||||||
| 	} | 	} | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(storageosPluginName), pvName) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (plugin *storageosPlugin) Init(host volume.VolumeHost) error { | func (plugin *storageosPlugin) Init(host volume.VolumeHost) error { | ||||||
| @@ -431,7 +431,7 @@ func (b *storageosMounter) SetUpAt(dir string, fsGroup *int64) error { | |||||||
| } | } | ||||||
|  |  | ||||||
| func makeGlobalPDName(host volume.VolumeHost, pvName, volNamespace, volName string) string { | func makeGlobalPDName(host volume.VolumeHost, pvName, volNamespace, volName string) string { | ||||||
| 	return path.Join(host.GetPluginDir(utilsstrings.EscapeQualifiedName(storageosPluginName)), mount.MountsInGlobalPDPath, pvName+"."+volNamespace+"."+volName) | 	return path.Join(host.GetPluginDir(utilstrings.EscapeQualifiedName(storageosPluginName)), mount.MountsInGlobalPDPath, pvName+"."+volNamespace+"."+volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // Given the pod id and PV name, finds the volume's namespace and name from the | // Given the pod id and PV name, finds the volume's namespace and name from the | ||||||
| @@ -443,7 +443,7 @@ func getVolumeInfo(pvName string, podUID types.UID, host volume.VolumeHost) (str | |||||||
| 		return volNamespace, volName, nil | 		return volNamespace, volName, nil | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	volumeDir := filepath.Dir(host.GetPodVolumeDir(podUID, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName)) | 	volumeDir := filepath.Dir(host.GetPodVolumeDir(podUID, utilstrings.EscapeQualifiedName(storageosPluginName), pvName)) | ||||||
| 	files, err := ioutil.ReadDir(volumeDir) | 	files, err := ioutil.ReadDir(volumeDir) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return "", "", fmt.Errorf("Could not read mounts from pod volume dir: %s", err) | 		return "", "", fmt.Errorf("Could not read mounts from pod volume dir: %s", err) | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/recyclerclient" | 	"k8s.io/kubernetes/pkg/volume/util/recyclerclient" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -765,7 +765,7 @@ func (fv *FakeVolume) GetPath() string { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (fv *FakeVolume) getPath() string { | func (fv *FakeVolume) getPath() string { | ||||||
| 	return path.Join(fv.Plugin.Host.GetPodVolumeDir(fv.PodUID, utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName), fv.VolName)) | 	return path.Join(fv.Plugin.Host.GetPodVolumeDir(fv.PodUID, utilstrings.EscapeQualifiedName(fv.Plugin.PluginName), fv.VolName)) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (fv *FakeVolume) TearDown() error { | func (fv *FakeVolume) TearDown() error { | ||||||
| @@ -810,7 +810,7 @@ func (fv *FakeVolume) GetGlobalMapPath(spec *Spec) (string, error) { | |||||||
|  |  | ||||||
| // Block volume support | // Block volume support | ||||||
| func (fv *FakeVolume) getGlobalMapPath() (string, error) { | func (fv *FakeVolume) getGlobalMapPath() (string, error) { | ||||||
| 	return path.Join(fv.Plugin.Host.GetVolumeDevicePluginDir(utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName)), "pluginDependentPath"), nil | 	return path.Join(fv.Plugin.Host.GetVolumeDevicePluginDir(utilstrings.EscapeQualifiedName(fv.Plugin.PluginName)), "pluginDependentPath"), nil | ||||||
| } | } | ||||||
|  |  | ||||||
| // Block volume support | // Block volume support | ||||||
| @@ -830,7 +830,7 @@ func (fv *FakeVolume) GetPodDeviceMapPath() (string, string) { | |||||||
|  |  | ||||||
| // Block volume support | // Block volume support | ||||||
| func (fv *FakeVolume) getPodDeviceMapPath() (string, string) { | func (fv *FakeVolume) getPodDeviceMapPath() (string, string) { | ||||||
| 	return path.Join(fv.Plugin.Host.GetPodVolumeDeviceDir(fv.PodUID, utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName))), fv.VolName | 	return path.Join(fv.Plugin.Host.GetPodVolumeDeviceDir(fv.PodUID, utilstrings.EscapeQualifiedName(fv.Plugin.PluginName))), fv.VolName | ||||||
| } | } | ||||||
|  |  | ||||||
| // Block volume support | // Block volume support | ||||||
|   | |||||||
| @@ -47,7 +47,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/types" | 	"k8s.io/kubernetes/pkg/volume/util/types" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -820,7 +820,7 @@ func GetPersistentVolumeClaimVolumeMode(claim *v1.PersistentVolumeClaim) (v1.Per | |||||||
|  |  | ||||||
| // GetPersistentVolumeClaimQualifiedName returns a qualified name for pvc. | // GetPersistentVolumeClaimQualifiedName returns a qualified name for pvc. | ||||||
| func GetPersistentVolumeClaimQualifiedName(claim *v1.PersistentVolumeClaim) string { | func GetPersistentVolumeClaimQualifiedName(claim *v1.PersistentVolumeClaim) string { | ||||||
| 	return utilsstrings.JoinQualifiedName(claim.GetNamespace(), claim.GetName()) | 	return utilstrings.JoinQualifiedName(claim.GetNamespace(), claim.GetName()) | ||||||
| } | } | ||||||
|  |  | ||||||
| // CheckVolumeModeFilesystem checks VolumeMode. | // CheckVolumeModeFilesystem checks VolumeMode. | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/util/mount" | 	"k8s.io/kubernetes/pkg/util/mount" | ||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // This is the primary entrypoint for volume plugins. | // This is the primary entrypoint for volume plugins. | ||||||
| @@ -54,7 +54,7 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
| 	return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(vsphereVolumePluginName), volName) | 	return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(vsphereVolumePluginName), volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // vSphere Volume Plugin | // vSphere Volume Plugin | ||||||
| @@ -298,7 +298,7 @@ func makeGlobalPDPath(host volume.VolumeHost, devName string) string { | |||||||
|  |  | ||||||
| func (vv *vsphereVolume) GetPath() string { | func (vv *vsphereVolume) GetPath() string { | ||||||
| 	name := vsphereVolumePluginName | 	name := vsphereVolumePluginName | ||||||
| 	return vv.plugin.host.GetPodVolumeDir(vv.podUID, utilsstrings.EscapeQualifiedName(name), vv.volName) | 	return vv.plugin.host.GetPodVolumeDir(vv.podUID, utilstrings.EscapeQualifiedName(name), vv.volName) | ||||||
| } | } | ||||||
|  |  | ||||||
| // vSphere Persistent Volume Plugin | // vSphere Persistent Volume Plugin | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ import ( | |||||||
| 	"k8s.io/kubernetes/pkg/volume" | 	"k8s.io/kubernetes/pkg/volume" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util" | 	"k8s.io/kubernetes/pkg/volume/util" | ||||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | 	"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" | ||||||
| 	utilsstrings "k8s.io/utils/strings" | 	utilstrings "k8s.io/utils/strings" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var _ volume.BlockVolumePlugin = &vsphereVolumePlugin{} | var _ volume.BlockVolumePlugin = &vsphereVolumePlugin{} | ||||||
| @@ -157,5 +157,5 @@ func (v *vsphereVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (v *vsphereVolume) GetPodDeviceMapPath() (string, string) { | func (v *vsphereVolume) GetPodDeviceMapPath() (string, string) { | ||||||
| 	return v.plugin.host.GetPodVolumeDeviceDir(v.podUID, utilsstrings.EscapeQualifiedName(vsphereVolumePluginName)), v.volName | 	return v.plugin.host.GetPodVolumeDeviceDir(v.podUID, utilstrings.EscapeQualifiedName(vsphereVolumePluginName)), v.volName | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 danielqsj
					danielqsj