mirror of https://github.com/k3s-io/k3s
Merge pull request #72205 from losipiuk/lo/env-gke-api-endpoint
Use CLOUDSDK_API_ENDPOINT_OVERRIDES_CONTAINER for GKE Api endpointpull/564/head
commit
cdeb8c108f
|
@ -68,7 +68,6 @@ const (
|
||||||
makeSchedulableDelay = 20 * time.Second
|
makeSchedulableDelay = 20 * time.Second
|
||||||
freshStatusLimit = 20 * time.Second
|
freshStatusLimit = 20 * time.Second
|
||||||
|
|
||||||
gkeEndpoint = "https://test-container.sandbox.googleapis.com"
|
|
||||||
gkeUpdateTimeout = 15 * time.Minute
|
gkeUpdateTimeout = 15 * time.Minute
|
||||||
gkeNodepoolNameKey = "cloud.google.com/gke-nodepool"
|
gkeNodepoolNameKey = "cloud.google.com/gke-nodepool"
|
||||||
|
|
||||||
|
@ -1035,13 +1034,24 @@ func runDrainTest(f *framework.Framework, migSizes map[string]int, namespace str
|
||||||
verifyFunction(increasedSize)
|
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 {
|
func getGKEURL(apiVersion string, suffix string) string {
|
||||||
out, err := execCmd("gcloud", "auth", "print-access-token").Output()
|
out, err := execCmd("gcloud", "auth", "print-access-token").Output()
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
token := strings.Replace(string(out), "\n", "", -1)
|
token := strings.Replace(string(out), "\n", "", -1)
|
||||||
|
|
||||||
return fmt.Sprintf("%s/%s/%s?access_token=%s",
|
return fmt.Sprintf("%s/%s/%s?access_token=%s",
|
||||||
gkeEndpoint,
|
getGkeApiEndpoint(),
|
||||||
apiVersion,
|
apiVersion,
|
||||||
suffix,
|
suffix,
|
||||||
token)
|
token)
|
||||||
|
|
Loading…
Reference in New Issue