add podLabels to helm (#3167)

# 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 <marius.ensrud@skatteetaten.no>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
This commit is contained in:
m4r1u2 2023-11-17 03:31:27 +01:00 committed by GitHub
parent 609da8044e
commit 719765a72d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 0 deletions

View file

@ -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:

View file

@ -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:

View file

@ -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:

View file

@ -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

View file

@ -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