From dddf8fa1d3c7bfff78add6a772ace753644de6a6 Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Mon, 3 Oct 2022 16:10:59 +0000 Subject: [PATCH 01/10] backport of commit 7c33284165ba1613d74e189594c35c07300f4ac3 --- charts/consul/values.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index 1489faac75..2378e9aa9a 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -515,6 +515,25 @@ global: # @type: string secretKey: null + # job configures settings for the server-acl-init and server-acl-cleanup jobs + job: + # tolerations configures the taints and tolerations for the server-acl-init + # and server-acl-cleanup jobs. This should be a multi-line string matching the + # Tolerations (https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) array in a Pod spec. + tolerations: "" + + # This value defines `nodeSelector` (https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) + # labels for the server-acl-init and server-acl-cleanup jobs pod assignment, formatted as a multi-line string. + # + # Example: + # + # ```yaml + # nodeSelector: | + # beta.kubernetes.io/arch: amd64 + # ``` + # + # @type: string + nodeSelector: null # [Enterprise Only] This value refers to a Kubernetes or Vault secret that you have created # that contains your enterprise license. It is required if you are using an From d861b36ce744efe90e37120991acf9af41d81c4f Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Mon, 3 Oct 2022 16:11:13 +0000 Subject: [PATCH 02/10] backport of commit c42526aa40016f6cf46cd7407645e7c6ee7c8972 --- charts/consul/values.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index 2378e9aa9a..fc20ddd27b 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -3084,6 +3084,19 @@ webhookCertManager: # @type: string tolerations: null + # This value defines `nodeSelector` (https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) + # labels for webhook cert manager pod assignment, formatted as a multi-line string. + # + # Example: + # + # ```yaml + # nodeSelector: | + # beta.kubernetes.io/arch: amd64 + # ``` + # + # @type: string + nodeSelector: null + # Configures a demo Prometheus installation. prometheus: # When true, the Helm chart will install a demo Prometheus server instance From 8ccb2c379cc83c2d733c703d980a51acc439204b Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Mon, 3 Oct 2022 16:40:28 +0000 Subject: [PATCH 03/10] backport of commit 00d934975f53d6608630773e77a5055d152d43ca --- .../webhook-cert-manager-deployment.yaml | 6 ++++- .../unit/webhook-cert-manager-deployment.bats | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/charts/consul/templates/webhook-cert-manager-deployment.yaml b/charts/consul/templates/webhook-cert-manager-deployment.yaml index 609f3314b3..eef13e78b6 100644 --- a/charts/consul/templates/webhook-cert-manager-deployment.yaml +++ b/charts/consul/templates/webhook-cert-manager-deployment.yaml @@ -64,6 +64,10 @@ spec: {{- if .Values.webhookCertManager.tolerations }} tolerations: {{ tpl .Values.webhookCertManager.tolerations . | indent 8 | trim }} - {{- end}} + {{- end }} + {{- if .Values.webhookCertManager.nodeSelector }} + nodeSelector: + {{ tpl .Values.webhookCertManager.nodeSelector . | indent 8 | trim }} + {{- end }} {{- end }} diff --git a/charts/consul/test/unit/webhook-cert-manager-deployment.bats b/charts/consul/test/unit/webhook-cert-manager-deployment.bats index 78b6e52997..71d2e35c3a 100644 --- a/charts/consul/test/unit/webhook-cert-manager-deployment.bats +++ b/charts/consul/test/unit/webhook-cert-manager-deployment.bats @@ -63,6 +63,29 @@ load _helpers [ "${actual}" = "value" ] } +@test "webhookCertManager/Deployment: no nodeSelector by default" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/webhook-cert-manager-deployment.yaml \ + --set 'controller.enabled=true' \ + --set 'connectInject.enabled=true' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.nodeSelector' | tee /dev/stderr) + [ "${actual}" = "null" ] +} + +@test "webhookCertManager/Deployment: nodeSelector can be set" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/webhook-cert-manager-deployment.yaml \ + --set 'controller.enabled=true' \ + --set 'connectInject.enabled=true' \ + --set 'webhookCertManager.nodeSelector=- key: value' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.nodeSelector[0].key' | tee /dev/stderr) + [ "${actual}" = "value" ] +} + #-------------------------------------------------------------------- # Vault From 59684cde0d68253168ebb57ea12ee183d7ec8890 Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Mon, 3 Oct 2022 17:14:42 +0000 Subject: [PATCH 04/10] backport of commit b609ab509b1fc098f8f2c8b631bc146cf88575c7 --- .../consul/templates/server-acl-init-job.yaml | 8 ++++ .../consul/test/unit/server-acl-init-job.bats | 45 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index 8709b82af7..0307546c37 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -328,6 +328,14 @@ spec: limits: memory: "50Mi" cpu: "50m" + {{- if .Values.global.acls.job.tolerations }} + tolerations: + {{ tpl .Values.global.acls.job.tolerations . | indent 12 | trim }} + {{- end }} + {{- if .Values.global.acls.job.nodeSelector }} + nodeSelector: + {{ tpl .Values.global.acls.job.nodeSelector . | indent 12 | trim }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/consul/test/unit/server-acl-init-job.bats b/charts/consul/test/unit/server-acl-init-job.bats index 7b442a2ef8..9fdb96a31d 100644 --- a/charts/consul/test/unit/server-acl-init-job.bats +++ b/charts/consul/test/unit/server-acl-init-job.bats @@ -1551,6 +1551,51 @@ load _helpers [ "${actual}" = "true" ] } +#-------------------------------------------------------------------- +# global.acls.job + +@test "serverACLInit/Job: tolerations not set by default" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/server-acl-init-job.yaml \ + --set 'global.acls.manageSystemACLs=true' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.containers[0].tolerations' | tee /dev/stderr) + [ "${actual}" = "null" ] +} + +@test "serverACLInit/Job: tolerations can be set" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/server-acl-init-job.yaml \ + --set 'global.acls.manageSystemACLs=true' \ + --set 'global.acls.job.tolerations=- key: value' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.containers[0].tolerations[0].key' | tee /dev/stderr) + [ "${actual}" = "value" ] +} + +@test "serverACLInit/Job: nodeSelector not set by default" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/server-acl-init-job.yaml \ + --set 'global.acls.manageSystemACLs=true' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.containers[0].nodeSelector' | tee /dev/stderr) + [ "${actual}" = "null" ] +} + +@test "serverACLInit/Job: nodeSelector can be set" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/server-acl-init-job.yaml \ + --set 'global.acls.manageSystemACLs=true' \ + --set 'global.acls.job.nodeSelector=- key: value' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.containers[0].nodeSelector[0].key' | tee /dev/stderr) + [ "${actual}" = "value" ] +} + #-------------------------------------------------------------------- # externalServers.enabled From 6eb307a5245634ea224cf7c363e01e43877a1b25 Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Mon, 3 Oct 2022 17:16:49 +0000 Subject: [PATCH 05/10] backport of commit 928772d8083e0abd868642b59bcf6015647cb355 --- .../server-acl-init-cleanup-job.yaml | 8 ++++ .../unit/server-acl-init-cleanup-job.bats | 45 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index 4db5e356e3..f2342cf661 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -62,6 +62,14 @@ spec: limits: memory: "50Mi" cpu: "50m" + {{- if .Values.global.acls.job.tolerations }} + tolerations: + {{ tpl .Values.global.acls.job.tolerations . | indent 12 | trim }} + {{- end }} + {{- if .Values.global.acls.job.nodeSelector }} + nodeSelector: + {{ tpl .Values.global.acls.job.nodeSelector . | indent 12 | trim }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/consul/test/unit/server-acl-init-cleanup-job.bats b/charts/consul/test/unit/server-acl-init-cleanup-job.bats index 3cc17b2682..3fee687e42 100644 --- a/charts/consul/test/unit/server-acl-init-cleanup-job.bats +++ b/charts/consul/test/unit/server-acl-init-cleanup-job.bats @@ -70,3 +70,48 @@ load _helpers yq 'length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] } + +#-------------------------------------------------------------------- +# global.acls.job + +@test "serverACLInitCleanup/Job: tolerations not set by default" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/server-acl-init-job.yaml \ + --set 'global.acls.manageSystemACLs=true' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.containers[0].tolerations' | tee /dev/stderr) + [ "${actual}" = "null" ] +} + +@test "serverACLInitCleanup/Job: tolerations can be set" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/server-acl-init-job.yaml \ + --set 'global.acls.manageSystemACLs=true' \ + --set 'global.acls.job.tolerations=- key: value' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.containers[0].tolerations[0].key' | tee /dev/stderr) + [ "${actual}" = "value" ] +} + +@test "serverACLInit/Job: nodeSelector not set by default" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/server-acl-init-job.yaml \ + --set 'global.acls.manageSystemACLs=true' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.containers[0].nodeSelector' | tee /dev/stderr) + [ "${actual}" = "null" ] +} + +@test "serverACLInit/Job: nodeSelector can be set" { + cd `chart_dir` + local actual=$(helm template \ + -s templates/server-acl-init-job.yaml \ + --set 'global.acls.manageSystemACLs=true' \ + --set 'global.acls.job.nodeSelector=- key: value' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.containers[0].nodeSelector[0].key' | tee /dev/stderr) + [ "${actual}" = "value" ] +} From 271249f9eee038927cc0c80e133b992b9e6ab88b Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Mon, 3 Oct 2022 21:16:01 +0000 Subject: [PATCH 06/10] backport of commit 4f9b49c73ba309f27c1c2a6d156f6d761cbe0fe1 --- .../templates/server-acl-init-cleanup-job.yaml | 16 ++++++++-------- charts/consul/templates/server-acl-init-job.yaml | 16 ++++++++-------- .../test/unit/server-acl-init-cleanup-job.bats | 8 ++++---- charts/consul/test/unit/server-acl-init-job.bats | 8 ++++---- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index f2342cf661..300818988c 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -62,14 +62,14 @@ spec: limits: memory: "50Mi" cpu: "50m" - {{- if .Values.global.acls.job.tolerations }} - tolerations: - {{ tpl .Values.global.acls.job.tolerations . | indent 12 | trim }} - {{- end }} - {{- if .Values.global.acls.job.nodeSelector }} - nodeSelector: - {{ tpl .Values.global.acls.job.nodeSelector . | indent 12 | trim }} - {{- end }} + {{- if .Values.global.acls.job.tolerations }} + tolerations: + {{ tpl .Values.global.acls.job.tolerations . | indent 12 | trim }} + {{- end }} + {{- if .Values.global.acls.job.nodeSelector }} + nodeSelector: + {{ tpl .Values.global.acls.job.nodeSelector . | indent 12 | trim }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index 0307546c37..a4144ef244 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -328,14 +328,14 @@ spec: limits: memory: "50Mi" cpu: "50m" - {{- if .Values.global.acls.job.tolerations }} - tolerations: - {{ tpl .Values.global.acls.job.tolerations . | indent 12 | trim }} - {{- end }} - {{- if .Values.global.acls.job.nodeSelector }} - nodeSelector: - {{ tpl .Values.global.acls.job.nodeSelector . | indent 12 | trim }} - {{- end }} + {{- if .Values.global.acls.job.tolerations }} + tolerations: + {{ tpl .Values.global.acls.job.tolerations . | indent 12 | trim }} + {{- end }} + {{- if .Values.global.acls.job.nodeSelector }} + nodeSelector: + {{ tpl .Values.global.acls.job.nodeSelector . | indent 12 | trim }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/consul/test/unit/server-acl-init-cleanup-job.bats b/charts/consul/test/unit/server-acl-init-cleanup-job.bats index 3fee687e42..0fe599b2e2 100644 --- a/charts/consul/test/unit/server-acl-init-cleanup-job.bats +++ b/charts/consul/test/unit/server-acl-init-cleanup-job.bats @@ -80,7 +80,7 @@ load _helpers -s templates/server-acl-init-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | - yq -r '.spec.template.spec.containers[0].tolerations' | tee /dev/stderr) + yq -r '.spec.template.spec.tolerations' | tee /dev/stderr) [ "${actual}" = "null" ] } @@ -91,7 +91,7 @@ load _helpers --set 'global.acls.manageSystemACLs=true' \ --set 'global.acls.job.tolerations=- key: value' \ . | tee /dev/stderr | - yq -r '.spec.template.spec.containers[0].tolerations[0].key' | tee /dev/stderr) + yq -r '.spec.template.spec.tolerations[0].key' | tee /dev/stderr) [ "${actual}" = "value" ] } @@ -101,7 +101,7 @@ load _helpers -s templates/server-acl-init-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | - yq -r '.spec.template.spec.containers[0].nodeSelector' | tee /dev/stderr) + yq -r '.spec.template.spec.nodeSelector' | tee /dev/stderr) [ "${actual}" = "null" ] } @@ -112,6 +112,6 @@ load _helpers --set 'global.acls.manageSystemACLs=true' \ --set 'global.acls.job.nodeSelector=- key: value' \ . | tee /dev/stderr | - yq -r '.spec.template.spec.containers[0].nodeSelector[0].key' | tee /dev/stderr) + yq -r '.spec.template.spec.nodeSelector[0].key' | tee /dev/stderr) [ "${actual}" = "value" ] } diff --git a/charts/consul/test/unit/server-acl-init-job.bats b/charts/consul/test/unit/server-acl-init-job.bats index 9fdb96a31d..76a4324927 100644 --- a/charts/consul/test/unit/server-acl-init-job.bats +++ b/charts/consul/test/unit/server-acl-init-job.bats @@ -1560,7 +1560,7 @@ load _helpers -s templates/server-acl-init-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | - yq -r '.spec.template.spec.containers[0].tolerations' | tee /dev/stderr) + yq -r '.spec.template.spec.tolerations' | tee /dev/stderr) [ "${actual}" = "null" ] } @@ -1571,7 +1571,7 @@ load _helpers --set 'global.acls.manageSystemACLs=true' \ --set 'global.acls.job.tolerations=- key: value' \ . | tee /dev/stderr | - yq -r '.spec.template.spec.containers[0].tolerations[0].key' | tee /dev/stderr) + yq -r '.spec.template.spec.tolerations[0].key' | tee /dev/stderr) [ "${actual}" = "value" ] } @@ -1581,7 +1581,7 @@ load _helpers -s templates/server-acl-init-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | - yq -r '.spec.template.spec.containers[0].nodeSelector' | tee /dev/stderr) + yq -r '.spec.template.spec.nodeSelector' | tee /dev/stderr) [ "${actual}" = "null" ] } @@ -1592,7 +1592,7 @@ load _helpers --set 'global.acls.manageSystemACLs=true' \ --set 'global.acls.job.nodeSelector=- key: value' \ . | tee /dev/stderr | - yq -r '.spec.template.spec.containers[0].nodeSelector[0].key' | tee /dev/stderr) + yq -r '.spec.template.spec.nodeSelector[0].key' | tee /dev/stderr) [ "${actual}" = "value" ] } From 5911a6f19bced014f55be6c064c0d2965bb9ed87 Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Fri, 14 Oct 2022 19:09:18 +0000 Subject: [PATCH 07/10] backport of commit e5a5a6f53f6a625027e1b6b37bad4b28bfda2b22 --- .../server-acl-init-cleanup-job.yaml | 8 ++--- .../consul/templates/server-acl-init-job.yaml | 8 ++--- .../unit/server-acl-init-cleanup-job.bats | 6 ++-- .../consul/test/unit/server-acl-init-job.bats | 6 ++-- charts/consul/values.yaml | 36 +++++++++---------- 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index 300818988c..eb38eab090 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -62,13 +62,13 @@ spec: limits: memory: "50Mi" cpu: "50m" - {{- if .Values.global.acls.job.tolerations }} + {{- if .Values.global.acls.tolerations }} tolerations: - {{ tpl .Values.global.acls.job.tolerations . | indent 12 | trim }} + {{ tpl .Values.global.acls.tolerations . | indent 12 | trim }} {{- end }} - {{- if .Values.global.acls.job.nodeSelector }} + {{- if .Values.global.acls.nodeSelector }} nodeSelector: - {{ tpl .Values.global.acls.job.nodeSelector . | indent 12 | trim }} + {{ tpl .Values.global.acls.nodeSelector . | indent 12 | trim }} {{- end }} {{- end }} {{- end }} diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index a4144ef244..2ea4b3bcb7 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -328,13 +328,13 @@ spec: limits: memory: "50Mi" cpu: "50m" - {{- if .Values.global.acls.job.tolerations }} + {{- if .Values.global.acls.tolerations }} tolerations: - {{ tpl .Values.global.acls.job.tolerations . | indent 12 | trim }} + {{ tpl .Values.global.acls.tolerations . | indent 12 | trim }} {{- end }} - {{- if .Values.global.acls.job.nodeSelector }} + {{- if .Values.global.acls.nodeSelector }} nodeSelector: - {{ tpl .Values.global.acls.job.nodeSelector . | indent 12 | trim }} + {{ tpl .Values.global.acls.nodeSelector . | indent 12 | trim }} {{- end }} {{- end }} {{- end }} diff --git a/charts/consul/test/unit/server-acl-init-cleanup-job.bats b/charts/consul/test/unit/server-acl-init-cleanup-job.bats index 0fe599b2e2..3005b2856a 100644 --- a/charts/consul/test/unit/server-acl-init-cleanup-job.bats +++ b/charts/consul/test/unit/server-acl-init-cleanup-job.bats @@ -72,7 +72,7 @@ load _helpers } #-------------------------------------------------------------------- -# global.acls.job +# global.acls.tolerations and global.acls.nodeSelector @test "serverACLInitCleanup/Job: tolerations not set by default" { cd `chart_dir` @@ -89,7 +89,7 @@ load _helpers local actual=$(helm template \ -s templates/server-acl-init-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ - --set 'global.acls.job.tolerations=- key: value' \ + --set 'global.acls.tolerations=- key: value' \ . | tee /dev/stderr | yq -r '.spec.template.spec.tolerations[0].key' | tee /dev/stderr) [ "${actual}" = "value" ] @@ -110,7 +110,7 @@ load _helpers local actual=$(helm template \ -s templates/server-acl-init-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ - --set 'global.acls.job.nodeSelector=- key: value' \ + --set 'global.acls.nodeSelector=- key: value' \ . | tee /dev/stderr | yq -r '.spec.template.spec.nodeSelector[0].key' | tee /dev/stderr) [ "${actual}" = "value" ] diff --git a/charts/consul/test/unit/server-acl-init-job.bats b/charts/consul/test/unit/server-acl-init-job.bats index 76a4324927..cc9bfb5f77 100644 --- a/charts/consul/test/unit/server-acl-init-job.bats +++ b/charts/consul/test/unit/server-acl-init-job.bats @@ -1552,7 +1552,7 @@ load _helpers } #-------------------------------------------------------------------- -# global.acls.job +# global.acls.tolerations and global.acls.nodeSelector @test "serverACLInit/Job: tolerations not set by default" { cd `chart_dir` @@ -1569,7 +1569,7 @@ load _helpers local actual=$(helm template \ -s templates/server-acl-init-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ - --set 'global.acls.job.tolerations=- key: value' \ + --set 'global.acls.tolerations=- key: value' \ . | tee /dev/stderr | yq -r '.spec.template.spec.tolerations[0].key' | tee /dev/stderr) [ "${actual}" = "value" ] @@ -1590,7 +1590,7 @@ load _helpers local actual=$(helm template \ -s templates/server-acl-init-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ - --set 'global.acls.job.nodeSelector=- key: value' \ + --set 'global.acls.nodeSelector=- key: value' \ . | tee /dev/stderr | yq -r '.spec.template.spec.nodeSelector[0].key' | tee /dev/stderr) [ "${actual}" = "value" ] diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index fc20ddd27b..714ececeb4 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -515,25 +515,23 @@ global: # @type: string secretKey: null - # job configures settings for the server-acl-init and server-acl-cleanup jobs - job: - # tolerations configures the taints and tolerations for the server-acl-init - # and server-acl-cleanup jobs. This should be a multi-line string matching the - # Tolerations (https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) array in a Pod spec. - tolerations: "" - - # This value defines `nodeSelector` (https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) - # labels for the server-acl-init and server-acl-cleanup jobs pod assignment, formatted as a multi-line string. - # - # Example: - # - # ```yaml - # nodeSelector: | - # beta.kubernetes.io/arch: amd64 - # ``` - # - # @type: string - nodeSelector: null + # tolerations configures the taints and tolerations for the server-acl-init + # and server-acl-cleanup jobs. This should be a multi-line string matching the + # Tolerations (https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) array in a Pod spec. + tolerations: "" + + # This value defines `nodeSelector` (https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) + # labels for the server-acl-init and server-acl-cleanup jobs pod assignment, formatted as a multi-line string. + # + # Example: + # + # ```yaml + # nodeSelector: | + # beta.kubernetes.io/arch: amd64 + # ``` + # + # @type: string + nodeSelector: null # [Enterprise Only] This value refers to a Kubernetes or Vault secret that you have created # that contains your enterprise license. It is required if you are using an From 5cb0b6692bf43cc8662d23fc82d38199048d52b5 Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Fri, 14 Oct 2022 22:32:13 +0000 Subject: [PATCH 08/10] backport of commit 19012ef954126b0fea69aad6b432959ed9679c83 --- charts/consul/test/unit/server-acl-init-cleanup-job.bats | 4 ++-- charts/consul/values.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/consul/test/unit/server-acl-init-cleanup-job.bats b/charts/consul/test/unit/server-acl-init-cleanup-job.bats index 3005b2856a..1c285c8f4d 100644 --- a/charts/consul/test/unit/server-acl-init-cleanup-job.bats +++ b/charts/consul/test/unit/server-acl-init-cleanup-job.bats @@ -95,7 +95,7 @@ load _helpers [ "${actual}" = "value" ] } -@test "serverACLInit/Job: nodeSelector not set by default" { +@test "serverACLInitCleanup/Job: nodeSelector not set by default" { cd `chart_dir` local actual=$(helm template \ -s templates/server-acl-init-job.yaml \ @@ -105,7 +105,7 @@ load _helpers [ "${actual}" = "null" ] } -@test "serverACLInit/Job: nodeSelector can be set" { +@test "serverACLInitCleanup/Job: nodeSelector can be set" { cd `chart_dir` local actual=$(helm template \ -s templates/server-acl-init-job.yaml \ diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index 714ececeb4..52ba1e25cd 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -516,12 +516,12 @@ global: secretKey: null # tolerations configures the taints and tolerations for the server-acl-init - # and server-acl-cleanup jobs. This should be a multi-line string matching the + # and server-acl-init-cleanup jobs. This should be a multi-line string matching the # Tolerations (https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) array in a Pod spec. tolerations: "" # This value defines `nodeSelector` (https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) - # labels for the server-acl-init and server-acl-cleanup jobs pod assignment, formatted as a multi-line string. + # labels for the server-acl-init and server-acl-init-cleanup jobs pod assignment, formatted as a multi-line string. # # Example: # @@ -3083,7 +3083,7 @@ webhookCertManager: tolerations: null # This value defines `nodeSelector` (https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) - # labels for webhook cert manager pod assignment, formatted as a multi-line string. + # labels for the webhook-cert-manager pod assignment, formatted as a multi-line string. # # Example: # From 80677f12445efe3a36ae60740926019c2e1c3205 Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Fri, 14 Oct 2022 22:34:20 +0000 Subject: [PATCH 09/10] backport of commit 24e616ce32b8f1f33a3c72c39fb29fbb2c621c79 --- charts/consul/templates/server-acl-init-job.yaml | 4 ++-- charts/consul/test/unit/server-acl-init-cleanup-job.bats | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index 2ea4b3bcb7..b2f770db7a 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -330,11 +330,11 @@ spec: cpu: "50m" {{- if .Values.global.acls.tolerations }} tolerations: - {{ tpl .Values.global.acls.tolerations . | indent 12 | trim }} + {{ tpl .Values.global.acls.tolerations . | indent 8 | trim }} {{- end }} {{- if .Values.global.acls.nodeSelector }} nodeSelector: - {{ tpl .Values.global.acls.nodeSelector . | indent 12 | trim }} + {{ tpl .Values.global.acls.nodeSelector . | indent 8 | trim }} {{- end }} {{- end }} {{- end }} diff --git a/charts/consul/test/unit/server-acl-init-cleanup-job.bats b/charts/consul/test/unit/server-acl-init-cleanup-job.bats index 1c285c8f4d..cb57374116 100644 --- a/charts/consul/test/unit/server-acl-init-cleanup-job.bats +++ b/charts/consul/test/unit/server-acl-init-cleanup-job.bats @@ -77,7 +77,7 @@ load _helpers @test "serverACLInitCleanup/Job: tolerations not set by default" { cd `chart_dir` local actual=$(helm template \ - -s templates/server-acl-init-job.yaml \ + -s templates/server-acl-init-cleanup-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | yq -r '.spec.template.spec.tolerations' | tee /dev/stderr) @@ -87,7 +87,7 @@ load _helpers @test "serverACLInitCleanup/Job: tolerations can be set" { cd `chart_dir` local actual=$(helm template \ - -s templates/server-acl-init-job.yaml \ + -s templates/server-acl-init-cleanup-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ --set 'global.acls.tolerations=- key: value' \ . | tee /dev/stderr | @@ -98,7 +98,7 @@ load _helpers @test "serverACLInitCleanup/Job: nodeSelector not set by default" { cd `chart_dir` local actual=$(helm template \ - -s templates/server-acl-init-job.yaml \ + -s templates/server-acl-init-cleanup-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | yq -r '.spec.template.spec.nodeSelector' | tee /dev/stderr) @@ -108,7 +108,7 @@ load _helpers @test "serverACLInitCleanup/Job: nodeSelector can be set" { cd `chart_dir` local actual=$(helm template \ - -s templates/server-acl-init-job.yaml \ + -s templates/server-acl-init-cleanup-job.yaml \ --set 'global.acls.manageSystemACLs=true' \ --set 'global.acls.nodeSelector=- key: value' \ . | tee /dev/stderr | From 8e2b080c829f5fdac808923d8d825dfa8fd33bba Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Sat, 15 Oct 2022 00:37:40 +0000 Subject: [PATCH 10/10] backport of commit 9a3ddc4e2358e0658d1323e6395b4d00b3bb20e0 --- charts/consul/templates/server-acl-init-cleanup-job.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index eb38eab090..697427ab5f 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -64,11 +64,11 @@ spec: cpu: "50m" {{- if .Values.global.acls.tolerations }} tolerations: - {{ tpl .Values.global.acls.tolerations . | indent 12 | trim }} + {{ tpl .Values.global.acls.tolerations . | indent 8 | trim }} {{- end }} {{- if .Values.global.acls.nodeSelector }} nodeSelector: - {{ tpl .Values.global.acls.nodeSelector . | indent 12 | trim }} + {{ tpl .Values.global.acls.nodeSelector . | indent 8 | trim }} {{- end }} {{- end }} {{- end }}