From f0348a88dcf988bf4a784f86eba0eecc85ce9412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kwa=C5=9Bniewski?= Date: Fri, 18 Jul 2025 17:00:06 +0200 Subject: [PATCH 1/2] Allow specifying --enable-ula-internal-ipv6 at network creation. This is necessary for testing clusters using dual-stack/IPv6-only networks --- kubetest/gke.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kubetest/gke.go b/kubetest/gke.go index dd1310689674..75c5f362d118 100644 --- a/kubetest/gke.go +++ b/kubetest/gke.go @@ -67,6 +67,7 @@ var ( gkeRemoveNetwork = flag.Bool("gke-remove-network", true, "(gke only) At the end of the test remove non-default network that was used by cluster.") gkeDumpConfigMaps = flag.String("gke-dump-configmaps", "[]", `(gke-only) A JSON description of ConfigMaps to dump as part of gathering cluster logs. Note: --dump or --dump-pre-test-logs flags must also be set. Example: '[{"Name":"my-map", "Namespace":"default", "DataKey":"my-data-key"}]`) gkeDumpAdditionalLogsCmd = flag.String("gke-dump-additional-logs-cmd", "", "(gke-only) if set, run this command to dump cluster logs.") + gkeNetworkULAInternalIPv6 = flag.Bool("gke-network-ula-internal-ipv6", false, "(gke-only) if true, create a network with --enable-ula-internal-ipv6.") // poolReTemplate matches instance group URLs of the form `https://www.googleapis.com/compute/v1/projects/some-project/zones/a-zone/instanceGroupManagers/gke-some-cluster-some-pool-90fcb815-grp`. Match meaning: // m[0]: path starting with zones/ @@ -102,6 +103,7 @@ type gkeDeployer struct { cluster string shape map[string]gkeNodePool network string + networkULAInternalIPv6 bool subnetwork string subnetMode string subnetworkRegion string @@ -167,6 +169,8 @@ func newGKE(provider, project, zone, region, network, image, imageFamily, imageP } g.network = network + g.networkULAInternalIPv6 = *gkeNetworkULAInternalIPv6 + if strings.ToUpper(image) == "CUSTOM" { if imageFamily == "" || imageProject == "" { return nil, fmt.Errorf("--image-family and --image-project must be set for GKE deployment if --gcp-node-image=CUSTOM") @@ -326,9 +330,16 @@ func (g *gkeDeployer) Up() error { "--format=value(name)")) != nil { // Assume error implies non-existent. log.Printf("Couldn't describe network '%s', assuming it doesn't exist and creating it", g.network) + + enableULAInternalIPv6 := "" + if g.networkULAInternalIPv6 { + enableULAInternalIPv6 = "--enable-ula-internal-ipv6" + } + if err := control.FinishRunning(exec.Command("gcloud", "compute", "networks", "create", g.network, "--project="+g.project, - "--subnet-mode="+g.subnetMode)); err != nil { + "--subnet-mode="+g.subnetMode, + enableULAInternalIPv6)); err != nil { return err } } From 36dcff9db770b9fa569c3f1eb76425935af9886b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kwa=C5=9Bniewski?= Date: Wed, 6 Aug 2025 16:39:12 +0200 Subject: [PATCH 2/2] set env with GKFE cluster endpoint --- kubetest/gke.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kubetest/gke.go b/kubetest/gke.go index 75c5f362d118..cd8e897c2959 100644 --- a/kubetest/gke.go +++ b/kubetest/gke.go @@ -448,6 +448,16 @@ func (g *gkeDeployer) Up() error { return fmt.Errorf("error creating node pool %q: %w", poolName, err) } } + + endpoint, err := exec.Command("gcloud", "container", "clusters", "describe", g.cluster, "--project=", g.project, "--location", g.location, "--format='value(controlPlaneEndpointsConfig.dnsEndpointConfig.endpoint)'") + if err != nil { + return fmt.Errorf("error fetching cluster endpoint: %v", err) + } + + if err = os.Setenv("GKFE_CLUSTER_ENDPOINT", string(endpoint)); err != nil { + return fmt.Errorf("error setting GKFE cluster endpoint: %v", err) + } + return nil }