diff --git a/helm/oncall/templates/celery/deployment.yaml b/helm/oncall/templates/celery/deployment.yaml index 32b4245c43..b2498dd16b 100644 --- a/helm/oncall/templates/celery/deployment.yaml +++ b/helm/oncall/templates/celery/deployment.yaml @@ -18,6 +18,9 @@ spec: {{- end }} labels: {{- include "oncall.celery.selectorLabels" . | nindent 8 }} + {{- if .Values.celery.podLabels }} + {{- toYaml .Values.celery.podLabels | nindent 8}} + {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/helm/oncall/templates/engine/deployment.yaml b/helm/oncall/templates/engine/deployment.yaml index e94df2bad4..ccb770df63 100644 --- a/helm/oncall/templates/engine/deployment.yaml +++ b/helm/oncall/templates/engine/deployment.yaml @@ -20,6 +20,9 @@ spec: {{- end }} labels: {{- include "oncall.engine.selectorLabels" . | nindent 8 }} + {{- if .Values.engine.podLabels }} + {{- toYaml .Values.engine.podLabels | nindent 8}} + {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/helm/oncall/templates/telegram-polling/deployment.yaml b/helm/oncall/templates/telegram-polling/deployment.yaml index acf90c9762..2e448897d2 100644 --- a/helm/oncall/templates/telegram-polling/deployment.yaml +++ b/helm/oncall/templates/telegram-polling/deployment.yaml @@ -14,6 +14,9 @@ spec: metadata: labels: {{- include "oncall.telegramPolling.selectorLabels" . | nindent 8 }} + {{- if .Values.telegramPolling.podLabels }} + {{- toYaml .Values.telegramPolling.podLabels | nindent 8 }} + {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/helm/oncall/tests/podlabels_test.yaml b/helm/oncall/tests/podlabels_test.yaml new file mode 100644 index 0000000000..d19dfd80c8 --- /dev/null +++ b/helm/oncall/tests/podlabels_test.yaml @@ -0,0 +1,32 @@ +suite: test podlabels for deployments +templates: + - celery/deployment.yaml + - engine/deployment.yaml + - telegram-polling/deployment.yaml +release: + name: oncall +tests: + - it: podLabels={} -> should exclude podLabels + set: + telegramPolling: + enabled: true + asserts: + - notExists: + path: spec.template.metadata.labels.some-key + + - it: podLabels -> should use custom podLabels + set: + engine: + podLabels: + some-key: some-value + celery: + podLabels: + some-key: some-value + telegramPolling: + enabled: true + podLabels: + some-key: some-value + asserts: + - equal: + path: spec.template.metadata.labels.some-key + value: some-value diff --git a/helm/oncall/values.yaml b/helm/oncall/values.yaml index 29f715f12e..b741b1a47b 100644 --- a/helm/oncall/values.yaml +++ b/helm/oncall/values.yaml @@ -39,6 +39,9 @@ engine: # cpu: 100m # memory: 128Mi + # Labels for engine pods + podLabels: {} + ## Deployment update strategy ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy updateStrategy: @@ -198,6 +201,9 @@ celery: # cpu: 100m # memory: 128Mi + # Labels for celery pods + podLabels: {} + ## Affinity for pod assignment ## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity affinity: {} @@ -257,6 +263,9 @@ telegramPolling: # cpu: 100m # memory: 128Mi + # Labels for telegram-polling pods + podLabels: {} + # Extra volume mounts for the main container extraVolumeMounts: [] # - name: postgres-tls