From 3e77da78b3ef6415818cc361d2d0d36afeabcdb2 Mon Sep 17 00:00:00 2001 From: killianmuldoon Date: Thu, 15 Jun 2023 11:19:02 +0100 Subject: [PATCH] Use known kindest/node image versions by sha for e2e upgrade tests Signed-off-by: killianmuldoon --- test/e2e/clusterctl_upgrade_test.go | 30 +++++--- .../main/clusterclass-quick-start.yaml | 76 +++++++++++++------ .../v0.4/bases/cluster-with-kcp.yaml | 2 + .../infrastructure-docker/v0.4/bases/md.yaml | 2 + .../infrastructure-docker/v0.4/bases/mhc.yaml | 14 ---- .../infrastructure-docker/v0.4/bases/mp.yaml | 43 ----------- .../v0.4/cluster-template/kustomization.yaml | 4 +- .../v1.0/bases/cluster-with-kcp.yaml | 2 + .../infrastructure-docker/v1.0/bases/md.yaml | 2 + .../v1.3/bases/cluster-with-kcp.yaml | 2 + .../infrastructure-docker/v1.3/bases/md.yaml | 2 + .../infrastructure-docker/v1.3/bases/mp.yaml | 50 ------------ .../v1.3/clusterclass-quick-start.yaml | 31 +------- .../v1.4/bases/cluster-with-kcp.yaml | 2 + .../infrastructure-docker/v1.4/bases/md.yaml | 2 + .../infrastructure-docker/v1.4/bases/mp.yaml | 50 ------------ .../v1.4/clusterclass-quick-start.yaml | 31 +------- .../docker/internal/docker/machine.go | 4 +- 18 files changed, 97 insertions(+), 252 deletions(-) delete mode 100644 test/e2e/data/infrastructure-docker/v0.4/bases/mhc.yaml delete mode 100644 test/e2e/data/infrastructure-docker/v0.4/bases/mp.yaml delete mode 100644 test/e2e/data/infrastructure-docker/v1.3/bases/mp.yaml delete mode 100644 test/e2e/data/infrastructure-docker/v1.4/bases/mp.yaml diff --git a/test/e2e/clusterctl_upgrade_test.go b/test/e2e/clusterctl_upgrade_test.go index 47127cea0f23..35378fbb1db9 100644 --- a/test/e2e/clusterctl_upgrade_test.go +++ b/test/e2e/clusterctl_upgrade_test.go @@ -35,6 +35,7 @@ var _ = Describe("When testing clusterctl upgrades (v0.4=>current)", func() { SkipCleanup: skipCleanup, InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.8/clusterctl-{OS}-{ARCH}", InitWithProvidersContract: "v1alpha4", + // 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. InitWithKubernetesVersion: "v1.23.17", WorkloadKubernetesVersion: "v1.23.17", MgmtFlavor: "topology", @@ -73,10 +74,11 @@ var _ = Describe("When testing clusterctl upgrades (v1.0=>current)", func() { // runtime extension providers. If we don't do this the test will automatically // try to deploy the latest version of our test-extension from docker.yaml. InitWithRuntimeExtensionProviders: []string{}, - InitWithKubernetesVersion: "v1.23.17", - WorkloadKubernetesVersion: "v1.23.17", - MgmtFlavor: "topology", - WorkloadFlavor: "", + // 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. + InitWithKubernetesVersion: "v1.23.17", + WorkloadKubernetesVersion: "v1.23.17", + MgmtFlavor: "topology", + WorkloadFlavor: "", // This check ensures that ownerReference apiVersions are updated for all types after the upgrade. PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) { framework.ValidateOwnerReferencesOnUpdate(proxy, namespace, @@ -112,10 +114,11 @@ var _ = Describe("When testing clusterctl upgrades (v1.3=>current)", func() { // try to deploy the latest version of our test-extension from docker.yaml. InitWithRuntimeExtensionProviders: []string{}, InitWithProvidersContract: "v1beta1", - InitWithKubernetesVersion: "v1.26.4", - WorkloadKubernetesVersion: "v1.26.4", - MgmtFlavor: "topology", - WorkloadFlavor: "", + // 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. + InitWithKubernetesVersion: "v1.26.4", + WorkloadKubernetesVersion: "v1.26.4", + MgmtFlavor: "topology", + WorkloadFlavor: "", // This check ensures that ownerReference apiVersions are updated for all types after the upgrade. PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) { framework.ValidateOwnerReferencesOnUpdate(proxy, namespace, @@ -151,10 +154,11 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.3=>cur // try to deploy the latest version of our test-extension from docker.yaml. InitWithRuntimeExtensionProviders: []string{}, InitWithProvidersContract: "v1beta1", - InitWithKubernetesVersion: "v1.26.4", - WorkloadKubernetesVersion: "v1.26.4", - MgmtFlavor: "topology", - WorkloadFlavor: "topology", + // 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. + InitWithKubernetesVersion: "v1.26.4", + WorkloadKubernetesVersion: "v1.26.4", + MgmtFlavor: "topology", + WorkloadFlavor: "topology", // This check ensures that ownerReference apiVersions are updated for all types after the upgrade. PostUpgrade: func(proxy framework.ClusterProxy, namespace, clusterName string) { framework.ValidateOwnerReferencesOnUpdate(proxy, namespace, @@ -180,6 +184,7 @@ var _ = Describe("When testing clusterctl upgrades (v1.4=>current)", func() { SkipCleanup: skipCleanup, InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.0/clusterctl-{OS}-{ARCH}", InitWithProvidersContract: "v1beta1", + // 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. InitWithKubernetesVersion: "v1.27.1", WorkloadKubernetesVersion: "v1.27.1", MgmtFlavor: "topology", @@ -209,6 +214,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.4=>cur SkipCleanup: skipCleanup, InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.0/clusterctl-{OS}-{ARCH}", InitWithProvidersContract: "v1beta1", + // 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. InitWithKubernetesVersion: "v1.27.1", WorkloadKubernetesVersion: "v1.27.1", MgmtFlavor: "topology", diff --git a/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml index b6ced50c8f21..1626afac8cf0 100644 --- a/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml +++ b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml @@ -196,30 +196,58 @@ spec: - name: customImage description: "Sets the container image that is used for running dockerMachines for the controlPlane and default-worker machineDeployments." definitions: - - selector: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerMachineTemplate - matchResources: - machineDeploymentClass: - names: - - default-worker - jsonPatches: - - op: add - path: "/spec/template/spec/customImage" - valueFrom: - template: | - kindest/node:{{ .builtin.machineDeployment.version | replace "+" "_" }} - - selector: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerMachineTemplate - matchResources: - controlPlane: true - jsonPatches: - - op: add - path: "/spec/template/spec/customImage" - valueFrom: - template: | - kindest/node:{{ .builtin.controlPlane.version | replace "+" "_" }} + - selector: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: DockerMachineTemplate + matchResources: + machineDeploymentClass: + names: + - default-worker + jsonPatches: + - op: add + path: "/spec/template/spec/customImage" + valueFrom: + template: | + kindest/node:{{ .builtin.machineDeployment.version | replace "+" "_" }} + - selector: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: DockerMachineTemplate + matchResources: + controlPlane: true + jsonPatches: + - op: add + path: "/spec/template/spec/customImage" + valueFrom: + template: | + kindest/node:{{ .builtin.controlPlane.version | replace "+" "_" }} + - name: replaceImage-v1.23.17-machineDeployment + description: "Sets the container image for MD DockerMachineTemplates using Kubernetes v1.23.17." + enabledIf: '{{ semverCompare "v1.23.17" .builtin.machineDeployment.version }}' + definitions: + - selector: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: DockerMachineTemplate + matchResources: + machineDeploymentClass: + names: + - default-worker + jsonPatches: + - op: add + path: "/spec/template/spec/customImage" + value: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff" + - name: replaceImage-v1.23.17-controlPlane + description: "Sets the container image for CP DockerMachineTemplates using Kubernetes v1.23.17." + enabledIf: '{{ semverCompare "v1.23.17" .builtin.controlPlane.version }}' + definitions: + - selector: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: DockerMachineTemplate + matchResources: + controlPlane: true + jsonPatches: + - op: add + path: "/spec/template/spec/customImage" + value: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff" - name: preloadImages description: | Sets the container images to preload to the node that is used for running dockerMachines. diff --git a/test/e2e/data/infrastructure-docker/v0.4/bases/cluster-with-kcp.yaml b/test/e2e/data/infrastructure-docker/v0.4/bases/cluster-with-kcp.yaml index 6455e4c39aa1..371789cf5745 100644 --- a/test/e2e/data/infrastructure-docker/v0.4/bases/cluster-with-kcp.yaml +++ b/test/e2e/data/infrastructure-docker/v0.4/bases/cluster-with-kcp.yaml @@ -38,6 +38,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v0.4/bases/md.yaml b/test/e2e/data/infrastructure-docker/v0.4/bases/md.yaml index f7e7dafdd24e..e7c19d3c4497 100644 --- a/test/e2e/data/infrastructure-docker/v0.4/bases/md.yaml +++ b/test/e2e/data/infrastructure-docker/v0.4/bases/md.yaml @@ -8,6 +8,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v0.4/bases/mhc.yaml b/test/e2e/data/infrastructure-docker/v0.4/bases/mhc.yaml deleted file mode 100644 index 17905cb95e30..000000000000 --- a/test/e2e/data/infrastructure-docker/v0.4/bases/mhc.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: MachineHealthCheck -metadata: - name: "${CLUSTER_NAME}-mhc-0" -spec: - clusterName: "${CLUSTER_NAME}" - selector: - matchLabels: - cluster.x-k8s.io/control-plane: "" - nodeStartupTimeout: 60m - unhealthyConditions: - - type: DummyCondition - status: "False" - timeout: 60m diff --git a/test/e2e/data/infrastructure-docker/v0.4/bases/mp.yaml b/test/e2e/data/infrastructure-docker/v0.4/bases/mp.yaml deleted file mode 100644 index bcc226b3c92a..000000000000 --- a/test/e2e/data/infrastructure-docker/v0.4/bases/mp.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -# MachinePool which references the DockerMachinePool and KubeadmConfigTemplate below -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: MachinePool -metadata: - name: "${CLUSTER_NAME}-mp-0" -spec: - clusterName: '${CLUSTER_NAME}' - replicas: ${WORKER_MACHINE_COUNT} - template: - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 - kind: KubeadmConfig - name: "${CLUSTER_NAME}-mp-0-config" - clusterName: '${CLUSTER_NAME}' - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: DockerMachinePool - name: "${CLUSTER_NAME}-dmp-0" - version: "${KUBERNETES_VERSION}" ---- -# DockerMachinePool using default values referenced by the MachinePool -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: DockerMachinePool -metadata: - name: "${CLUSTER_NAME}-dmp-0" ---- -# KubeadmConfigTemplate referenced by the MachinePool -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 -kind: KubeadmConfig -metadata: - name: "${CLUSTER_NAME}-mp-0-config" -spec: - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - # We have to pin the cgroupDriver to cgroupfs for Kubernetes < v1.24 because kind does not support systemd for those versions, but kubeadm >= 1.21 defaults to systemd. - # This cluster is used in tests where the Kubernetes version is < 1.24 - cgroup-driver: cgroupfs - eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0% - fail-swap-on: "false" diff --git a/test/e2e/data/infrastructure-docker/v0.4/cluster-template/kustomization.yaml b/test/e2e/data/infrastructure-docker/v0.4/cluster-template/kustomization.yaml index 499284979940..c7805717ecc1 100644 --- a/test/e2e/data/infrastructure-docker/v0.4/cluster-template/kustomization.yaml +++ b/test/e2e/data/infrastructure-docker/v0.4/cluster-template/kustomization.yaml @@ -1,6 +1,4 @@ bases: - ../bases/cluster-with-kcp.yaml - ../bases/md.yaml -- ../bases/crs.yaml -- ../bases/mp.yaml -- ../bases/mhc.yaml \ No newline at end of file +- ../bases/crs.yaml \ No newline at end of file diff --git a/test/e2e/data/infrastructure-docker/v1.0/bases/cluster-with-kcp.yaml b/test/e2e/data/infrastructure-docker/v1.0/bases/cluster-with-kcp.yaml index 64ec22db5f96..516a23c80406 100644 --- a/test/e2e/data/infrastructure-docker/v1.0/bases/cluster-with-kcp.yaml +++ b/test/e2e/data/infrastructure-docker/v1.0/bases/cluster-with-kcp.yaml @@ -56,6 +56,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v1.0/bases/md.yaml b/test/e2e/data/infrastructure-docker/v1.0/bases/md.yaml index 34fe77ff7b11..bb5c33a0f4ae 100644 --- a/test/e2e/data/infrastructure-docker/v1.0/bases/md.yaml +++ b/test/e2e/data/infrastructure-docker/v1.0/bases/md.yaml @@ -8,6 +8,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v1.3/bases/cluster-with-kcp.yaml b/test/e2e/data/infrastructure-docker/v1.3/bases/cluster-with-kcp.yaml index 424fec415404..d23e5343576b 100644 --- a/test/e2e/data/infrastructure-docker/v1.3/bases/cluster-with-kcp.yaml +++ b/test/e2e/data/infrastructure-docker/v1.3/bases/cluster-with-kcp.yaml @@ -56,6 +56,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.26.4@sha256:f4c0d87be03d6bea69f5e5dc0adb678bb498a190ee5c38422bf751541cebe92e" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v1.3/bases/md.yaml b/test/e2e/data/infrastructure-docker/v1.3/bases/md.yaml index ec060fba7aa6..8cd39f3ea274 100644 --- a/test/e2e/data/infrastructure-docker/v1.3/bases/md.yaml +++ b/test/e2e/data/infrastructure-docker/v1.3/bases/md.yaml @@ -8,6 +8,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.26.4@sha256:f4c0d87be03d6bea69f5e5dc0adb678bb498a190ee5c38422bf751541cebe92e" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v1.3/bases/mp.yaml b/test/e2e/data/infrastructure-docker/v1.3/bases/mp.yaml deleted file mode 100644 index 823d829b3572..000000000000 --- a/test/e2e/data/infrastructure-docker/v1.3/bases/mp.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -# MachinePool which references the DockerMachinePool and KubeadmConfigTemplate below -apiVersion: cluster.x-k8s.io/v1beta1 -kind: MachinePool -metadata: - name: "${CLUSTER_NAME}-mp-0" -spec: - clusterName: '${CLUSTER_NAME}' - replicas: ${WORKER_MACHINE_COUNT} - template: - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 - kind: KubeadmConfig - name: "${CLUSTER_NAME}-mp-0-config" - clusterName: '${CLUSTER_NAME}' - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerMachinePool - name: "${CLUSTER_NAME}-dmp-0" - version: "${KUBERNETES_VERSION}" - failureDomains: - - fd4 - - fd5 - - fd6 - - fd7 - - fd8 ---- -# DockerMachinePool using default values referenced by the MachinePool -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: DockerMachinePool -metadata: - name: "${CLUSTER_NAME}-dmp-0" -spec: - template: - # The DOCKER_PRELOAD_IMAGES variable gets set in self-hosted E2E tests to the list of images of the E2E configuration. - preLoadImages: ${DOCKER_PRELOAD_IMAGES:-[]} ---- -# KubeadmConfigTemplate referenced by the MachinePool -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 -kind: KubeadmConfig -metadata: - name: "${CLUSTER_NAME}-mp-0-config" -spec: - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0% - fail-swap-on: "false" diff --git a/test/e2e/data/infrastructure-docker/v1.3/clusterclass-quick-start.yaml b/test/e2e/data/infrastructure-docker/v1.3/clusterclass-quick-start.yaml index 1e9c747df46e..84a9847fcb80 100644 --- a/test/e2e/data/infrastructure-docker/v1.3/clusterclass-quick-start.yaml +++ b/test/e2e/data/infrastructure-docker/v1.3/clusterclass-quick-start.yaml @@ -181,33 +181,6 @@ spec: valueFrom: template: | imageTag: {{ .coreDNSImageTag }} - - name: customImage - description: "Sets the container image that is used for running dockerMachines for the controlPlane and default-worker machineDeployments." - definitions: - - selector: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerMachineTemplate - matchResources: - machineDeploymentClass: - names: - - default-worker - jsonPatches: - - op: add - path: "/spec/template/spec/customImage" - valueFrom: - template: | - kindest/node:{{ .builtin.machineDeployment.version | replace "+" "_" }} - - selector: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerMachineTemplate - matchResources: - controlPlane: true - jsonPatches: - - op: add - path: "/spec/template/spec/customImage" - valueFrom: - template: | - kindest/node:{{ .builtin.controlPlane.version | replace "+" "_" }} - name: preloadImages description: | Sets the container images to preload to the node that is used for running dockerMachines. @@ -368,6 +341,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.26.4@sha256:f4c0d87be03d6bea69f5e5dc0adb678bb498a190ee5c38422bf751541cebe92e" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" @@ -379,6 +354,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.26.4@sha256:f4c0d87be03d6bea69f5e5dc0adb678bb498a190ee5c38422bf751541cebe92e" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v1.4/bases/cluster-with-kcp.yaml b/test/e2e/data/infrastructure-docker/v1.4/bases/cluster-with-kcp.yaml index 424fec415404..fca5b54c8166 100644 --- a/test/e2e/data/infrastructure-docker/v1.4/bases/cluster-with-kcp.yaml +++ b/test/e2e/data/infrastructure-docker/v1.4/bases/cluster-with-kcp.yaml @@ -56,6 +56,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.27.1@sha256:b7d12ed662b873bd8510879c1846e87c7e676a79fefc93e17b2a52989d3ff42b" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v1.4/bases/md.yaml b/test/e2e/data/infrastructure-docker/v1.4/bases/md.yaml index ec060fba7aa6..777f8e75601d 100644 --- a/test/e2e/data/infrastructure-docker/v1.4/bases/md.yaml +++ b/test/e2e/data/infrastructure-docker/v1.4/bases/md.yaml @@ -8,6 +8,8 @@ metadata: spec: template: spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.27.1@sha256:b7d12ed662b873bd8510879c1846e87c7e676a79fefc93e17b2a52989d3ff42b" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/e2e/data/infrastructure-docker/v1.4/bases/mp.yaml b/test/e2e/data/infrastructure-docker/v1.4/bases/mp.yaml deleted file mode 100644 index 823d829b3572..000000000000 --- a/test/e2e/data/infrastructure-docker/v1.4/bases/mp.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -# MachinePool which references the DockerMachinePool and KubeadmConfigTemplate below -apiVersion: cluster.x-k8s.io/v1beta1 -kind: MachinePool -metadata: - name: "${CLUSTER_NAME}-mp-0" -spec: - clusterName: '${CLUSTER_NAME}' - replicas: ${WORKER_MACHINE_COUNT} - template: - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 - kind: KubeadmConfig - name: "${CLUSTER_NAME}-mp-0-config" - clusterName: '${CLUSTER_NAME}' - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerMachinePool - name: "${CLUSTER_NAME}-dmp-0" - version: "${KUBERNETES_VERSION}" - failureDomains: - - fd4 - - fd5 - - fd6 - - fd7 - - fd8 ---- -# DockerMachinePool using default values referenced by the MachinePool -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: DockerMachinePool -metadata: - name: "${CLUSTER_NAME}-dmp-0" -spec: - template: - # The DOCKER_PRELOAD_IMAGES variable gets set in self-hosted E2E tests to the list of images of the E2E configuration. - preLoadImages: ${DOCKER_PRELOAD_IMAGES:-[]} ---- -# KubeadmConfigTemplate referenced by the MachinePool -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 -kind: KubeadmConfig -metadata: - name: "${CLUSTER_NAME}-mp-0-config" -spec: - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0% - fail-swap-on: "false" diff --git a/test/e2e/data/infrastructure-docker/v1.4/clusterclass-quick-start.yaml b/test/e2e/data/infrastructure-docker/v1.4/clusterclass-quick-start.yaml index 02282d6cf321..5a0c22c59b32 100644 --- a/test/e2e/data/infrastructure-docker/v1.4/clusterclass-quick-start.yaml +++ b/test/e2e/data/infrastructure-docker/v1.4/clusterclass-quick-start.yaml @@ -181,33 +181,6 @@ spec: valueFrom: template: | imageTag: {{ .coreDNSImageTag }} - - name: customImage - description: "Sets the container image that is used for running dockerMachines for the controlPlane and default-worker machineDeployments." - definitions: - - selector: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerMachineTemplate - matchResources: - machineDeploymentClass: - names: - - default-worker - jsonPatches: - - op: add - path: "/spec/template/spec/customImage" - valueFrom: - template: | - kindest/node:{{ .builtin.machineDeployment.version | replace "+" "_" }} - - selector: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: DockerMachineTemplate - matchResources: - controlPlane: true - jsonPatches: - - op: add - path: "/spec/template/spec/customImage" - valueFrom: - template: | - kindest/node:{{ .builtin.controlPlane.version | replace "+" "_" }} - name: preloadImages description: | Sets the container images to preload to the node that is used for running dockerMachines. @@ -400,6 +373,8 @@ spec: annotations: InfraMachineTemplate.controlPlane.template.annotation: "InfraMachineTemplate.controlPlane.template.annotationValue" spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.27.1@sha256:b7d12ed662b873bd8510879c1846e87c7e676a79fefc93e17b2a52989d3ff42b" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" @@ -420,6 +395,8 @@ spec: annotations: InfraMachineTemplate.machineDeployment.template.annotation: "InfraMachineTemplate.machineDeployment.template.annotationValue" spec: + # NOTE: If the Kubernetes version is changed in `clusterctl_upgrade_test.go` the image and SHA must be updated here. + customImage: "kindest/node:v1.27.1@sha256:b7d12ed662b873bd8510879c1846e87c7e676a79fefc93e17b2a52989d3ff42b" extraMounts: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" diff --git a/test/infrastructure/docker/internal/docker/machine.go b/test/infrastructure/docker/internal/docker/machine.go index 33bf0bc719bf..e66e05a812fb 100644 --- a/test/infrastructure/docker/internal/docker/machine.go +++ b/test/infrastructure/docker/internal/docker/machine.go @@ -219,7 +219,7 @@ func (m *Machine) Create(ctx context.Context, image string, role string, version switch role { case constants.ControlPlaneNodeRoleValue: - log.Info("Creating control plane machine container") + log.Info(fmt.Sprintf("Creating control plane machine container with image %s", machineImage)) m.container, err = m.nodeCreator.CreateControlPlaneNode( ctx, m.ContainerName(), @@ -236,7 +236,7 @@ func (m *Machine) Create(ctx context.Context, image string, role string, version return errors.WithStack(err) } case constants.WorkerNodeRoleValue: - log.Info("Creating worker machine container") + log.Info(fmt.Sprintf("Creating worker machine container with image %s", machineImage)) m.container, err = m.nodeCreator.CreateWorkerNode( ctx, m.ContainerName(),