From 79cb2d60168013d0eb1fd326b26c5e0b8442359e Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Wed, 16 Feb 2022 11:49:16 -0700 Subject: [PATCH] Add node-role.kubernetes.io/control-plane tolerations and taints --- hack/log/log-dump-daemonset.yaml | 4 ++++ .../addons/metrics-server/metrics-server.yaml | 3 +++ .../patches/control-plane-toleration.yaml | 3 +++ ...e-prow-ci-version-windows-containerd-2022.yaml | 3 +++ .../test/ci/cluster-template-prow-ci-version.yaml | 3 +++ test/e2e/conformance_test.go | 15 +++++++++++++-- 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/hack/log/log-dump-daemonset.yaml b/hack/log/log-dump-daemonset.yaml index 118c1bb0634..23f95156bcf 100644 --- a/hack/log/log-dump-daemonset.yaml +++ b/hack/log/log-dump-daemonset.yaml @@ -29,6 +29,10 @@ spec: key: node-role.kubernetes.io/master operator: Equal value: "true" + - effect: NoSchedule + key: node-role.kubernetes.io/control-plane + operator: Equal + value: "true" - effect: NoExecute operator: Exists - effect: NoSchedule diff --git a/templates/addons/metrics-server/metrics-server.yaml b/templates/addons/metrics-server/metrics-server.yaml index b1fa7b0b250..5f99ad39b0e 100644 --- a/templates/addons/metrics-server/metrics-server.yaml +++ b/templates/addons/metrics-server/metrics-server.yaml @@ -176,6 +176,9 @@ spec: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists + - effect: NoSchedule + key: node-role.kubernetes.io/control-plane + operator: Exists volumes: - emptyDir: {} name: tmp-dir diff --git a/templates/addons/metrics-server/patches/control-plane-toleration.yaml b/templates/addons/metrics-server/patches/control-plane-toleration.yaml index ea9d59c58de..408f366eb8f 100644 --- a/templates/addons/metrics-server/patches/control-plane-toleration.yaml +++ b/templates/addons/metrics-server/patches/control-plane-toleration.yaml @@ -12,3 +12,6 @@ spec: - key: "node-role.kubernetes.io/master" operator: "Exists" effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" diff --git a/templates/test/ci/cluster-template-prow-ci-version-windows-containerd-2022.yaml b/templates/test/ci/cluster-template-prow-ci-version-windows-containerd-2022.yaml index 2e152a4ee26..b4fa1dd8506 100644 --- a/templates/test/ci/cluster-template-prow-ci-version-windows-containerd-2022.yaml +++ b/templates/test/ci/cluster-template-prow-ci-version-windows-containerd-2022.yaml @@ -4916,6 +4916,9 @@ data: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists + - effect: NoSchedule + key: node-role.kubernetes.io/control-plane + operator: Exists volumes: - emptyDir: {} name: tmp-dir diff --git a/templates/test/ci/cluster-template-prow-ci-version.yaml b/templates/test/ci/cluster-template-prow-ci-version.yaml index cf5a627f3de..0011f4d3b6e 100644 --- a/templates/test/ci/cluster-template-prow-ci-version.yaml +++ b/templates/test/ci/cluster-template-prow-ci-version.yaml @@ -4916,6 +4916,9 @@ data: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists + - effect: NoSchedule + key: node-role.kubernetes.io/control-plane + operator: Exists volumes: - emptyDir: {} name: tmp-dir diff --git a/test/e2e/conformance_test.go b/test/e2e/conformance_test.go index 5106d83443f..f17b48e3554 100644 --- a/test/e2e/conformance_test.go +++ b/test/e2e/conformance_test.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /* @@ -183,13 +184,23 @@ var _ = Describe("Conformance Tests", func() { LabelSelector: "kubernetes.io/os=linux", } - noScheduleTaint := &corev1.Taint{ + // This is kept to support versions of k8s < 1.20. + deprecatedNoScheduleTaint := &corev1.Taint{ Key: "node-role.kubernetes.io/master", Value: "", Effect: "NoSchedule", } - err := node.TaintNode(workloadProxy.GetClientSet(), options, noScheduleTaint) + noScheduleTaint := &corev1.Taint{ + Key: "node-role.kubernetes.io/control-plane", + Value: "", + Effect: "NoSchedule", + } + + err := node.TaintNode(workloadProxy.GetClientSet(), options, deprecatedNoScheduleTaint) + Expect(err).NotTo(HaveOccurred()) + + err = node.TaintNode(workloadProxy.GetClientSet(), options, noScheduleTaint) Expect(err).NotTo(HaveOccurred()) // Windows requires a repo-list because some images are not in k8s gcr