Skip to content

Commit fab2e3c

Browse files
committed
1. cluster-template-ci-dual-stack-with-ipv6primary.yaml
Located at: /Users/bbarbach/dev/k8s-cluster-api-provider-gcp/test/e2e/data/infrastructure-gcp/ This template creates a DualStack cluster with IPv6 as the primary address: - stackType: "DualStack" - addressPreferencePolicy: "IPv6Primary" 2. dual_stack_test.go Located at: /Users/bbarbach/dev/k8s-cluster-api-provider-gcp/test/e2e/ This comprehensive test file includes three test contexts: Test 1: DualStack with IPv4Primary (Default) - Uses flavor: ci-with-dual-stack - Verifies StackType is DualStack - Verifies AddressPreferencePolicy defaults to IPv4Primary - Validates both IPv4 and IPv6 addresses are allocated - Confirms control plane endpoint uses IPv4 address - Checks both IPv4 and IPv6 forwarding rules exist Test 2: DualStack with IPv6Primary - Uses flavor: ci-dual-stack-with-ipv6primary - Verifies StackType is DualStack - Verifies AddressPreferencePolicy is IPv6Primary - Validates both IPv4 and IPv6 addresses are allocated - Confirms control plane endpoint uses IPv6 address (key difference) - Checks both IPv4 and IPv6 forwarding rules exist Test 3: IPv4Only (Default Behavior) - Uses default flavor - Verifies StackType is IPv4Only or empty (defaults to IPv4Only) - Validates only IPv4 addresses are allocated - Confirms no IPv6 addresses or forwarding rules exist - Verifies control plane endpoint uses IPv4 address 3. Updated gcp-ci.yaml Added the new template to the e2e configuration so it can be used in tests. 4. Moved Dual stack tests from e2e_test.go to dual_stack_test.go
1 parent 3ee0429 commit fab2e3c

4 files changed

Lines changed: 525 additions & 27 deletions

File tree

test/e2e/config/gcp-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ providers:
7878
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-ci-with-internal-lb.yaml"
7979
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/withclusterclass/cluster-template-ci-gke-autopilot-topology.yaml"
8080
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-ci-with-dual-stack.yaml"
81+
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-ci-dual-stack-with-ipv6primary.yaml"
8182

8283
variables:
8384
KUBERNETES_VERSION: "v1.33.2"
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: Cluster
4+
metadata:
5+
name: "${CLUSTER_NAME}"
6+
labels:
7+
cni: "${CLUSTER_NAME}-crs-cni"
8+
ccm: "${CLUSTER_NAME}-crs-ccm"
9+
spec:
10+
clusterNetwork:
11+
pods:
12+
cidrBlocks: ["192.168.0.0/16"]
13+
infrastructureRef:
14+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
15+
kind: GCPCluster
16+
name: "${CLUSTER_NAME}"
17+
controlPlaneRef:
18+
kind: KubeadmControlPlane
19+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
20+
name: "${CLUSTER_NAME}-control-plane"
21+
---
22+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
23+
kind: GCPCluster
24+
metadata:
25+
name: "${CLUSTER_NAME}"
26+
spec:
27+
project: "${GCP_PROJECT}"
28+
region: "${GCP_REGION}"
29+
network:
30+
name: "${GCP_NETWORK_NAME}"
31+
internalIpv6PrefixLength: 64
32+
stackType: "DualStack"
33+
addressPreferencePolicy: "IPv6Primary"
34+
---
35+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
36+
kind: KubeadmControlPlane
37+
metadata:
38+
name: "${CLUSTER_NAME}-control-plane"
39+
spec:
40+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
41+
machineTemplate:
42+
infrastructureRef:
43+
kind: GCPMachineTemplate
44+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
45+
name: "${CLUSTER_NAME}-control-plane"
46+
kubeadmConfigSpec:
47+
initConfiguration:
48+
nodeRegistration:
49+
name: '{{ ds.meta_data.local_hostname.split(".")[0] }}'
50+
kubeletExtraArgs:
51+
cloud-provider: external
52+
clusterConfiguration:
53+
apiServer:
54+
timeoutForControlPlane: 20m
55+
controllerManager:
56+
extraArgs:
57+
cloud-provider: external
58+
allocate-node-cidrs: "false"
59+
kubernetesVersion: "${KUBERNETES_VERSION}"
60+
files:
61+
- content: |
62+
[Global]
63+
64+
project-id = "${GCP_PROJECT}"
65+
network-name = "${GCP_NETWORK_NAME}"
66+
multizone = true
67+
owner: root:root
68+
path: /etc/kubernetes/cloud.config
69+
permissions: "0744"
70+
joinConfiguration:
71+
nodeRegistration:
72+
name: '{{ ds.meta_data.local_hostname.split(".")[0] }}'
73+
kubeletExtraArgs:
74+
cloud-provider: external
75+
version: "${KUBERNETES_VERSION}"
76+
---
77+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
78+
kind: GCPMachineTemplate
79+
metadata:
80+
name: "${CLUSTER_NAME}-control-plane"
81+
spec:
82+
template:
83+
spec:
84+
instanceType: "${GCP_CONTROL_PLANE_MACHINE_TYPE}"
85+
image: "${IMAGE_ID}"
86+
---
87+
apiVersion: cluster.x-k8s.io/v1beta1
88+
kind: MachineDeployment
89+
metadata:
90+
name: "${CLUSTER_NAME}-md-0"
91+
spec:
92+
clusterName: "${CLUSTER_NAME}"
93+
replicas: ${WORKER_MACHINE_COUNT}
94+
selector:
95+
matchLabels:
96+
template:
97+
spec:
98+
clusterName: "${CLUSTER_NAME}"
99+
version: "${KUBERNETES_VERSION}"
100+
bootstrap:
101+
configRef:
102+
name: "${CLUSTER_NAME}-md-0"
103+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
104+
kind: KubeadmConfigTemplate
105+
infrastructureRef:
106+
name: "${CLUSTER_NAME}-md-0"
107+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
108+
kind: GCPMachineTemplate
109+
---
110+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
111+
kind: GCPMachineTemplate
112+
metadata:
113+
name: "${CLUSTER_NAME}-md-0"
114+
spec:
115+
template:
116+
spec:
117+
instanceType: "${GCP_NODE_MACHINE_TYPE}"
118+
image: "${IMAGE_ID}"
119+
---
120+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
121+
kind: KubeadmConfigTemplate
122+
metadata:
123+
name: "${CLUSTER_NAME}-md-0"
124+
spec:
125+
template:
126+
spec:
127+
joinConfiguration:
128+
nodeRegistration:
129+
name: '{{ ds.meta_data.local_hostname.split(".")[0] }}'
130+
kubeletExtraArgs:
131+
cloud-provider: external
132+
---
133+
apiVersion: v1
134+
kind: ConfigMap
135+
metadata:
136+
name: "${CLUSTER_NAME}-crs-cni"
137+
data: ${CNI_RESOURCES}
138+
---
139+
apiVersion: addons.cluster.x-k8s.io/v1beta1
140+
kind: ClusterResourceSet
141+
metadata:
142+
name: "${CLUSTER_NAME}-crs-cni"
143+
spec:
144+
strategy: ApplyOnce
145+
clusterSelector:
146+
matchLabels:
147+
cni: "${CLUSTER_NAME}-crs-cni"
148+
resources:
149+
- name: "${CLUSTER_NAME}-crs-cni"
150+
kind: ConfigMap
151+
---
152+
apiVersion: v1
153+
kind: ConfigMap
154+
metadata:
155+
name: "${CLUSTER_NAME}-crs-ccm"
156+
data: ${CCM_RESOURCES}
157+
---
158+
apiVersion: addons.cluster.x-k8s.io/v1beta1
159+
kind: ClusterResourceSet
160+
metadata:
161+
name: "${CLUSTER_NAME}-crs-ccm"
162+
spec:
163+
strategy: ApplyOnce
164+
clusterSelector:
165+
matchLabels:
166+
ccm: "${CLUSTER_NAME}-crs-ccm"
167+
resources:
168+
- name: "${CLUSTER_NAME}-crs-ccm"
169+
kind: ConfigMap

0 commit comments

Comments
 (0)