fix gce cloud provider projects api

This commit is contained in:
Minhan Xia 2017-07-13 13:51:53 -07:00
parent f818cbeaed
commit a471140e13
5 changed files with 9 additions and 9 deletions

View File

@ -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

View File

@ -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,

View File

@ -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 {

View File

@ -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 {

View File

@ -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}, "/")
}