Skip to content

Commit 7e45964

Browse files
committed
Added E2E test for GCP Dual Stack.
The test currently adds the following parameters: - internalIpv6PrefixLength: 64 - stackType: DualStack
1 parent a6fa61b commit 7e45964

3 files changed

Lines changed: 203 additions & 0 deletions

File tree

test/e2e/config/gcp-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ providers:
7777
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-ci-with-external-and-internal-lb.yaml"
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"
80+
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-ci-with-dual-stack.yaml"
8081

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

test/e2e/e2e_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,33 @@ var _ = Describe("Workload cluster creation", func() {
273273
})
274274
})
275275

276+
Context("Creating a control-plane cluster with three control plane nodes and a dual stack network", func() {
277+
It("Should create a cluster with 3 control-plane and 1 worker node with a dual stack network", func() {
278+
Skip("This test requires a bootstrap cluster that has access to the network where the cluster is being created.")
279+
280+
clusterName := fmt.Sprintf("%s-dual-stack", clusterNamePrefix)
281+
By("Creating a cluster with a dual stack network from GKE bootstrap cluster")
282+
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
283+
ClusterProxy: bootstrapClusterProxy,
284+
ConfigCluster: clusterctl.ConfigClusterInput{
285+
LogFolder: clusterctlLogFolder,
286+
ClusterctlConfigPath: clusterctlConfigPath,
287+
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
288+
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
289+
Flavor: "ci-with-dual-stack",
290+
Namespace: namespace.Name,
291+
ClusterName: clusterName,
292+
KubernetesVersion: e2eConfig.MustGetVariable(KubernetesVersion),
293+
ControlPlaneMachineCount: ptr.To[int64](3),
294+
WorkerMachineCount: ptr.To[int64](1),
295+
},
296+
WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"),
297+
WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"),
298+
WaitForMachineDeployments: e2eConfig.GetIntervals(specName, "wait-worker-nodes"),
299+
}, result)
300+
})
301+
})
302+
276303
Context("Creating a cluster using a cluster class", func() {
277304
It("Should create a cluster class and then a cluster based on it", func() {
278305
clusterName := fmt.Sprintf("%s-topology", clusterNamePrefix)

0 commit comments

Comments
 (0)