From b395dc8ceebba1d78ec955551175dce03a72e82a Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Tue, 25 Feb 2020 20:27:59 +0800 Subject: [PATCH] fix: use globalEndpointType as default endpoint type --- pkg/compute/service/influxdb.go | 2 +- pkg/hostman/storageman/imagecache_local.go | 2 +- pkg/mcclient/auth/auth.go | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/compute/service/influxdb.go b/pkg/compute/service/influxdb.go index b40b840480..352c7f3366 100644 --- a/pkg/compute/service/influxdb.go +++ b/pkg/compute/service/influxdb.go @@ -23,7 +23,7 @@ import ( ) func setInfluxdbRetentionPolicy() error { - urls, err := auth.GetServiceURLs("influxdb", options.Options.Region, "", "internal") + urls, err := auth.GetServiceURLs("influxdb", options.Options.Region, "", "") if err != nil { return err } diff --git a/pkg/hostman/storageman/imagecache_local.go b/pkg/hostman/storageman/imagecache_local.go index cf7037d901..08f90843e7 100644 --- a/pkg/hostman/storageman/imagecache_local.go +++ b/pkg/hostman/storageman/imagecache_local.go @@ -174,7 +174,7 @@ func (l *SLocalImageCache) prepare(ctx context.Context, zone, srcUrl, format str l.consumerCount++ return true, true } - url, err := auth.GetServiceURL("image", "", zone, "public") + url, err := auth.GetServiceURL("image", "", zone, "") if err != nil { log.Errorf("Failed to acquire image %s", err) return false, true diff --git a/pkg/mcclient/auth/auth.go b/pkg/mcclient/auth/auth.go index 08c8812a57..5e637ca48b 100644 --- a/pkg/mcclient/auth/auth.go +++ b/pkg/mcclient/auth/auth.go @@ -210,10 +210,16 @@ func (a *authManager) reAuth() { } func (a *authManager) GetServiceURL(service, region, zone, endpointType string) (string, error) { + if endpointType == "" && globalEndpointType != "" { + endpointType = globalEndpointType + } return a.adminCredential.GetServiceURL(service, region, zone, endpointType) } func (a *authManager) GetServiceURLs(service, region, zone, endpointType string) ([]string, error) { + if endpointType == "" && globalEndpointType != "" { + endpointType = globalEndpointType + } return a.adminCredential.GetServiceURLs(service, region, zone, endpointType) }