From 7d1d629e51181df18f4a8a5339659ab53c88a654 Mon Sep 17 00:00:00 2001 From: Thiago Brito Date: Tue, 22 Mar 2022 15:15:15 -0300 Subject: [PATCH] Enable taint toleration for gnocchi This adds taint toleration support for openstack jobs Signed-off-by: Lucas Cavalcante Change-Id: If11d265c27b8f6a4c5996d60990eadde2346c0f8 --- gnocchi/Chart.yaml | 2 +- gnocchi/templates/cron-job-resources-cleaner.yaml | 3 +++ gnocchi/templates/daemonset-metricd.yaml | 3 +++ gnocchi/templates/daemonset-statsd.yaml | 3 +++ gnocchi/templates/deployment-api.yaml | 3 +++ gnocchi/templates/job-bootstrap.yaml | 3 +++ gnocchi/templates/job-clean.yaml | 3 +++ gnocchi/templates/job-db-drop.yaml | 3 +++ gnocchi/templates/job-db-init-indexer.yaml | 3 +++ gnocchi/templates/job-db-init.yaml | 3 +++ gnocchi/templates/job-db-sync.yaml | 3 +++ gnocchi/templates/job-image-repo-sync.yaml | 3 +++ gnocchi/templates/job-ks-endpoints.yaml | 7 +++++-- gnocchi/templates/job-ks-service.yaml | 3 +++ gnocchi/templates/job-ks-user.yaml | 3 +++ gnocchi/templates/job-storage-init.yaml | 3 +++ gnocchi/templates/pod-gnocchi-test.yaml | 3 +++ gnocchi/values.yaml | 7 +++++++ releasenotes/notes/gnocchi.yaml | 1 + 19 files changed, 59 insertions(+), 3 deletions(-) diff --git a/gnocchi/Chart.yaml b/gnocchi/Chart.yaml index e53703abf..f9909e2c3 100644 --- a/gnocchi/Chart.yaml +++ b/gnocchi/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v3.0.3 description: OpenStack-Helm Gnocchi name: gnocchi -version: 0.1.4 +version: 0.1.5 home: https://gnocchi.xyz/ icon: https://gnocchi.xyz/_static/gnocchi-logo.png sources: diff --git a/gnocchi/templates/cron-job-resources-cleaner.yaml b/gnocchi/templates/cron-job-resources-cleaner.yaml index 115fc4ff0..63eff0eac 100644 --- a/gnocchi/templates/cron-job-resources-cleaner.yaml +++ b/gnocchi/templates/cron-job-resources-cleaner.yaml @@ -48,6 +48,9 @@ spec: restartPolicy: OnFailure nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 10 }} +{{ end }} initContainers: {{ tuple $envAll "resources_cleaner" $mounts_gnocchi_resources_cleaner_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }} containers: diff --git a/gnocchi/templates/daemonset-metricd.yaml b/gnocchi/templates/daemonset-metricd.yaml index 40daa26a4..6fe775939 100644 --- a/gnocchi/templates/daemonset-metricd.yaml +++ b/gnocchi/templates/daemonset-metricd.yaml @@ -44,6 +44,9 @@ spec: serviceAccountName: {{ $serviceAccountName }} nodeSelector: {{ .Values.labels.metricd.node_selector_key }}: {{ .Values.labels.metricd.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll "metricd" $mounts_gnocchi_metricd_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - name: ceph-keyring-placement diff --git a/gnocchi/templates/daemonset-statsd.yaml b/gnocchi/templates/daemonset-statsd.yaml index 68f8f080e..316265bc8 100644 --- a/gnocchi/templates/daemonset-statsd.yaml +++ b/gnocchi/templates/daemonset-statsd.yaml @@ -43,6 +43,9 @@ spec: serviceAccountName: {{ $serviceAccountName }} nodeSelector: {{ .Values.labels.statsd.node_selector_key }}: {{ .Values.labels.statsd.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll "statsd" $mounts_gnocchi_statsd_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - name: ceph-keyring-placement diff --git a/gnocchi/templates/deployment-api.yaml b/gnocchi/templates/deployment-api.yaml index b41f0743f..bb800802b 100644 --- a/gnocchi/templates/deployment-api.yaml +++ b/gnocchi/templates/deployment-api.yaml @@ -47,6 +47,9 @@ spec: {{ tuple $envAll "gnocchi" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }} initContainers: {{ tuple $envAll "api" $mounts_gnocchi_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} diff --git a/gnocchi/templates/job-bootstrap.yaml b/gnocchi/templates/job-bootstrap.yaml index 5f3cfae51..d2dbc51ee 100644 --- a/gnocchi/templates/job-bootstrap.yaml +++ b/gnocchi/templates/job-bootstrap.yaml @@ -14,5 +14,8 @@ limitations under the License. {{- if and .Values.manifests.job_bootstrap .Values.bootstrap.enabled }} {{- $bootstrapJob := dict "envAll" . "serviceName" "gnocchi" "keystoneUser" .Values.bootstrap.ks_user -}} +{{- if .Values.pod.tolerations.gnocchi.enabled -}} +{{- $_ := set $bootstrapJob "tolerationsEnabled" true -}} +{{- end -}} {{ $bootstrapJob | include "helm-toolkit.manifests.job_bootstrap" }} {{- end }} diff --git a/gnocchi/templates/job-clean.yaml b/gnocchi/templates/job-clean.yaml index 3e294bf13..e1023aa32 100644 --- a/gnocchi/templates/job-clean.yaml +++ b/gnocchi/templates/job-clean.yaml @@ -63,6 +63,9 @@ spec: restartPolicy: OnFailure nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll "clean" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: diff --git a/gnocchi/templates/job-db-drop.yaml b/gnocchi/templates/job-db-drop.yaml index 056a95f29..5f9be1ef2 100644 --- a/gnocchi/templates/job-db-drop.yaml +++ b/gnocchi/templates/job-db-drop.yaml @@ -14,5 +14,8 @@ limitations under the License. {{- if .Values.manifests.job_db_drop }} {{- $dbDropJob := dict "envAll" . "serviceName" "gnocchi" -}} +{{- if .Values.pod.tolerations.gnocchi.enabled -}} +{{- $_ := set $dbDropJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/gnocchi/templates/job-db-init-indexer.yaml b/gnocchi/templates/job-db-init-indexer.yaml index ab0780438..397dbee23 100644 --- a/gnocchi/templates/job-db-init-indexer.yaml +++ b/gnocchi/templates/job-db-init-indexer.yaml @@ -34,6 +34,9 @@ spec: restartPolicy: OnFailure nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll "db_init_postgresql" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: diff --git a/gnocchi/templates/job-db-init.yaml b/gnocchi/templates/job-db-init.yaml index dace53424..99ac8e214 100644 --- a/gnocchi/templates/job-db-init.yaml +++ b/gnocchi/templates/job-db-init.yaml @@ -14,5 +14,8 @@ limitations under the License. {{- if .Values.manifests.job_db_init }} {{- $dbInitJob := dict "envAll" . "serviceName" "gnocchi" -}} +{{- if .Values.pod.tolerations.gnocchi.enabled -}} +{{- $_ := set $dbInitJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }} {{- end }} diff --git a/gnocchi/templates/job-db-sync.yaml b/gnocchi/templates/job-db-sync.yaml index 603918474..123a5e164 100644 --- a/gnocchi/templates/job-db-sync.yaml +++ b/gnocchi/templates/job-db-sync.yaml @@ -34,6 +34,9 @@ spec: restartPolicy: OnFailure nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll "db_sync" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - name: ceph-keyring-placement diff --git a/gnocchi/templates/job-image-repo-sync.yaml b/gnocchi/templates/job-image-repo-sync.yaml index 4ace9b9fc..f4c4d018e 100644 --- a/gnocchi/templates/job-image-repo-sync.yaml +++ b/gnocchi/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" "gnocchi" -}} +{{- if .Values.pod.tolerations.gnocchi.enabled -}} +{{- $_ := set $imageRepoSyncJob "tolerationsEnabled" true -}} +{{- end -}} {{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }} {{- end }} diff --git a/gnocchi/templates/job-ks-endpoints.yaml b/gnocchi/templates/job-ks-endpoints.yaml index 2f5c05557..47809e94d 100644 --- a/gnocchi/templates/job-ks-endpoints.yaml +++ b/gnocchi/templates/job-ks-endpoints.yaml @@ -13,6 +13,9 @@ limitations under the License. */}} {{- if .Values.manifests.job_ks_endpoints }} -{{- $ksServiceJob := dict "envAll" . "serviceName" "gnocchi" "serviceTypes" ( tuple "metric" ) -}} -{{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }} +{{- $ksEndpointsJob := dict "envAll" . "serviceName" "gnocchi" "serviceTypes" ( tuple "metric" ) -}} +{{- if .Values.pod.tolerations.gnocchi.enabled -}} +{{- $_ := set $ksEndpointsJob "tolerationsEnabled" true -}} +{{- end -}} +{{ $ksEndpointsJob | include "helm-toolkit.manifests.job_ks_endpoints" }} {{- end }} diff --git a/gnocchi/templates/job-ks-service.yaml b/gnocchi/templates/job-ks-service.yaml index 24c2935e1..76070d6e6 100644 --- a/gnocchi/templates/job-ks-service.yaml +++ b/gnocchi/templates/job-ks-service.yaml @@ -14,5 +14,8 @@ limitations under the License. {{- if .Values.manifests.job_ks_service }} {{- $ksServiceJob := dict "envAll" . "serviceName" "gnocchi" "serviceTypes" ( tuple "metric" ) -}} +{{- if .Values.pod.tolerations.gnocchi.enabled -}} +{{- $_ := set $ksServiceJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }} {{- end }} diff --git a/gnocchi/templates/job-ks-user.yaml b/gnocchi/templates/job-ks-user.yaml index 371f6b35b..1dd7e5a01 100644 --- a/gnocchi/templates/job-ks-user.yaml +++ b/gnocchi/templates/job-ks-user.yaml @@ -14,5 +14,8 @@ limitations under the License. {{- if .Values.manifests.job_ks_user }} {{- $ksUserJob := dict "envAll" . "serviceName" "gnocchi" -}} +{{- if .Values.pod.tolerations.gnocchi.enabled -}} +{{- $_ := set $ksUserJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }} {{- end }} diff --git a/gnocchi/templates/job-storage-init.yaml b/gnocchi/templates/job-storage-init.yaml index e2736a5e9..9aaae9a5c 100644 --- a/gnocchi/templates/job-storage-init.yaml +++ b/gnocchi/templates/job-storage-init.yaml @@ -62,6 +62,9 @@ spec: restartPolicy: OnFailure nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll "storage_init" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - name: ceph-keyring-placement diff --git a/gnocchi/templates/pod-gnocchi-test.yaml b/gnocchi/templates/pod-gnocchi-test.yaml index 9ceda0143..c3cbe67bf 100644 --- a/gnocchi/templates/pod-gnocchi-test.yaml +++ b/gnocchi/templates/pod-gnocchi-test.yaml @@ -32,6 +32,9 @@ metadata: spec: nodeSelector: {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.gnocchi.enabled }} +{{ tuple $envAll "gnocchi" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }} +{{ end }} serviceAccountName: {{ $serviceAccountName }} restartPolicy: Never initContainers: diff --git a/gnocchi/values.yaml b/gnocchi/values.yaml index 4ed1ba66a..74cf0163a 100644 --- a/gnocchi/values.yaml +++ b/gnocchi/values.yaml @@ -207,6 +207,13 @@ pod: default: kubernetes.io/hostname weight: default: 10 + tolerations: + gnocchi: + enabled: false + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule mounts: gnocchi_api: init_container: null diff --git a/releasenotes/notes/gnocchi.yaml b/releasenotes/notes/gnocchi.yaml index 1eb97087f..1d2afd02e 100644 --- a/releasenotes/notes/gnocchi.yaml +++ b/releasenotes/notes/gnocchi.yaml @@ -5,4 +5,5 @@ gnocchi: - 0.1.2 Use full image ref for docker official images - 0.1.3 Helm 3 - Fix Job labels - 0.1.4 Update htk requirements + - 0.1.5 Enable taint toleration for Openstack services jobs ...