diff --git a/pkg/volume/aws_ebs/aws_ebs.go b/pkg/volume/aws_ebs/aws_ebs.go index 869d06773c1..71531245371 100644 --- a/pkg/volume/aws_ebs/aws_ebs.go +++ b/pkg/volume/aws_ebs/aws_ebs.go @@ -19,7 +19,6 @@ package aws_ebs import ( "fmt" "os" - "path" "path/filepath" "strconv" "strings" @@ -387,12 +386,12 @@ func makeGlobalPDPath(host volume.VolumeHost, volumeID aws.KubernetesVolumeID) s // Clean up the URI to be more fs-friendly name := string(volumeID) name = strings.Replace(name, "://", "/", -1) - return path.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath, name) + return filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath, name) } // Reverses the mapping done in makeGlobalPDPath func getVolumeIDFromGlobalMount(host volume.VolumeHost, globalPath string) (string, error) { - basePath := path.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath) + basePath := filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath) rel, err := filepath.Rel(basePath, globalPath) if err != nil { glog.Errorf("Failed to get volume id from global mount %s - %v", globalPath, err) diff --git a/pkg/volume/aws_ebs/aws_ebs_block.go b/pkg/volume/aws_ebs/aws_ebs_block.go index d104bafa5e9..37e748707c6 100644 --- a/pkg/volume/aws_ebs/aws_ebs_block.go +++ b/pkg/volume/aws_ebs/aws_ebs_block.go @@ -18,7 +18,6 @@ package aws_ebs import ( "fmt" - "path" "path/filepath" "strconv" "strings" @@ -164,7 +163,7 @@ func (ebs *awsElasticBlockStore) GetGlobalMapPath(spec *volume.Spec) (string, er if err != nil { return "", err } - return path.Join(ebs.plugin.host.GetVolumeDevicePluginDir(awsElasticBlockStorePluginName), string(volumeSource.VolumeID)), nil + return filepath.Join(ebs.plugin.host.GetVolumeDevicePluginDir(awsElasticBlockStorePluginName), string(volumeSource.VolumeID)), nil } // GetPodDeviceMapPath returns pod device map path and volume name diff --git a/pkg/volume/aws_ebs/aws_ebs_block_test.go b/pkg/volume/aws_ebs/aws_ebs_block_test.go index a1a4ba37d8c..5181492d6c0 100644 --- a/pkg/volume/aws_ebs/aws_ebs_block_test.go +++ b/pkg/volume/aws_ebs/aws_ebs_block_test.go @@ -18,7 +18,7 @@ package aws_ebs import ( "os" - "path" + "path/filepath" "testing" "k8s.io/api/core/v1" @@ -47,7 +47,7 @@ func TestGetVolumeSpecFromGlobalMapPath(t *testing.T) { //deferred clean up defer os.RemoveAll(tmpVDir) - expectedGlobalPath := path.Join(tmpVDir, testGlobalPath) + expectedGlobalPath := filepath.Join(tmpVDir, testGlobalPath) //Bad Path badspec, err := getVolumeSpecFromGlobalMapPath("") @@ -102,8 +102,8 @@ func TestGetPodAndPluginMapPaths(t *testing.T) { //deferred clean up defer os.RemoveAll(tmpVDir) - expectedGlobalPath := path.Join(tmpVDir, testGlobalPath) - expectedPodPath := path.Join(tmpVDir, testPodPath) + expectedGlobalPath := filepath.Join(tmpVDir, testGlobalPath) + expectedPodPath := filepath.Join(tmpVDir, testPodPath) spec := getTestVolume(false, true /*isBlock*/) plugMgr := volume.VolumePluginMgr{} diff --git a/pkg/volume/aws_ebs/aws_ebs_test.go b/pkg/volume/aws_ebs/aws_ebs_test.go index 95d81c049ef..72438e379b7 100644 --- a/pkg/volume/aws_ebs/aws_ebs_test.go +++ b/pkg/volume/aws_ebs/aws_ebs_test.go @@ -19,7 +19,7 @@ package aws_ebs import ( "fmt" "os" - "path" + "path/filepath" "testing" "k8s.io/api/core/v1" @@ -129,7 +129,7 @@ func TestPlugin(t *testing.T) { t.Errorf("Got a nil Mounter") } - volPath := path.Join(tmpDir, "pods/poduid/volumes/kubernetes.io~aws-ebs/vol1") + volPath := filepath.Join(tmpDir, "pods/poduid/volumes/kubernetes.io~aws-ebs/vol1") path := mounter.GetPath() if path != volPath { t.Errorf("Got unexpected path: %s", path) diff --git a/pkg/volume/azure_dd/attacher.go b/pkg/volume/azure_dd/attacher.go index de6c5368f28..06c67a57934 100644 --- a/pkg/volume/azure_dd/attacher.go +++ b/pkg/volume/azure_dd/attacher.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "os" - "path" "path/filepath" "runtime" "strconv" @@ -210,7 +209,7 @@ func (a *azureDiskAttacher) GetDeviceMountPath(spec *volume.Spec) (string, error } if volumeSource.Kind == nil { // this spec was constructed from info on the node - pdPath := path.Join(a.plugin.host.GetPluginDir(azureDataDiskPluginName), mount.MountsInGlobalPDPath, volumeSource.DataDiskURI) + pdPath := filepath.Join(a.plugin.host.GetPluginDir(azureDataDiskPluginName), mount.MountsInGlobalPDPath, volumeSource.DataDiskURI) return pdPath, nil } diff --git a/pkg/volume/azure_dd/azure_common.go b/pkg/volume/azure_dd/azure_common.go index b5f4e77f7bd..54d05f5dabd 100644 --- a/pkg/volume/azure_dd/azure_common.go +++ b/pkg/volume/azure_dd/azure_common.go @@ -20,7 +20,7 @@ import ( "fmt" "io/ioutil" "os" - "path" + "path/filepath" libstrings "strings" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage" @@ -77,7 +77,7 @@ func makeGlobalPDPath(host volume.VolumeHost, diskUri string, isManaged bool) (s } // "{m for managed b for blob}{hashed diskUri or DiskId depending on disk kind }" diskName := fmt.Sprintf(uniqueDiskNameTemplate, prefix, hashedDiskUri) - pdPath := path.Join(host.GetPluginDir(azureDataDiskPluginName), mount.MountsInGlobalPDPath, diskName) + pdPath := filepath.Join(host.GetPluginDir(azureDataDiskPluginName), mount.MountsInGlobalPDPath, diskName) return pdPath, nil } diff --git a/pkg/volume/azure_dd/azure_common_linux.go b/pkg/volume/azure_dd/azure_common_linux.go index 3c19b9244b5..806e27e0e94 100644 --- a/pkg/volume/azure_dd/azure_common_linux.go +++ b/pkg/volume/azure_dd/azure_common_linux.go @@ -20,7 +20,7 @@ package azure_dd import ( "fmt" - "path" + "path/filepath" "strconv" libstrings "strings" @@ -124,7 +124,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st if lun == l { // find the matching LUN // read vendor and model to ensure it is a VHD disk - vendorPath := path.Join(sys_path, name, "vendor") + vendorPath := filepath.Join(sys_path, name, "vendor") vendorBytes, err := io.ReadFile(vendorPath) if err != nil { glog.Errorf("failed to read device vendor, err: %v", err) @@ -136,7 +136,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st continue } - modelPath := path.Join(sys_path, name, "model") + modelPath := filepath.Join(sys_path, name, "model") modelBytes, err := io.ReadFile(modelPath) if err != nil { glog.Errorf("failed to read device model, err: %v", err) @@ -149,7 +149,7 @@ func findDiskByLunWithConstraint(lun int, io ioHandler, azureDisks []string) (st } // find a disk, validate name - dir := path.Join(sys_path, name, "block") + dir := filepath.Join(sys_path, name, "block") if dev, err := io.ReadDir(dir); err == nil { found := false devName := dev[0].Name() diff --git a/pkg/volume/azure_file/azure_file_test.go b/pkg/volume/azure_file/azure_file_test.go index 1f394d69cef..43dcd208186 100644 --- a/pkg/volume/azure_file/azure_file_test.go +++ b/pkg/volume/azure_file/azure_file_test.go @@ -20,7 +20,7 @@ import ( "fmt" "io/ioutil" "os" - "path" + "path/filepath" "reflect" "strings" "testing" @@ -149,7 +149,7 @@ func testPlugin(t *testing.T, tmpDir string, volumeHost volume.VolumeHost) { if mounter == nil { t.Errorf("Got a nil Mounter") } - volPath := path.Join(tmpDir, "pods/poduid/volumes/kubernetes.io~azure-file/vol1") + volPath := filepath.Join(tmpDir, "pods/poduid/volumes/kubernetes.io~azure-file/vol1") path := mounter.GetPath() if path != volPath { t.Errorf("Got unexpected path: %s", path)