From 2846d79e49b44abea8af0fd4ac6b816795b30c29 Mon Sep 17 00:00:00 2001 From: Thiago Brito Date: Tue, 22 Mar 2022 15:27:55 -0300 Subject: [PATCH] Enable taint toleration for placement This changes use the helm-toolkit template for toleration in openstack services Signed-off-by: Lucas Cavalcante Story: 2009276 Task: 43531 Change-Id: I8f63c285cb53090cd7eb0b663bb94fc892dc1a3f Depends-On: I168837f962465d1c89acc511b7bf4064ac4b546c --- placement/Chart.yaml | 2 +- placement/templates/deployment.yaml | 3 +++ placement/templates/job-db-drop.yaml | 3 +++ placement/templates/job-db-init.yaml | 3 +++ placement/templates/job-db-migrate.yaml | 3 +++ placement/templates/job-db-sync.yaml | 3 +++ placement/templates/job-image-repo-sync.yaml | 3 +++ placement/templates/job-ks-endpoints.yaml | 3 +++ placement/templates/job-ks-service.yaml | 3 +++ placement/templates/job-ks-user.yaml | 3 +++ placement/values.yaml | 7 +++++++ releasenotes/notes/placement.yaml | 1 + 12 files changed, 36 insertions(+), 1 deletion(-) diff --git a/placement/Chart.yaml b/placement/Chart.yaml index 7347d1196b..f0ef9ca3d1 100644 --- a/placement/Chart.yaml +++ b/placement/Chart.yaml @@ -16,7 +16,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Placement name: placement -version: 0.2.5 +version: 0.2.6 home: https://docs.openstack.org/placement/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Placement/OpenStack_Project_Placement_vertical.png sources: diff --git a/placement/templates/deployment.yaml b/placement/templates/deployment.yaml index f10b135ddf..9dcde00855 100644 --- a/placement/templates/deployment.yaml +++ b/placement/templates/deployment.yaml @@ -53,6 +53,9 @@ spec: {{ tuple $envAll "placement" "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.placement.enabled }} +{{ tuple $envAll "placement" | 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_placement_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} diff --git a/placement/templates/job-db-drop.yaml b/placement/templates/job-db-drop.yaml index af8cd24701..f6e26e73d6 100644 --- a/placement/templates/job-db-drop.yaml +++ b/placement/templates/job-db-drop.yaml @@ -20,5 +20,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.placement.enabled -}} +{{- $_ := set $dbDropJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/placement/templates/job-db-init.yaml b/placement/templates/job-db-init.yaml index 31e1aec749..6edd4175ea 100644 --- a/placement/templates/job-db-init.yaml +++ b/placement/templates/job-db-init.yaml @@ -30,5 +30,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.placement.enabled -}} +{{- $_ := set $dbInitJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }} {{- end }} diff --git a/placement/templates/job-db-migrate.yaml b/placement/templates/job-db-migrate.yaml index b63ff0b70a..ef7337786c 100644 --- a/placement/templates/job-db-migrate.yaml +++ b/placement/templates/job-db-migrate.yaml @@ -39,6 +39,9 @@ spec: restartPolicy: OnFailure nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} +{{ if $envAll.Values.pod.tolerations.placement.enabled }} +{{ tuple $envAll "placement" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} +{{ end }} initContainers: {{ tuple $envAll $service list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: diff --git a/placement/templates/job-db-sync.yaml b/placement/templates/job-db-sync.yaml index be791da466..e1c59360f5 100644 --- a/placement/templates/job-db-sync.yaml +++ b/placement/templates/job-db-sync.yaml @@ -19,5 +19,8 @@ limitations under the License. {{- if .Values.manifests.certificates -}} {{- $_ := set $dbSyncJob "dbAdminTlsSecret" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal -}} {{- end -}} +{{- if .Values.pod.tolerations.placement.enabled -}} +{{- $_ := set $dbSyncJob "tolerationsEnabled" true -}} +{{- end -}} {{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }} {{- end }} diff --git a/placement/templates/job-image-repo-sync.yaml b/placement/templates/job-image-repo-sync.yaml index dd89227688..2cda817e33 100644 --- a/placement/templates/job-image-repo-sync.yaml +++ b/placement/templates/job-image-repo-sync.yaml @@ -23,5 +23,8 @@ helm.sh/hook: post-install,post-upgrade {{- if .Values.helm3_hook }} {{- $_ := set $imageRepoSyncJob "jobAnnotations" (include "metadata.annotations.job.repo_sync" . | fromYaml) }} {{- end }} +{{- if .Values.pod.tolerations.placement.enabled -}} +{{- $_ := set $imageRepoSyncJob "tolerationsEnabled" true -}} +{{- end -}} {{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }} {{- end }} diff --git a/placement/templates/job-ks-endpoints.yaml b/placement/templates/job-ks-endpoints.yaml index abd7994c8c..111ba33a40 100644 --- a/placement/templates/job-ks-endpoints.yaml +++ b/placement/templates/job-ks-endpoints.yaml @@ -27,5 +27,8 @@ helm.sh/hook-weight: "1" {{- if .Values.helm3_hook }} {{- $_ := set $ksServiceJob "jobAnnotations" (include "metadata.annotations.job.ks_endpoints" . | fromYaml) -}} {{- end }} +{{- if .Values.pod.tolerations.placement.enabled -}} +{{- $_ := set $ksServiceJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }} {{- end }} diff --git a/placement/templates/job-ks-service.yaml b/placement/templates/job-ks-service.yaml index f972aba4e3..10e45bd61e 100644 --- a/placement/templates/job-ks-service.yaml +++ b/placement/templates/job-ks-service.yaml @@ -27,5 +27,8 @@ helm.sh/hook-weight: "-2" {{- if .Values.helm3_hook }} {{- $_ := set $ksServiceJob "jobAnnotations" (include "metadata.annotations.job.ks_service" . | fromYaml) -}} {{- end }} +{{- if .Values.pod.tolerations.placement.enabled -}} +{{- $_ := set $ksServiceJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }} {{- end }} diff --git a/placement/templates/job-ks-user.yaml b/placement/templates/job-ks-user.yaml index 6670913312..2c1a00232c 100644 --- a/placement/templates/job-ks-user.yaml +++ b/placement/templates/job-ks-user.yaml @@ -27,5 +27,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.placement.enabled -}} +{{- $_ := set $ksUserJob "tolerationsEnabled" true -}} +{{- end -}} {{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }} {{- end }} diff --git a/placement/values.yaml b/placement/values.yaml index 57d9eb480a..d3bd052dcb 100644 --- a/placement/values.yaml +++ b/placement/values.yaml @@ -333,6 +333,13 @@ pod: default: preferredDuringSchedulingIgnoredDuringExecution topologyKey: default: kubernetes.io/hostname + tolerations: + placement: + enabled: false + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule mounts: placement: init_container: null diff --git a/releasenotes/notes/placement.yaml b/releasenotes/notes/placement.yaml index a32f7f4a45..35070d2aea 100644 --- a/releasenotes/notes/placement.yaml +++ b/releasenotes/notes/placement.yaml @@ -14,4 +14,5 @@ placement: - 0.2.3 Added helm.sh/hook annotations for Jobs - 0.2.4 Helm 3 - Fix Job Labels - 0.2.5 Update htk requirements repo + - 0.2.6 Enable taint toleration for Openstack services ...