mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 22:20:51 +00:00
remove unuse code in cloudprovider
This commit is contained in:
@@ -60,18 +60,6 @@ func IsCloudProvider(name string) bool {
|
|||||||
return found
|
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
|
// 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
|
// 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
|
// was known but failed to initialize. The config parameter specifies the
|
||||||
|
@@ -695,20 +695,6 @@ func gceSubnetworkURL(apiEndpoint, project, region, subnetwork string) string {
|
|||||||
return apiEndpoint + strings.Join([]string{"projects", project, "regions", region, "subnetworks", subnetwork}, "/")
|
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
|
// getRegionInURL parses full resource URLS and shorter URLS
|
||||||
// https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/subnetworks/a
|
// https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/subnetworks/a
|
||||||
// projects/myproject/regions/us-central1/subnetworks/a
|
// projects/myproject/regions/us-central1/subnetworks/a
|
||||||
|
@@ -146,18 +146,6 @@ func GetPathFromVMDiskPath(vmDiskPath string) string {
|
|||||||
return datastorePathObj.Path
|
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.
|
//GetDatastorePathObjFromVMDiskPath gets the datastorePathObj from VM disk path.
|
||||||
func GetDatastorePathObjFromVMDiskPath(vmDiskPath string) (*object.DatastorePath, error) {
|
func GetDatastorePathObjFromVMDiskPath(vmDiskPath string) (*object.DatastorePath, error) {
|
||||||
datastorePathObj := new(object.DatastorePath)
|
datastorePathObj := new(object.DatastorePath)
|
||||||
|
Reference in New Issue
Block a user