Skip to content

Commit 062f96a

Browse files
authored
Merge pull request #8860 from killianmuldoon/pr-pin-kind-sha-0.4-1.0
🐛 Pin kindest/node images to known good versions in clusterctl upgrade tests
2 parents 6aaae2f + 3e77da7 commit 062f96a

File tree

18 files changed

+97
-252
lines changed

18 files changed

+97
-252
lines changed

test/e2e/clusterctl_upgrade_test.go

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var _ = Describe("When testing clusterctl upgrades (v0.4=>current)", func() {
3535
SkipCleanup: skipCleanup,
3636
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.8/clusterctl-{OS}-{ARCH}",
3737
InitWithProvidersContract: "v1alpha4",
38+
// NOTE: If this version is changed here the image and SHA must also be updated in all DockerMachineTemplates in `test/data/infrastructure-docker/v0.4/bases.
3839
InitWithKubernetesVersion: "v1.23.17",
3940
WorkloadKubernetesVersion: "v1.23.17",
4041
MgmtFlavor: "topology",
@@ -73,10 +74,11 @@ var _ = Describe("When testing clusterctl upgrades (v1.0=>current)", func() {
7374
// runtime extension providers. If we don't do this the test will automatically
7475
// try to deploy the latest version of our test-extension from docker.yaml.
7576
InitWithRuntimeExtensionProviders: []string{},
76-
InitWithKubernetesVersion: "v1.23.17",
77-
WorkloadKubernetesVersion: "v1.23.17",
78-
MgmtFlavor: "topology",
79-
WorkloadFlavor: "",
77+
// NOTE: If this version is changed here the image and SHA must also be updated in all DockerMachineTemplates in `test/data/infrastructure-docker/v1.0/bases.
78+
InitWithKubernetesVersion: "v1.23.17",
79+
WorkloadKubernetesVersion: "v1.23.17",
80+
MgmtFlavor: "topology",
81+
WorkloadFlavor: "",
8082
// This check ensures that ownerReference apiVersions are updated for all types after the upgrade.
8183
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) {
8284
framework.ValidateOwnerReferencesOnUpdate(proxy, namespace,
@@ -112,10 +114,11 @@ var _ = Describe("When testing clusterctl upgrades (v1.3=>current)", func() {
112114
// try to deploy the latest version of our test-extension from docker.yaml.
113115
InitWithRuntimeExtensionProviders: []string{},
114116
InitWithProvidersContract: "v1beta1",
115-
InitWithKubernetesVersion: "v1.26.4",
116-
WorkloadKubernetesVersion: "v1.26.4",
117-
MgmtFlavor: "topology",
118-
WorkloadFlavor: "",
117+
// NOTE: If this version is changed here the image and SHA must also be updated in all DockerMachineTemplates in `test/data/infrastructure-docker/v1.3/bases.
118+
InitWithKubernetesVersion: "v1.26.4",
119+
WorkloadKubernetesVersion: "v1.26.4",
120+
MgmtFlavor: "topology",
121+
WorkloadFlavor: "",
119122
// This check ensures that ownerReference apiVersions are updated for all types after the upgrade.
120123
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) {
121124
framework.ValidateOwnerReferencesOnUpdate(proxy, namespace,
@@ -151,10 +154,11 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.3=>cur
151154
// try to deploy the latest version of our test-extension from docker.yaml.
152155
InitWithRuntimeExtensionProviders: []string{},
153156
InitWithProvidersContract: "v1beta1",
154-
InitWithKubernetesVersion: "v1.26.4",
155-
WorkloadKubernetesVersion: "v1.26.4",
156-
MgmtFlavor: "topology",
157-
WorkloadFlavor: "topology",
157+
// NOTE: If this version is changed here the image and SHA must also be updated in all DockerMachineTemplates in `test/data/infrastructure-docker/v1.3/bases.
158+
InitWithKubernetesVersion: "v1.26.4",
159+
WorkloadKubernetesVersion: "v1.26.4",
160+
MgmtFlavor: "topology",
161+
WorkloadFlavor: "topology",
158162
// This check ensures that ownerReference apiVersions are updated for all types after the upgrade.
159163
PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) {
160164
framework.ValidateOwnerReferencesOnUpdate(proxy, namespace,
@@ -180,6 +184,7 @@ var _ = Describe("When testing clusterctl upgrades (v1.4=>current)", func() {
180184
SkipCleanup: skipCleanup,
181185
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.0/clusterctl-{OS}-{ARCH}",
182186
InitWithProvidersContract: "v1beta1",
187+
// NOTE: If this version is changed here the image and SHA must also be updated in all DockerMachineTemplates in `test/data/infrastructure-docker/v1.4/bases.
183188
InitWithKubernetesVersion: "v1.27.1",
184189
WorkloadKubernetesVersion: "v1.27.1",
185190
MgmtFlavor: "topology",
@@ -209,6 +214,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.4=>cur
209214
SkipCleanup: skipCleanup,
210215
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.0/clusterctl-{OS}-{ARCH}",
211216
InitWithProvidersContract: "v1beta1",
217+
// NOTE: If this version is changed here the image and SHA must also be updated in all DockerMachineTemplates in `test/data/infrastructure-docker/v1.4/bases.
212218
InitWithKubernetesVersion: "v1.27.1",
213219
WorkloadKubernetesVersion: "v1.27.1",
214220
MgmtFlavor: "topology",

test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -196,30 +196,58 @@ spec:
196196
- name: customImage
197197
description: "Sets the container image that is used for running dockerMachines for the controlPlane and default-worker machineDeployments."
198198
definitions:
199-
- selector:
200-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
201-
kind: DockerMachineTemplate
202-
matchResources:
203-
machineDeploymentClass:
204-
names:
205-
- default-worker
206-
jsonPatches:
207-
- op: add
208-
path: "/spec/template/spec/customImage"
209-
valueFrom:
210-
template: |
211-
kindest/node:{{ .builtin.machineDeployment.version | replace "+" "_" }}
212-
- selector:
213-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
214-
kind: DockerMachineTemplate
215-
matchResources:
216-
controlPlane: true
217-
jsonPatches:
218-
- op: add
219-
path: "/spec/template/spec/customImage"
220-
valueFrom:
221-
template: |
222-
kindest/node:{{ .builtin.controlPlane.version | replace "+" "_" }}
199+
- selector:
200+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
201+
kind: DockerMachineTemplate
202+
matchResources:
203+
machineDeploymentClass:
204+
names:
205+
- default-worker
206+
jsonPatches:
207+
- op: add
208+
path: "/spec/template/spec/customImage"
209+
valueFrom:
210+
template: |
211+
kindest/node:{{ .builtin.machineDeployment.version | replace "+" "_" }}
212+
- selector:
213+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
214+
kind: DockerMachineTemplate
215+
matchResources:
216+
controlPlane: true
217+
jsonPatches:
218+
- op: add
219+
path: "/spec/template/spec/customImage"
220+
valueFrom:
221+
template: |
222+
kindest/node:{{ .builtin.controlPlane.version | replace "+" "_" }}
223+
- name: replaceImage-v1.23.17-machineDeployment
224+
description: "Sets the container image for MD DockerMachineTemplates using Kubernetes v1.23.17."
225+
enabledIf: '{{ semverCompare "v1.23.17" .builtin.machineDeployment.version }}'
226+
definitions:
227+
- selector:
228+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
229+
kind: DockerMachineTemplate
230+
matchResources:
231+
machineDeploymentClass:
232+
names:
233+
- default-worker
234+
jsonPatches:
235+
- op: add
236+
path: "/spec/template/spec/customImage"
237+
value: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff"
238+
- name: replaceImage-v1.23.17-controlPlane
239+
description: "Sets the container image for CP DockerMachineTemplates using Kubernetes v1.23.17."
240+
enabledIf: '{{ semverCompare "v1.23.17" .builtin.controlPlane.version }}'
241+
definitions:
242+
- selector:
243+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
244+
kind: DockerMachineTemplate
245+
matchResources:
246+
controlPlane: true
247+
jsonPatches:
248+
- op: add
249+
path: "/spec/template/spec/customImage"
250+
value: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff"
223251
- name: preloadImages
224252
description: |
225253
Sets the container images to preload to the node that is used for running dockerMachines.

test/e2e/data/infrastructure-docker/v0.4/bases/cluster-with-kcp.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ metadata:
3838
spec:
3939
template:
4040
spec:
41+
# NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here.
42+
customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff"
4143
extraMounts:
4244
- containerPath: "/var/run/docker.sock"
4345
hostPath: "/var/run/docker.sock"

test/e2e/data/infrastructure-docker/v0.4/bases/md.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ metadata:
88
spec:
99
template:
1010
spec:
11+
# NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here.
12+
customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff"
1113
extraMounts:
1214
- containerPath: "/var/run/docker.sock"
1315
hostPath: "/var/run/docker.sock"

test/e2e/data/infrastructure-docker/v0.4/bases/mhc.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/e2e/data/infrastructure-docker/v0.4/bases/mp.yaml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
bases:
22
- ../bases/cluster-with-kcp.yaml
33
- ../bases/md.yaml
4-
- ../bases/crs.yaml
5-
- ../bases/mp.yaml
6-
- ../bases/mhc.yaml
4+
- ../bases/crs.yaml

test/e2e/data/infrastructure-docker/v1.0/bases/cluster-with-kcp.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ metadata:
5656
spec:
5757
template:
5858
spec:
59+
# NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here.
60+
customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff"
5961
extraMounts:
6062
- containerPath: "/var/run/docker.sock"
6163
hostPath: "/var/run/docker.sock"

test/e2e/data/infrastructure-docker/v1.0/bases/md.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ metadata:
88
spec:
99
template:
1010
spec:
11+
# NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here.
12+
customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff"
1113
extraMounts:
1214
- containerPath: "/var/run/docker.sock"
1315
hostPath: "/var/run/docker.sock"

test/e2e/data/infrastructure-docker/v1.3/bases/cluster-with-kcp.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ metadata:
5656
spec:
5757
template:
5858
spec:
59+
# NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here.
60+
customImage: "kindest/node:v1.26.4@sha256:f4c0d87be03d6bea69f5e5dc0adb678bb498a190ee5c38422bf751541cebe92e"
5961
extraMounts:
6062
- containerPath: "/var/run/docker.sock"
6163
hostPath: "/var/run/docker.sock"

0 commit comments

Comments
 (0)