mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
fix gce cloud provider projects api
This commit is contained in:
parent
f818cbeaed
commit
a471140e13
@ -188,7 +188,7 @@ func newGCECloud(config io.Reader) (*GCECloud, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
networkURL := gceNetworkURL(apiEndpoint, projectID, networkName)
|
||||
networkURL := gceNetworkURL("", projectID, networkName)
|
||||
subnetworkURL := ""
|
||||
|
||||
// By default, Kubernetes clusters only run against one zone
|
||||
|
@ -234,11 +234,11 @@ func (gce *GCECloud) CreateDisk(
|
||||
return fmt.Errorf("invalid GCE disk type %q", diskType)
|
||||
}
|
||||
|
||||
apiEndpoint := gceComputeAPIEndpoint + "projects/"
|
||||
projectsApiEndpoint := gceComputeAPIEndpoint + "projects/"
|
||||
if gce.service != nil {
|
||||
apiEndpoint = gce.service.BasePath
|
||||
projectsApiEndpoint = gce.service.BasePath
|
||||
}
|
||||
diskTypeUri := apiEndpoint + fmt.Sprintf(diskTypeUriTemplate, gce.projectID, zone, diskType)
|
||||
diskTypeUri := projectsApiEndpoint + fmt.Sprintf(diskTypeUriTemplate, gce.projectID, zone, diskType)
|
||||
|
||||
diskToCreate := &compute.Disk{
|
||||
Name: name,
|
||||
|
@ -542,7 +542,7 @@ func (gce *GCECloud) updateTargetPool(loadBalancerName string, existing sets.Str
|
||||
}
|
||||
|
||||
func (gce *GCECloud) targetPoolURL(name, region string) string {
|
||||
return gce.service.BasePath + strings.Join([]string{"projects", gce.projectID, "regions", region, "targetPools", name}, "/")
|
||||
return gce.service.BasePath + strings.Join([]string{gce.projectID, "regions", region, "targetPools", name}, "/")
|
||||
}
|
||||
|
||||
func makeHttpHealthCheck(name, path string, port int32) *compute.HttpHealthCheck {
|
||||
@ -671,9 +671,9 @@ func nodeNames(nodes []*v1.Node) []string {
|
||||
return ret
|
||||
}
|
||||
|
||||
func makeHostURL(apiEndpoint, projectID, zone, host string) string {
|
||||
func makeHostURL(projectsApiEndpoint, projectID, zone, host string) string {
|
||||
host = canonicalizeInstanceName(host)
|
||||
return apiEndpoint + strings.Join([]string{"projects", projectID, "zones", zone, "instances", host}, "/")
|
||||
return projectsApiEndpoint + strings.Join([]string{projectID, "zones", zone, "instances", host}, "/")
|
||||
}
|
||||
|
||||
func hostURLToComparablePath(hostURL string) string {
|
||||
|
@ -624,7 +624,7 @@ func getPortsAndProtocol(svcPorts []v1.ServicePort) (ports []string, protocol v1
|
||||
}
|
||||
|
||||
func (gce *GCECloud) getBackendServiceLink(name string) string {
|
||||
return gce.service.BasePath + strings.Join([]string{"projects", gce.projectID, "regions", gce.region, "backendServices", name}, "/")
|
||||
return gce.service.BasePath + strings.Join([]string{gce.projectID, "regions", gce.region, "backendServices", name}, "/")
|
||||
}
|
||||
|
||||
func getNameFromLink(link string) string {
|
||||
|
@ -53,5 +53,5 @@ func (gce *GCECloud) ListZonesInRegion(region string) ([]*compute.Zone, error) {
|
||||
}
|
||||
|
||||
func (gce *GCECloud) getRegionLink(region string) string {
|
||||
return gce.service.BasePath + strings.Join([]string{"projects", gce.projectID, "regions", region}, "/")
|
||||
return gce.service.BasePath + strings.Join([]string{gce.projectID, "regions", region}, "/")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user