From b1408dbe450a35a152ae748c7024ddadca39922c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Osipiuk?= Date: Wed, 19 Dec 2018 17:55:33 +0100 Subject: [PATCH] Use CLOUDSDK_API_ENDPOINT_OVERRIDES_CONTAINER for GKE Api endpoint --- test/e2e/autoscaling/cluster_size_autoscaling.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/e2e/autoscaling/cluster_size_autoscaling.go b/test/e2e/autoscaling/cluster_size_autoscaling.go index 2d2f866997d..9258fb53717 100644 --- a/test/e2e/autoscaling/cluster_size_autoscaling.go +++ b/test/e2e/autoscaling/cluster_size_autoscaling.go @@ -68,7 +68,6 @@ const ( makeSchedulableDelay = 20 * time.Second freshStatusLimit = 20 * time.Second - gkeEndpoint = "https://test-container.sandbox.googleapis.com" gkeUpdateTimeout = 15 * time.Minute gkeNodepoolNameKey = "cloud.google.com/gke-nodepool" @@ -1035,13 +1034,24 @@ func runDrainTest(f *framework.Framework, migSizes map[string]int, namespace str verifyFunction(increasedSize) } +func getGkeApiEndpoint() string { + gkeApiEndpoint := os.Getenv("CLOUDSDK_API_ENDPOINT_OVERRIDES_CONTAINER") + if gkeApiEndpoint == "" { + gkeApiEndpoint = "https://test-container.sandbox.googleapis.com" + } + if strings.HasSuffix(gkeApiEndpoint, "/") { + gkeApiEndpoint = gkeApiEndpoint[:len(gkeApiEndpoint)-1] + } + return gkeApiEndpoint +} + func getGKEURL(apiVersion string, suffix string) string { out, err := execCmd("gcloud", "auth", "print-access-token").Output() framework.ExpectNoError(err) token := strings.Replace(string(out), "\n", "", -1) return fmt.Sprintf("%s/%s/%s?access_token=%s", - gkeEndpoint, + getGkeApiEndpoint(), apiVersion, suffix, token)