diff --git a/pkg/cloudprovider/plugins.go b/pkg/cloudprovider/plugins.go index 0fc41f5eaf8..888532717aa 100644 --- a/pkg/cloudprovider/plugins.go +++ b/pkg/cloudprovider/plugins.go @@ -60,18 +60,6 @@ func IsCloudProvider(name string) bool { return found } -// CloudProviders returns the name of all registered cloud providers in a -// string slice -func CloudProviders() []string { - names := []string{} - providersMutex.Lock() - defer providersMutex.Unlock() - for name := range providers { - names = append(names, name) - } - return names -} - // GetCloudProvider creates an instance of the named cloud provider, or nil if // the name is unknown. The error return is only used if the named provider // was known but failed to initialize. The config parameter specifies the diff --git a/pkg/cloudprovider/providers/gce/gce.go b/pkg/cloudprovider/providers/gce/gce.go index 95d4f33afb5..9a2d92f6ef0 100644 --- a/pkg/cloudprovider/providers/gce/gce.go +++ b/pkg/cloudprovider/providers/gce/gce.go @@ -695,20 +695,6 @@ func gceSubnetworkURL(apiEndpoint, project, region, subnetwork string) string { return apiEndpoint + strings.Join([]string{"projects", project, "regions", region, "subnetworks", subnetwork}, "/") } -// getProjectIDInURL parses full resource URLS and shorter URLS -// https://www.googleapis.com/compute/v1/projects/myproject/global/networks/mycustom -// projects/myproject/global/networks/mycustom -// All return "myproject" -func getProjectIDInURL(urlStr string) (string, error) { - fields := strings.Split(urlStr, "/") - for i, v := range fields { - if v == "projects" && i < len(fields)-1 { - return fields[i+1], nil - } - } - return "", fmt.Errorf("could not find project field in url: %v", urlStr) -} - // getRegionInURL parses full resource URLS and shorter URLS // https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/subnetworks/a // projects/myproject/regions/us-central1/subnetworks/a diff --git a/pkg/cloudprovider/providers/vsphere/vclib/utils.go b/pkg/cloudprovider/providers/vsphere/vclib/utils.go index bac429d6deb..d449e5fe905 100644 --- a/pkg/cloudprovider/providers/vsphere/vclib/utils.go +++ b/pkg/cloudprovider/providers/vsphere/vclib/utils.go @@ -146,18 +146,6 @@ func GetPathFromVMDiskPath(vmDiskPath string) string { return datastorePathObj.Path } -// GetDatastoreFromVMDiskPath retrieves the path from VM Disk Path. -// Example: For vmDiskPath - [vsanDatastore] kubevols/volume.vmdk, the path is vsanDatastore -func GetDatastoreFromVMDiskPath(vmDiskPath string) string { - datastorePathObj := new(object.DatastorePath) - isSuccess := datastorePathObj.FromString(vmDiskPath) - if !isSuccess { - glog.Errorf("Failed to parse vmDiskPath: %s", vmDiskPath) - return "" - } - return datastorePathObj.Datastore -} - //GetDatastorePathObjFromVMDiskPath gets the datastorePathObj from VM disk path. func GetDatastorePathObjFromVMDiskPath(vmDiskPath string) (*object.DatastorePath, error) { datastorePathObj := new(object.DatastorePath)