From a9987be64c994e3608a1ec664d0d3ba95c10e088 Mon Sep 17 00:00:00 2001 From: Thiago Brito Date: Tue, 22 Mar 2022 15:33:39 -0300 Subject: [PATCH] Enable taint toleration for cinder This changes use the helm-toolkit template for toleration in openstack services Signed-off-by: Lucas Cavalcante Story: 2009276 Task: 43531 Depends-On: I168837f962465d1c89acc511b7bf4064ac4b546c Change-Id: Id63d0950fd8b7ff9592cbfe196b95739dc0b1380 --- cinder/Chart.yaml | 2 +- cinder/templates/cron-job-cinder-volume-usage-audit.yaml | 3 +++ cinder/templates/deployment-api.yaml | 3 +++ cinder/templates/deployment-backup.yaml | 3 +++ cinder/templates/deployment-scheduler.yaml | 3 +++ cinder/templates/deployment-volume.yaml | 3 +++ cinder/templates/job-backup-storage-init.yaml | 3 +++ cinder/templates/job-bootstrap.yaml | 3 +++ cinder/templates/job-clean.yaml | 3 +++ cinder/templates/job-create-internal-tenant.yaml | 3 +++ cinder/templates/job-db-drop.yaml | 3 +++ cinder/templates/job-db-init.yaml | 3 +++ cinder/templates/job-db-sync.yaml | 3 +++ cinder/templates/job-image-repo-sync.yaml | 3 +++ cinder/templates/job-ks-endpoints.yaml | 3 +++ cinder/templates/job-ks-service.yaml | 3 +++ cinder/templates/job-ks-user.yaml | 3 +++ cinder/templates/job-rabbit-init.yaml | 3 +++ cinder/templates/job-storage-init.yaml | 3 +++ cinder/templates/pod-rally-test.yaml | 3 +++ cinder/values.yaml | 7 +++++++ releasenotes/notes/cinder.yaml | 1 + 22 files changed, 66 insertions(+), 1 deletion(-) diff --git a/cinder/Chart.yaml b/cinder/Chart.yaml index 19adf01e4f..7b80c8648b 100644 --- a/cinder/Chart.yaml +++ b/cinder/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Cinder name: cinder -version: 0.2.15 +version: 0.2.16 home: https://docs.openstack.org/cinder/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Cinder/OpenStack_Project_Cinder_vertical.png sources: diff --git a/cinder/templates/cron-job-cinder-volume-usage-audit.yaml b/cinder/templates/cron-job-cinder-volume-usage-audit.yaml index 3d13af36cd..4b1520819f 100644 --- a/cinder/templates/cron-job-cinder-volume-usage-audit.yaml +++ b/cinder/templates/cron-job-cinder-volume-usage-audit.yaml @@ -52,6 +52,9 @@ spec: {{ dict "envAll" $envAll "application" "volume_usage_audit" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 10 }} serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 10 }} +{{ end }} nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} initContainers: diff --git a/cinder/templates/deployment-api.yaml b/cinder/templates/deployment-api.yaml index 2f684ec0aa..7925c60f23 100644 --- a/cinder/templates/deployment-api.yaml +++ b/cinder/templates/deployment-api.yaml @@ -49,6 +49,9 @@ spec: {{ dict "envAll" $envAll "application" "cinder_api" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} affinity: {{ tuple $envAll "cinder" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }} diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml index 91683e29e2..55c7289cf0 100755 --- a/cinder/templates/deployment-backup.yaml +++ b/cinder/templates/deployment-backup.yaml @@ -51,6 +51,9 @@ spec: {{ dict "envAll" $envAll "application" "cinder_backup" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} affinity: {{ tuple $envAll "cinder" "backup" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.backup.node_selector_key }}: {{ .Values.labels.backup.node_selector_value }} {{- if .Values.pod.useHostNetwork.backup }} diff --git a/cinder/templates/deployment-scheduler.yaml b/cinder/templates/deployment-scheduler.yaml index a4a43dbcc3..59c35971e5 100644 --- a/cinder/templates/deployment-scheduler.yaml +++ b/cinder/templates/deployment-scheduler.yaml @@ -49,6 +49,9 @@ spec: {{ dict "envAll" $envAll "application" "cinder_scheduler" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} affinity: {{ tuple $envAll "cinder" "scheduler" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.scheduler.node_selector_key }}: {{ .Values.labels.scheduler.node_selector_value }} initContainers: diff --git a/cinder/templates/deployment-volume.yaml b/cinder/templates/deployment-volume.yaml index bc1b6500d5..537b712e7a 100755 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -51,6 +51,9 @@ spec: {{ dict "envAll" $envAll "application" "cinder_volume" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} affinity: {{ tuple $envAll "cinder" "volume" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.volume.node_selector_key }}: {{ .Values.labels.volume.node_selector_value }} {{- if .Values.pod.useHostNetwork.volume }} diff --git a/cinder/templates/job-backup-storage-init.yaml b/cinder/templates/job-backup-storage-init.yaml index f37fb68bca..8168b90f53 100644 --- a/cinder/templates/job-backup-storage-init.yaml +++ b/cinder/templates/job-backup-storage-init.yaml @@ -65,6 +65,9 @@ spec: serviceAccountName: {{ $serviceAccountName }} {{ dict "envAll" $envAll "application" "storage_init" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} restartPolicy: OnFailure +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} initContainers: diff --git a/cinder/templates/job-bootstrap.yaml b/cinder/templates/job-bootstrap.yaml index 7f9cfdab44..8af3b7e6c7 100644 --- a/cinder/templates/job-bootstrap.yaml +++ b/cinder/templates/job-bootstrap.yaml @@ -17,5 +17,8 @@ limitations under the License. {{- if .Values.manifests.certificates -}} {{- $_ := set $bootstrapJob "tlsSecret" .Values.secrets.tls.volumev3.api.internal -}} {{- end -}} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $bootstrapJob "tolerationsEnabled" true -}} +{{- end -}} {{ $bootstrapJob | include "helm-toolkit.manifests.job_bootstrap" }} {{- end }} diff --git a/cinder/templates/job-clean.yaml b/cinder/templates/job-clean.yaml index 738e145bed..57a424378e 100755 --- a/cinder/templates/job-clean.yaml +++ b/cinder/templates/job-clean.yaml @@ -64,6 +64,9 @@ spec: serviceAccountName: {{ $serviceAccountName }} {{ dict "envAll" $envAll "application" "clean" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} restartPolicy: OnFailure +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} initContainers: diff --git a/cinder/templates/job-create-internal-tenant.yaml b/cinder/templates/job-create-internal-tenant.yaml index 497e2c7e3d..b298e369d7 100644 --- a/cinder/templates/job-create-internal-tenant.yaml +++ b/cinder/templates/job-create-internal-tenant.yaml @@ -46,6 +46,9 @@ spec: {{ dict "envAll" $envAll "application" "create_internal_tenant" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName | quote }} restartPolicy: OnFailure +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ toYaml $nodeSelector | indent 8 }} initContainers: diff --git a/cinder/templates/job-db-drop.yaml b/cinder/templates/job-db-drop.yaml index 052d3bce4f..1115af50c3 100644 --- a/cinder/templates/job-db-drop.yaml +++ b/cinder/templates/job-db-drop.yaml @@ -17,5 +17,8 @@ limitations under the License. {{- if .Values.manifests.certificates -}} {{- $_ := set $dbDropJob "dbAdminTlsSecret" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal -}} {{- end -}} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $dbDropJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/cinder/templates/job-db-init.yaml b/cinder/templates/job-db-init.yaml index 8e47f5513a..c7e450ad24 100644 --- a/cinder/templates/job-db-init.yaml +++ b/cinder/templates/job-db-init.yaml @@ -25,5 +25,8 @@ helm.sh/hook-weight: "-5" {{- if .Values.helm3_hook }} {{- $_ := set $dbInitJob "jobAnnotations" (include "metadata.annotations.job.db_init" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $dbInitJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }} {{- end }} diff --git a/cinder/templates/job-db-sync.yaml b/cinder/templates/job-db-sync.yaml index 1b815bc7c7..1bab87b0e7 100644 --- a/cinder/templates/job-db-sync.yaml +++ b/cinder/templates/job-db-sync.yaml @@ -25,5 +25,8 @@ helm.sh/hook-weight: "-4" {{- if .Values.helm3_hook }} {{- $_ := set $dbSyncJob "jobAnnotations" (include "metadata.annotations.job.db_sync" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $dbSyncJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }} {{- end }} diff --git a/cinder/templates/job-image-repo-sync.yaml b/cinder/templates/job-image-repo-sync.yaml index e56c6f3b3c..2d1f1f7146 100644 --- a/cinder/templates/job-image-repo-sync.yaml +++ b/cinder/templates/job-image-repo-sync.yaml @@ -21,5 +21,8 @@ helm.sh/hook: post-install,post-upgrade {{- if .Values.helm3_hook }} {{- $_ := $imageRepoSyncJob "jobAnnotations" (include "metadata.annotations.job.repo_sync" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $imageRepoSyncJob "tolerationsEnabled" true -}} +{{- end -}} {{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }} {{- end }} diff --git a/cinder/templates/job-ks-endpoints.yaml b/cinder/templates/job-ks-endpoints.yaml index ae7238a611..6b0493d923 100644 --- a/cinder/templates/job-ks-endpoints.yaml +++ b/cinder/templates/job-ks-endpoints.yaml @@ -25,5 +25,8 @@ helm.sh/hook-weight: "-2" {{- if .Values.helm3_hook }} {{- $_ := set $ksServiceJob "jobAnnotations" (include "metadata.annotations.job.ks_endpoints" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $ksServiceJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }} {{- end }} diff --git a/cinder/templates/job-ks-service.yaml b/cinder/templates/job-ks-service.yaml index 827b39f8e5..3cd59f3558 100644 --- a/cinder/templates/job-ks-service.yaml +++ b/cinder/templates/job-ks-service.yaml @@ -25,5 +25,8 @@ helm.sh/hook-weight: "-3" {{- if .Values.helm3_hook }} {{- $_ := set $ksServiceJob "jobAnnotations" (include "metadata.annotations.job.ks_service" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $ksServiceJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }} {{- end }} diff --git a/cinder/templates/job-ks-user.yaml b/cinder/templates/job-ks-user.yaml index 5f530b9968..4cd671d8fc 100644 --- a/cinder/templates/job-ks-user.yaml +++ b/cinder/templates/job-ks-user.yaml @@ -25,5 +25,8 @@ helm.sh/hook-weight: "-1" {{- if .Values.helm3_hook }} {{- $_ := set $ksUserJob "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $ksUserJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }} {{- end }} diff --git a/cinder/templates/job-rabbit-init.yaml b/cinder/templates/job-rabbit-init.yaml index 8cf33c9ab5..43d23922a9 100644 --- a/cinder/templates/job-rabbit-init.yaml +++ b/cinder/templates/job-rabbit-init.yaml @@ -25,5 +25,8 @@ helm.sh/hook-weight: "-4" {{- if .Values.helm3_hook }} {{- $_ := set $rmqUserJob "jobAnnotations" (include "metadata.annotations.job.rabbit_init" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.cinder.enabled -}} +{{- $_ := set $rmqUserJob "tolerationsEnabled" true -}} +{{- end -}} {{ $rmqUserJob | include "helm-toolkit.manifests.job_rabbit_init" }} {{- end }} diff --git a/cinder/templates/job-storage-init.yaml b/cinder/templates/job-storage-init.yaml index 6a7adc3c5b..badfe5fcd8 100755 --- a/cinder/templates/job-storage-init.yaml +++ b/cinder/templates/job-storage-init.yaml @@ -63,6 +63,9 @@ spec: serviceAccountName: {{ $serviceAccountName }} {{ dict "envAll" $envAll "application" "cinder" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} restartPolicy: OnFailure +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} initContainers: diff --git a/cinder/templates/pod-rally-test.yaml b/cinder/templates/pod-rally-test.yaml index 3725e03505..34316c6586 100644 --- a/cinder/templates/pod-rally-test.yaml +++ b/cinder/templates/pod-rally-test.yaml @@ -33,6 +33,9 @@ metadata: {{ dict "envAll" $envAll "podName" "cinder-test" "containerNames" (list "init" "cinder-test" "cinder-test-ks-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }} spec: restartPolicy: Never +{{ if $envAll.Values.pod.tolerations.cinder.enabled }} +{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }} +{{ end }} nodeSelector: {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }} serviceAccountName: {{ $serviceAccountName }} diff --git a/cinder/values.yaml b/cinder/values.yaml index 4ae16ecee3..b84e220751 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -173,6 +173,13 @@ pod: default: kubernetes.io/hostname weight: default: 10 + tolerations: + cinder: + enabled: false + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule useHostNetwork: volume: false backup: false diff --git a/releasenotes/notes/cinder.yaml b/releasenotes/notes/cinder.yaml index 39fe36603a..a97c1cd2a7 100644 --- a/releasenotes/notes/cinder.yaml +++ b/releasenotes/notes/cinder.yaml @@ -32,4 +32,5 @@ cinder: - 0.2.13 Upgrade default images to ussuri - 0.2.14 Fix notifications - 0.2.15 Remove glance registry + - 0.2.16 Enable taint toleration for Openstack services ...