From 055c3086fc79f27708f9946a5d8b8f0e6e26ed2b Mon Sep 17 00:00:00 2001 From: Thiago Brito Date: Tue, 22 Mar 2022 15:32:54 -0300 Subject: [PATCH] Enable taint toleration for heat 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: Id3875f9ce5fe4e0a16749857c4d8097ab98567eb --- heat/Chart.yaml | 2 +- heat/templates/cron-job-engine-cleaner.yaml | 3 +++ heat/templates/cron-job-purge-deleted.yaml | 3 +++ heat/templates/deployment-api.yaml | 3 +++ heat/templates/deployment-cfn.yaml | 3 +++ heat/templates/deployment-cloudwatch.yaml | 3 +++ heat/templates/deployment-engine.yaml | 3 +++ heat/templates/job-bootstrap.yaml | 3 +++ heat/templates/job-db-drop.yaml | 3 +++ heat/templates/job-db-init.yaml | 3 +++ heat/templates/job-db-sync.yaml | 3 +++ heat/templates/job-image-repo-sync.yaml | 3 +++ heat/templates/job-ks-endpoints.yaml | 3 +++ heat/templates/job-ks-service.yaml | 3 +++ heat/templates/job-ks-user-domain.yaml | 3 +++ heat/templates/job-ks-user-trustee.yaml | 3 +++ heat/templates/job-ks-user.yaml | 3 +++ heat/templates/job-rabbit-init.yaml | 3 +++ heat/templates/job-trusts.yaml | 3 +++ heat/templates/pod-rally-test.yaml | 3 +++ heat/values.yaml | 7 +++++++ releasenotes/notes/heat.yaml | 1 + 22 files changed, 66 insertions(+), 1 deletion(-) diff --git a/heat/Chart.yaml b/heat/Chart.yaml index ba89d1dbf5..8c00571b8b 100644 --- a/heat/Chart.yaml +++ b/heat/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Heat name: heat -version: 0.2.8 +version: 0.2.9 home: https://docs.openstack.org/heat/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Heat/OpenStack_Project_Heat_vertical.png sources: diff --git a/heat/templates/cron-job-engine-cleaner.yaml b/heat/templates/cron-job-engine-cleaner.yaml index 1e7e6f313c..329193cb0b 100644 --- a/heat/templates/cron-job-engine-cleaner.yaml +++ b/heat/templates/cron-job-engine-cleaner.yaml @@ -55,6 +55,9 @@ spec: serviceAccountName: {{ $serviceAccountName }} {{ dict "envAll" $envAll "application" "engine_cleaner" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 10 }} restartPolicy: OnFailure +{{ if $envAll.Values.pod.tolerations.heat.enabled }} +{{ tuple $envAll "heat" | 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/heat/templates/cron-job-purge-deleted.yaml b/heat/templates/cron-job-purge-deleted.yaml index dd275d7519..987b572cd9 100644 --- a/heat/templates/cron-job-purge-deleted.yaml +++ b/heat/templates/cron-job-purge-deleted.yaml @@ -49,6 +49,9 @@ spec: spec: serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure +{{ if $envAll.Values.pod.tolerations.heat.enabled }} +{{ tuple $envAll "heat" | 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/heat/templates/deployment-api.yaml b/heat/templates/deployment-api.yaml index a17ddaef55..d3cebb0acd 100644 --- a/heat/templates/deployment-api.yaml +++ b/heat/templates/deployment-api.yaml @@ -49,6 +49,9 @@ spec: {{ dict "envAll" $envAll "application" "heat" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} affinity: {{ tuple $envAll "heat" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ if $envAll.Values.pod.tolerations.heat.enabled }} +{{ tuple $envAll "heat" | 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/heat/templates/deployment-cfn.yaml b/heat/templates/deployment-cfn.yaml index 9fab9e647f..dc05f6f546 100644 --- a/heat/templates/deployment-cfn.yaml +++ b/heat/templates/deployment-cfn.yaml @@ -49,6 +49,9 @@ spec: {{ dict "envAll" $envAll "application" "heat" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} affinity: {{ tuple $envAll "heat" "cfn" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ if $envAll.Values.pod.tolerations.heat.enabled }} +{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.cfn.node_selector_key }}: {{ .Values.labels.cfn.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.cfn.timeout | default "30" }} diff --git a/heat/templates/deployment-cloudwatch.yaml b/heat/templates/deployment-cloudwatch.yaml index 092feac1e9..2fc5a4912c 100644 --- a/heat/templates/deployment-cloudwatch.yaml +++ b/heat/templates/deployment-cloudwatch.yaml @@ -48,6 +48,9 @@ spec: {{ dict "envAll" $envAll "application" "heat" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} affinity: {{ tuple $envAll "heat" "cloudwatch" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ if $envAll.Values.pod.tolerations.heat.enabled }} +{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} nodeSelector: {{ .Values.labels.cloudwatch.node_selector_key }}: {{ .Values.labels.cloudwatch.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.cloudwatch.timeout | default "30" }} diff --git a/heat/templates/deployment-engine.yaml b/heat/templates/deployment-engine.yaml index 4ae0197bd4..da9c905f29 100644 --- a/heat/templates/deployment-engine.yaml +++ b/heat/templates/deployment-engine.yaml @@ -59,6 +59,9 @@ spec: {{- tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.engine.node_selector_key }}: {{ .Values.labels.engine.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.heat.enabled }} +{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.engine.timeout | default "30" }} initContainers: {{ tuple $envAll "engine" $mounts_heat_engine_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} diff --git a/heat/templates/job-bootstrap.yaml b/heat/templates/job-bootstrap.yaml index 5dfe56fab0..ee32154574 100644 --- a/heat/templates/job-bootstrap.yaml +++ b/heat/templates/job-bootstrap.yaml @@ -25,5 +25,8 @@ helm.sh/hook-weight: "5" {{- if .Values.helm3_hook }} {{- $_ := set $bootstrapJob "jobAnnotations" (include "metadata.annotations.job.bootstrap" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.heat.enabled -}} +{{- $_ := set $bootstrapJob "tolerationsEnabled" true -}} +{{- end -}} {{ $bootstrapJob | include "helm-toolkit.manifests.job_bootstrap" }} {{- end }} diff --git a/heat/templates/job-db-drop.yaml b/heat/templates/job-db-drop.yaml index d74fa7bf43..7caa9619e5 100644 --- a/heat/templates/job-db-drop.yaml +++ b/heat/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.heat.enabled -}} +{{- $_ := set $dbDropJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/heat/templates/job-db-init.yaml b/heat/templates/job-db-init.yaml index b3b44fe803..442a2fa40d 100644 --- a/heat/templates/job-db-init.yaml +++ b/heat/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.heat.enabled -}} +{{- $_ := set $dbInitJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }} {{- end }} diff --git a/heat/templates/job-db-sync.yaml b/heat/templates/job-db-sync.yaml index 56707926ec..a25faf849e 100644 --- a/heat/templates/job-db-sync.yaml +++ b/heat/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.heat.enabled -}} +{{- $_ := set $dbSyncJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }} {{- end }} diff --git a/heat/templates/job-image-repo-sync.yaml b/heat/templates/job-image-repo-sync.yaml index a9da3252b8..83a84bbdee 100644 --- a/heat/templates/job-image-repo-sync.yaml +++ b/heat/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.heat.enabled -}} +{{- $_ := set $imageRepoSyncJob "tolerationsEnabled" true -}} +{{- end -}} {{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }} {{- end }} diff --git a/heat/templates/job-ks-endpoints.yaml b/heat/templates/job-ks-endpoints.yaml index 938880612f..9c7daeee1d 100644 --- a/heat/templates/job-ks-endpoints.yaml +++ b/heat/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.heat.enabled -}} +{{- $_ := set $ksServiceJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }} {{- end }} diff --git a/heat/templates/job-ks-service.yaml b/heat/templates/job-ks-service.yaml index 5947c0e742..6505cefe4d 100644 --- a/heat/templates/job-ks-service.yaml +++ b/heat/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.heat.enabled -}} +{{- $_ := set $ksServiceJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }} {{- end }} diff --git a/heat/templates/job-ks-user-domain.yaml b/heat/templates/job-ks-user-domain.yaml index a70960877d..89b73dd90e 100644 --- a/heat/templates/job-ks-user-domain.yaml +++ b/heat/templates/job-ks-user-domain.yaml @@ -46,6 +46,9 @@ spec: restartPolicy: OnFailure nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.heat.enabled }} +{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll "ks_user" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: diff --git a/heat/templates/job-ks-user-trustee.yaml b/heat/templates/job-ks-user-trustee.yaml index 21f1b57858..934c6021b2 100644 --- a/heat/templates/job-ks-user-trustee.yaml +++ b/heat/templates/job-ks-user-trustee.yaml @@ -24,5 +24,8 @@ helm.sh/hook: post-install,post-upgrade {{- if .Values.helm3_hook }} {{- $_ := set $ksUserJob "jobAnnotations" (include "metadata.annotations.job.heat_trust" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.heat.enabled -}} +{{- $_ := set $ksUserJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }} {{- end }} diff --git a/heat/templates/job-ks-user.yaml b/heat/templates/job-ks-user.yaml index bf23eebb14..db39a5562b 100644 --- a/heat/templates/job-ks-user.yaml +++ b/heat/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.heat.enabled -}} +{{- $_ := set $ksUserJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }} {{- end }} diff --git a/heat/templates/job-rabbit-init.yaml b/heat/templates/job-rabbit-init.yaml index 8da178b519..bd6b228c93 100644 --- a/heat/templates/job-rabbit-init.yaml +++ b/heat/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.heat.enabled -}} +{{- $_ := set $rmqUserJob "tolerationsEnabled" true -}} +{{- end -}} {{ $rmqUserJob | include "helm-toolkit.manifests.job_rabbit_init" }} {{- end }} diff --git a/heat/templates/job-trusts.yaml b/heat/templates/job-trusts.yaml index afa6bdec30..e713d2781f 100644 --- a/heat/templates/job-trusts.yaml +++ b/heat/templates/job-trusts.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.heat.enabled }} +{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll "trusts" $mounts_heat_trusts_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: diff --git a/heat/templates/pod-rally-test.yaml b/heat/templates/pod-rally-test.yaml index 9aa6373e96..3b7d95da90 100644 --- a/heat/templates/pod-rally-test.yaml +++ b/heat/templates/pod-rally-test.yaml @@ -33,6 +33,9 @@ metadata: spec: nodeSelector: {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.heat.enabled }} +{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }} +{{ end }} restartPolicy: Never serviceAccountName: {{ $serviceAccountName }} initContainers: diff --git a/heat/values.yaml b/heat/values.yaml index 58f786b6f4..36017d63bb 100644 --- a/heat/values.yaml +++ b/heat/values.yaml @@ -1082,6 +1082,13 @@ pod: default: kubernetes.io/hostname weight: default: 10 + tolerations: + heat: + enabled: false + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule mounts: heat_api: init_container: null diff --git a/releasenotes/notes/heat.yaml b/releasenotes/notes/heat.yaml index 3f66737f65..699f0537d0 100644 --- a/releasenotes/notes/heat.yaml +++ b/releasenotes/notes/heat.yaml @@ -15,4 +15,5 @@ heat: - 0.2.6 Added post-install and post-upgrade helm-hook for jobs - 0.2.7 Helm 3 - Fix Job Labels - 0.2.8 Update htk requirements repo + - 0.2.9 Enable taint toleration for Openstack services ...