Skip to content

Commit

Permalink
add podLabels to helm (#3167)
Browse files Browse the repository at this point in the history
# What this PR does
Add option to add additional pod labels.

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
- [x] It is manually tested in the internal environment

---------

Co-authored-by: Marius Ensrud <[email protected]>
Co-authored-by: Joey Orlando <[email protected]>
Co-authored-by: Joey Orlando <[email protected]>
Co-authored-by: Ildar Iskhakov <[email protected]>
  • Loading branch information
5 people authored Nov 17, 2023
1 parent 609da80 commit 719765a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
3 changes: 3 additions & 0 deletions helm/oncall/templates/celery/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions helm/oncall/templates/engine/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions helm/oncall/templates/telegram-polling/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
32 changes: 32 additions & 0 deletions helm/oncall/tests/podlabels_test.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions helm/oncall/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: {}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 719765a

Please sign in to comment.