From 7f76a519d4b54bb95afd6dd4be2c74841d81b647 Mon Sep 17 00:00:00 2001 From: Thiago Brito Date: Tue, 22 Mar 2022 15:09:23 -0300 Subject: [PATCH] Enable taint toleration for rabbitmq This adds taint toleration support for openstack jobs Signed-off-by: Lucas Cavalcante Change-Id: I1c731c94e58895bd8bfc26d4300aac40a9111f12 --- rabbitmq/Chart.yaml | 2 +- rabbitmq/templates/job-cluster-wait.yaml | 3 +++ rabbitmq/templates/job-image-repo-sync.yaml | 3 +++ rabbitmq/templates/pod-test.yaml | 3 +++ rabbitmq/templates/statefulset.yaml | 3 +++ rabbitmq/values.yaml | 7 +++++++ releasenotes/notes/rabbitmq.yaml | 1 + 7 files changed, 21 insertions(+), 1 deletion(-) diff --git a/rabbitmq/Chart.yaml b/rabbitmq/Chart.yaml index 25a062fe0..aab53179b 100644 --- a/rabbitmq/Chart.yaml +++ b/rabbitmq/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v3.7.26 description: OpenStack-Helm RabbitMQ name: rabbitmq -version: 0.1.18 +version: 0.1.19 home: https://github.com/rabbitmq/rabbitmq-server ... diff --git a/rabbitmq/templates/job-cluster-wait.yaml b/rabbitmq/templates/job-cluster-wait.yaml index b309e6e5f..131cf456b 100644 --- a/rabbitmq/templates/job-cluster-wait.yaml +++ b/rabbitmq/templates/job-cluster-wait.yaml @@ -50,6 +50,9 @@ spec: {{ dict "envAll" $envAll "application" "cluster_wait" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure +{{ if $envAll.Values.pod.tolerations.rabbitmq.enabled }} +{{ tuple $envAll "rabbitmq" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ $envAll.Values.labels.jobs.node_selector_key }}: {{ $envAll.Values.labels.test.node_selector_value | quote }} initContainers: diff --git a/rabbitmq/templates/job-image-repo-sync.yaml b/rabbitmq/templates/job-image-repo-sync.yaml index 4875ed444..8fd379f95 100644 --- a/rabbitmq/templates/job-image-repo-sync.yaml +++ b/rabbitmq/templates/job-image-repo-sync.yaml @@ -14,5 +14,8 @@ limitations under the License. {{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }} {{- $imageRepoSyncJob := dict "envAll" . "serviceName" "rabbitmq" -}} +{{- if .Values.pod.tolerations.rabbitmq.enabled -}} +{{- $_ := set $imageRepoSyncJob "tolerationsEnabled" true -}} +{{- end -}} {{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }} {{- end }} diff --git a/rabbitmq/templates/pod-test.yaml b/rabbitmq/templates/pod-test.yaml index 2ee00d5d8..a1d9639f6 100644 --- a/rabbitmq/templates/pod-test.yaml +++ b/rabbitmq/templates/pod-test.yaml @@ -42,6 +42,9 @@ metadata: spec: {{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }} serviceAccountName: {{ $serviceAccountName }} +{{ if $envAll.Values.pod.tolerations.rabbitmq.enabled }} +{{ tuple $envAll "rabbitmq" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }} +{{ end }} nodeSelector: {{ $envAll.Values.labels.test.node_selector_key }}: {{ $envAll.Values.labels.test.node_selector_value | quote }} restartPolicy: Never diff --git a/rabbitmq/templates/statefulset.yaml b/rabbitmq/templates/statefulset.yaml index 578ea3579..eebc83791 100644 --- a/rabbitmq/templates/statefulset.yaml +++ b/rabbitmq/templates/statefulset.yaml @@ -103,6 +103,9 @@ spec: serviceAccountName: {{ $rcControllerName | quote }} affinity: {{ tuple $envAll "rabbitmq" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ if $envAll.Values.pod.tolerations.rabbitmq.enabled }} +{{ tuple $envAll "rabbitmq" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ $envAll.Values.labels.server.node_selector_key }}: {{ $envAll.Values.labels.server.node_selector_value | quote }} initContainers: diff --git a/rabbitmq/values.yaml b/rabbitmq/values.yaml index 8eb51c649..9c686ca3a 100644 --- a/rabbitmq/values.yaml +++ b/rabbitmq/values.yaml @@ -118,6 +118,13 @@ pod: default: kubernetes.io/hostname weight: default: 10 + tolerations: + rabbitmq: + enabled: false + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule replicas: server: 2 prometheus_rabbitmq_exporter: 1 diff --git a/releasenotes/notes/rabbitmq.yaml b/releasenotes/notes/rabbitmq.yaml index eee98c466..969211d90 100644 --- a/releasenotes/notes/rabbitmq.yaml +++ b/releasenotes/notes/rabbitmq.yaml @@ -18,4 +18,5 @@ rabbitmq: - 0.1.16 Add force_boot command to rabbit start template - 0.1.17 Updated naming for subchart compatibility - 0.1.18 Revert naming for subchart compatibility + - 0.1.19 Enable taint toleration for Openstack services jobs ...