From faf1cb63e727b150c0284b2f9c88f6a272fda725 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Tue, 30 May 2023 20:06:11 +0200 Subject: [PATCH] test/e2e fix fail-swap-on=false flag not being part of kind images anymore --- .../infrastructure-docker/main/bases/md.yaml | 1 + .../infrastructure-docker/main/bases/mp.yaml | 1 + .../mp-cgroupfs.yaml | 1 + .../clusterclass-quick-start-runtimesdk.yaml | 37 ++++++++++++++++++ .../main/clusterclass-quick-start.yaml | 37 ++++++++++++++++++ .../infrastructure-docker/v1.4/bases/md.yaml | 1 + .../infrastructure-docker/v1.4/bases/mp.yaml | 1 + .../v1.4/clusterclass-quick-start.yaml | 38 +++++++++++++++++++ .../templates/clusterclass-quick-start.yaml | 38 +++++++++++++++++++ 9 files changed, 155 insertions(+) diff --git a/test/e2e/data/infrastructure-docker/main/bases/md.yaml b/test/e2e/data/infrastructure-docker/main/bases/md.yaml index eacb23f08c24..ec060fba7aa6 100644 --- a/test/e2e/data/infrastructure-docker/main/bases/md.yaml +++ b/test/e2e/data/infrastructure-docker/main/bases/md.yaml @@ -27,6 +27,7 @@ spec: criSocket: unix:///var/run/containerd/containerd.sock kubeletExtraArgs: eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' + fail-swap-on: "false" --- # MachineDeployment object apiVersion: cluster.x-k8s.io/v1beta1 diff --git a/test/e2e/data/infrastructure-docker/main/bases/mp.yaml b/test/e2e/data/infrastructure-docker/main/bases/mp.yaml index 6dc8170edd28..823d829b3572 100644 --- a/test/e2e/data/infrastructure-docker/main/bases/mp.yaml +++ b/test/e2e/data/infrastructure-docker/main/bases/mp.yaml @@ -47,3 +47,4 @@ spec: 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/main/cluster-template-upgrades-cgroupfs/mp-cgroupfs.yaml b/test/e2e/data/infrastructure-docker/main/cluster-template-upgrades-cgroupfs/mp-cgroupfs.yaml index b9a5097f135d..26b5aed019d2 100644 --- a/test/e2e/data/infrastructure-docker/main/cluster-template-upgrades-cgroupfs/mp-cgroupfs.yaml +++ b/test/e2e/data/infrastructure-docker/main/cluster-template-upgrades-cgroupfs/mp-cgroupfs.yaml @@ -11,3 +11,4 @@ spec: # kind will implement systemd support in: https://github.com/kubernetes-sigs/kind/issues/1726 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/main/clusterclass-quick-start-runtimesdk.yaml b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start-runtimesdk.yaml index 7ac8be58e2e1..ae9a704ee2d3 100644 --- a/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start-runtimesdk.yaml +++ b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start-runtimesdk.yaml @@ -49,6 +49,43 @@ spec: generateExtension: generate-patches.k8s-upgrade-with-runtimesdk validateExtension: validate-topology.k8s-upgrade-with-runtimesdk discoverVariablesExtension: discover-variables.k8s-upgrade-with-runtimesdk + - name: failSwap-controlPlane + description: | + Sets the fail-swap-on flag to false if a Kubernetes version >= v1.22 is referenced. + This is required to allow usage on swap-enabled clusters, because otherwise the + kubelet does not start. + enabledIf: '{{ semverCompare ">= v1.22" .builtin.controlPlane.version }}' + definitions: + - selector: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + matchResources: + controlPlane: true + jsonPatches: + - op: add + path: "/spec/template/spec/kubeadmConfigSpec/initConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" + - op: add + path: "/spec/template/spec/kubeadmConfigSpec/joinConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" + - name: failSwap-machineDeployment + description: | + Sets the fail-swap-on flag to false if a Kubernetes version >= v1.22 is referenced. + This is required to allow usage on swap-enabled clusters, because otherwise the + kubelet does not start. + enabledIf: '{{ semverCompare ">= v1.22" .builtin.machineDeployment.version }}' + definitions: + - selector: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + matchResources: + machineDeploymentClass: + names: + - '*-worker' + jsonPatches: + - op: add + path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: DockerClusterTemplate 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 d4504aab29ee..76f532a740e2 100644 --- a/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml +++ b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml @@ -164,6 +164,43 @@ spec: - op: add path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs/cgroup-driver" value: cgroupfs + - name: failSwap-controlPlane + description: | + Sets the fail-swap-on flag to false if a Kubernetes version >= v1.22 is referenced. + This is required to allow usage on swap-enabled clusters, because otherwise the + kubelet does not start. + enabledIf: '{{ semverCompare ">= v1.22" .builtin.controlPlane.version }}' + definitions: + - selector: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + matchResources: + controlPlane: true + jsonPatches: + - op: add + path: "/spec/template/spec/kubeadmConfigSpec/initConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" + - op: add + path: "/spec/template/spec/kubeadmConfigSpec/joinConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" + - name: failSwap-machineDeployment + description: | + Sets the fail-swap-on flag to false if a Kubernetes version >= v1.22 is referenced. + This is required to allow usage on swap-enabled clusters, because otherwise the + kubelet does not start. + enabledIf: '{{ semverCompare ">= v1.22" .builtin.machineDeployment.version }}' + definitions: + - selector: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + matchResources: + machineDeploymentClass: + names: + - '*-worker' + jsonPatches: + - op: add + path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" - name: etcdImageTag description: "Sets tag to use for the etcd image in the KubeadmControlPlane." definitions: 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 eacb23f08c24..ec060fba7aa6 100644 --- a/test/e2e/data/infrastructure-docker/v1.4/bases/md.yaml +++ b/test/e2e/data/infrastructure-docker/v1.4/bases/md.yaml @@ -27,6 +27,7 @@ spec: criSocket: unix:///var/run/containerd/containerd.sock kubeletExtraArgs: eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' + fail-swap-on: "false" --- # MachineDeployment object apiVersion: cluster.x-k8s.io/v1beta1 diff --git a/test/e2e/data/infrastructure-docker/v1.4/bases/mp.yaml b/test/e2e/data/infrastructure-docker/v1.4/bases/mp.yaml index 6dc8170edd28..823d829b3572 100644 --- a/test/e2e/data/infrastructure-docker/v1.4/bases/mp.yaml +++ b/test/e2e/data/infrastructure-docker/v1.4/bases/mp.yaml @@ -47,3 +47,4 @@ spec: 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 f3fb40a4417b..a42177200a2e 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 @@ -152,6 +152,44 @@ spec: - op: add path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs/cgroup-driver" value: cgroupfs + + - name: failSwap-controlPlane + description: | + Sets the fail-swap-on flag to false if a Kubernetes version >= v1.22 is referenced. + This is required to allow usage on swap-enabled clusters, because otherwise the + kubelet does not start. + enabledIf: '{{ semverCompare ">= v1.22" .builtin.controlPlane.version }}' + definitions: + - selector: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + matchResources: + controlPlane: true + jsonPatches: + - op: add + path: "/spec/template/spec/kubeadmConfigSpec/initConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" + - op: add + path: "/spec/template/spec/kubeadmConfigSpec/joinConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" + - name: failSwap-machineDeployment + description: | + Sets the fail-swap-on flag to false if a Kubernetes version >= v1.22 is referenced. + This is required to allow usage on swap-enabled clusters, because otherwise the + kubelet does not start. + enabledIf: '{{ semverCompare ">= v1.22" .builtin.machineDeployment.version }}' + definitions: + - selector: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + matchResources: + machineDeploymentClass: + names: + - '*-worker' + jsonPatches: + - op: add + path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" - name: etcdImageTag description: "Sets tag to use for the etcd image in the KubeadmControlPlane." definitions: diff --git a/test/infrastructure/docker/templates/clusterclass-quick-start.yaml b/test/infrastructure/docker/templates/clusterclass-quick-start.yaml index ab54f7f737e4..b4d2d7c2997b 100644 --- a/test/infrastructure/docker/templates/clusterclass-quick-start.yaml +++ b/test/infrastructure/docker/templates/clusterclass-quick-start.yaml @@ -132,6 +132,44 @@ spec: - op: add path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs/cgroup-driver" value: cgroupfs + + - name: failSwap-controlPlane + description: | + Sets the fail-swap-on flag to false if a Kubernetes version >= v1.22 is referenced. + This is required to allow usage on swap-enabled clusters, because otherwise the + kubelet does not start. + enabledIf: '{{ semverCompare ">= v1.22" .builtin.controlPlane.version }}' + definitions: + - selector: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + matchResources: + controlPlane: true + jsonPatches: + - op: add + path: "/spec/template/spec/kubeadmConfigSpec/initConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" + - op: add + path: "/spec/template/spec/kubeadmConfigSpec/joinConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" + - name: failSwap-machineDeployment + description: | + Sets the fail-swap-on flag to false if a Kubernetes version >= v1.22 is referenced. + This is required to allow usage on swap-enabled clusters, because otherwise the + kubelet does not start. + enabledIf: '{{ semverCompare ">= v1.22" .builtin.machineDeployment.version }}' + definitions: + - selector: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + matchResources: + machineDeploymentClass: + names: + - '*-worker' + jsonPatches: + - op: add + path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs/fail-swap-on" + value: "false" - name: etcdImageTag description: "Sets tag to use for the etcd image in the KubeadmControlPlane." definitions: