mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
add 'projects/' suffix if this library is used with an older version of the google api library
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
This commit is contained in:
parent
2d3323d1fb
commit
768d69a423
@ -435,9 +435,15 @@ func CreateGCECloud(config *CloudConfig) (*Cloud, error) {
|
||||
serviceAlpha.UserAgent = userAgent
|
||||
|
||||
if config.APIEndpoint != "" {
|
||||
service.BasePath = config.APIEndpoint
|
||||
serviceBeta.BasePath = strings.Replace(config.APIEndpoint, "v1", "beta", -1)
|
||||
serviceAlpha.BasePath = strings.Replace(config.APIEndpoint, "v1", "alpha", -1)
|
||||
if strings.HasSuffix(service.BasePath, "/projects/") {
|
||||
service.BasePath = getProjectsBasePath(config.APIEndpoint)
|
||||
serviceBeta.BasePath = getProjectsBasePath(strings.Replace(config.APIEndpoint, "v1", "beta", -1))
|
||||
serviceAlpha.BasePath = getProjectsBasePath(strings.Replace(config.APIEndpoint, "v1", "alpha", -1))
|
||||
} else {
|
||||
service.BasePath = config.APIEndpoint
|
||||
serviceBeta.BasePath = strings.Replace(config.APIEndpoint, "v1", "beta", -1)
|
||||
serviceAlpha.BasePath = strings.Replace(config.APIEndpoint, "v1", "alpha", -1)
|
||||
}
|
||||
}
|
||||
|
||||
containerService, err := container.NewService(context.Background(), option.WithTokenSource(config.TokenSource))
|
||||
|
Loading…
Reference in New Issue
Block a user