Skip to content

Commit f3698aa

Browse files
committed
Enable GKE service API before the cluster creation
1 parent 8048b98 commit f3698aa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/k8s-integration/cluster.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ func setImageTypeEnvs(imageType string) error {
160160
}
161161

162162
func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int, imageType string, useManagedDriver bool) error {
163+
// Enable the GKE service API
164+
gkeURL := os.Getenv("CLOUDSDK_API_ENDPOINT_OVERRIDES_CONTAINER")
165+
if gkeURL == "" {
166+
gkeURL = "container.googleapis.com"
167+
}
168+
_, err := exec.Command("gcloud", "services", "enable", gkeURL).CombinedOutput()
169+
if err != nil {
170+
return fmt.Errorf("failed to enable GKE service API %q: %v", gkeURL, err)
171+
}
172+
163173
locationArg, locationVal, err := gkeLocationArgs(gceZone, gceRegion)
164174
if err != nil {
165175
return err

0 commit comments

Comments
 (0)