From a0da31f745c44c374b4b63fb7b82756db5b7daf7 Mon Sep 17 00:00:00 2001 From: pikilisaikiran <96593012+pikilisaikiran@users.noreply.github.com> Date: Fri, 9 Jun 2023 02:23:11 +0530 Subject: [PATCH] Added nodeSelector for celery deployment and migrate job (#1085) # What this PR does Adds nodeSelector for celery deployment and migrate job ## Which issue(s) this PR fixes Fixes errors while deploying resources in a cluster with Gatekeeper policy ( that restricts deployments without nodeSelector). ## Checklist - [x] Tests updated - [x] Documentation added - [x] `CHANGELOG.md` updated --------- Co-authored-by: Joey Orlando Co-authored-by: Joey Orlando --- helm/oncall/templates/celery/_deployment.tpl | 4 ++++ helm/oncall/templates/engine/job-migrate.yaml | 4 ++++ helm/oncall/values.yaml | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/helm/oncall/templates/celery/_deployment.tpl b/helm/oncall/templates/celery/_deployment.tpl index 4e09cb30..92d530ab 100644 --- a/helm/oncall/templates/celery/_deployment.tpl +++ b/helm/oncall/templates/celery/_deployment.tpl @@ -34,6 +34,10 @@ spec: {{- if eq .Values.database.type "postgresql" }} {{- include "oncall.postgresql.wait-for-db" . | indent 8 }} {{- end }} + {{- with .Values.celery.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }} securityContext: diff --git a/helm/oncall/templates/engine/job-migrate.yaml b/helm/oncall/templates/engine/job-migrate.yaml index acf7fb2e..8010905c 100644 --- a/helm/oncall/templates/engine/job-migrate.yaml +++ b/helm/oncall/templates/engine/job-migrate.yaml @@ -35,6 +35,10 @@ spec: serviceAccountName: {{ include "oncall.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- with .Values.migrate.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }}-migrate securityContext: diff --git a/helm/oncall/values.yaml b/helm/oncall/values.yaml index fa97f014..2616a89c 100644 --- a/helm/oncall/values.yaml +++ b/helm/oncall/values.yaml @@ -67,6 +67,9 @@ celery: initialDelaySeconds: 30 periodSeconds: 300 timeoutSeconds: 10 + ## Node labels for pod assignment + ## ref: https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} resources: {} # limits: # cpu: 100m @@ -161,6 +164,9 @@ oncall: # Whether to run django database migrations automatically migrate: enabled: true + ## Node labels for pod assignment + ## ref: https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} # TTL can be unset by setting ttlSecondsAfterFinished: "" ttlSecondsAfterFinished: 20 # use a helm hook to manage the migration job