From 2d10392fe2e275120ddc2deaf7806a0f62db4e1b Mon Sep 17 00:00:00 2001 From: John Schnake Date: Fri, 13 Sep 2019 14:56:10 -0500 Subject: [PATCH] Add a disruptive taint to list of default tolerations A new conformance test in v1.16 will add a taint to a node which can impact the sonobuoy aggregator pod as well as the e2e pod. This change adds the toleration to both the default job podspec and the aggregator. The default daemonset podspec already tolerates all taints. Fixes #876 Signed-off-by: John Schnake --- cmd/sonobuoy/app/testdata/pluginDef-default-podspec.golden | 2 ++ pkg/client/testdata/default-plugins-via-nil-selection.golden | 3 +++ pkg/client/testdata/default-pod-spec.golden | 5 +++++ pkg/client/testdata/default.golden | 3 +++ pkg/client/testdata/e2e-default.golden | 3 +++ pkg/client/testdata/envoverrides.golden | 3 +++ pkg/client/testdata/imagePullSecrets.golden | 3 +++ pkg/client/testdata/manual-custom-plugin-plus-e2e.golden | 3 +++ pkg/client/testdata/manual-custom-plugin-plus-systemd.golden | 3 +++ pkg/client/testdata/manual-custom-plugin.golden | 3 +++ pkg/client/testdata/manual-e2e.golden | 3 +++ pkg/client/testdata/no-plugins-via-selection.golden | 3 +++ pkg/client/testdata/plugins-and-pluginSelection.golden | 3 +++ pkg/client/testdata/ssh.golden | 3 +++ pkg/client/testdata/systemd-logs-default.golden | 3 +++ pkg/client/testdata/use-existing-pod-spec.golden | 3 +++ pkg/plugin/driver/base.go | 4 ++++ pkg/plugin/driver/job/job_test.go | 2 +- pkg/templates/manifest.go | 3 +++ 19 files changed, 57 insertions(+), 1 deletion(-) diff --git a/cmd/sonobuoy/app/testdata/pluginDef-default-podspec.golden b/cmd/sonobuoy/app/testdata/pluginDef-default-podspec.golden index 703cc5ce8..6b103f13f 100644 --- a/cmd/sonobuoy/app/testdata/pluginDef-default-podspec.golden +++ b/cmd/sonobuoy/app/testdata/pluginDef-default-podspec.golden @@ -8,6 +8,8 @@ podSpec: operator: Exists - key: CriticalAddonsOnly operator: Exists + - key: kubernetes.io/e2e-evict-taint-key + operator: Exists sonobuoy-config: driver: "" plugin-name: "n" diff --git a/pkg/client/testdata/default-plugins-via-nil-selection.golden b/pkg/client/testdata/default-plugins-via-nil-selection.golden index d514be7cc..d5fe25e94 100644 --- a/pkg/client/testdata/default-plugins-via-nil-selection.golden +++ b/pkg/client/testdata/default-plugins-via-nil-selection.golden @@ -111,6 +111,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/default-pod-spec.golden b/pkg/client/testdata/default-pod-spec.golden index 5a5c99850..596a1ea49 100644 --- a/pkg/client/testdata/default-pod-spec.golden +++ b/pkg/client/testdata/default-pod-spec.golden @@ -37,6 +37,8 @@ data: operator: Exists - key: CriticalAddonsOnly operator: Exists + - key: kubernetes.io/e2e-evict-taint-key + operator: Exists sonobuoy-config: driver: Job plugin-name: e2e @@ -134,6 +136,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/default.golden b/pkg/client/testdata/default.golden index d514be7cc..d5fe25e94 100644 --- a/pkg/client/testdata/default.golden +++ b/pkg/client/testdata/default.golden @@ -111,6 +111,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/e2e-default.golden b/pkg/client/testdata/e2e-default.golden index 8ebcc47d2..15ca7267d 100644 --- a/pkg/client/testdata/e2e-default.golden +++ b/pkg/client/testdata/e2e-default.golden @@ -82,6 +82,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/envoverrides.golden b/pkg/client/testdata/envoverrides.golden index 9761a4889..5ede69759 100644 --- a/pkg/client/testdata/envoverrides.golden +++ b/pkg/client/testdata/envoverrides.golden @@ -85,6 +85,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/imagePullSecrets.golden b/pkg/client/testdata/imagePullSecrets.golden index 071c0f544..bf2106f47 100644 --- a/pkg/client/testdata/imagePullSecrets.golden +++ b/pkg/client/testdata/imagePullSecrets.golden @@ -84,6 +84,9 @@ spec: - name: foo restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden b/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden index 5995bfc54..7e1b7731a 100644 --- a/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden +++ b/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden @@ -89,6 +89,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden b/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden index da4a8253e..c46b9fd15 100644 --- a/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden +++ b/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden @@ -101,6 +101,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/manual-custom-plugin.golden b/pkg/client/testdata/manual-custom-plugin.golden index 2306b15c7..52661b1b1 100644 --- a/pkg/client/testdata/manual-custom-plugin.golden +++ b/pkg/client/testdata/manual-custom-plugin.golden @@ -72,6 +72,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/manual-e2e.golden b/pkg/client/testdata/manual-e2e.golden index aa51fde88..a5b42d388 100644 --- a/pkg/client/testdata/manual-e2e.golden +++ b/pkg/client/testdata/manual-e2e.golden @@ -82,6 +82,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/no-plugins-via-selection.golden b/pkg/client/testdata/no-plugins-via-selection.golden index c92c77eb6..d4859e861 100644 --- a/pkg/client/testdata/no-plugins-via-selection.golden +++ b/pkg/client/testdata/no-plugins-via-selection.golden @@ -64,6 +64,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/plugins-and-pluginSelection.golden b/pkg/client/testdata/plugins-and-pluginSelection.golden index 5a3a4014b..2207ce38e 100644 --- a/pkg/client/testdata/plugins-and-pluginSelection.golden +++ b/pkg/client/testdata/plugins-and-pluginSelection.golden @@ -79,6 +79,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/ssh.golden b/pkg/client/testdata/ssh.golden index 017eb1105..a1f4cb2fb 100644 --- a/pkg/client/testdata/ssh.golden +++ b/pkg/client/testdata/ssh.golden @@ -106,6 +106,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/systemd-logs-default.golden b/pkg/client/testdata/systemd-logs-default.golden index cf0aefa8d..0265bbf9b 100644 --- a/pkg/client/testdata/systemd-logs-default.golden +++ b/pkg/client/testdata/systemd-logs-default.golden @@ -94,6 +94,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/client/testdata/use-existing-pod-spec.golden b/pkg/client/testdata/use-existing-pod-spec.golden index fcf3fd243..26aee7d41 100644 --- a/pkg/client/testdata/use-existing-pod-spec.golden +++ b/pkg/client/testdata/use-existing-pod-spec.golden @@ -74,6 +74,9 @@ spec: name: output-volume restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm diff --git a/pkg/plugin/driver/base.go b/pkg/plugin/driver/base.go index fb4cefb07..98a5f42f1 100644 --- a/pkg/plugin/driver/base.go +++ b/pkg/plugin/driver/base.go @@ -258,6 +258,10 @@ func defaultJobPodSpec() v1.PodSpec { Key: "CriticalAddonsOnly", Operator: v1.TolerationOpExists, }, + { + Key: "kubernetes.io/e2e-evict-taint-key", + Operator: v1.TolerationOpExists, + }, }, Volumes: []v1.Volume{}, } diff --git a/pkg/plugin/driver/job/job_test.go b/pkg/plugin/driver/job/job_test.go index 92675c000..f912fa150 100644 --- a/pkg/plugin/driver/job/job_test.go +++ b/pkg/plugin/driver/job/job_test.go @@ -207,7 +207,7 @@ func TestCreatePodDefinitionUsesDefaultPodSpec(t *testing.T) { } // Check something specific to the job default pod spec - expectedNumTolerations := 2 + expectedNumTolerations := 3 actualNumTolerations := len(pod.Spec.Tolerations) if actualNumTolerations != expectedNumTolerations { t.Errorf("expected pod spec to %v tolerations, got %v", expectedNumTolerations, actualNumTolerations) diff --git a/pkg/templates/manifest.go b/pkg/templates/manifest.go index 65e22d4e5..b282b4103 100644 --- a/pkg/templates/manifest.go +++ b/pkg/templates/manifest.go @@ -146,6 +146,9 @@ spec: {{- end }} restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: "kubernetes.io/e2e-evict-taint-key" + operator: "Exists" volumes: - configMap: name: sonobuoy-config-cm