Add deployment labels to deployment (#649)

Applies `deployment.labels` to the deployment itself.

Allows the user to add labels to the deployment.

None

- [X] Parameters are documented in the `values.yaml` and added to the `README.md` using [readme-generator-for-helm](https://github.com/bitnami-labs/readme-generator-for-helm)
- [X] Templating unittests are added

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/649
Reviewed-by: justusbunsi <justusbunsi@noreply.gitea.com>
Co-authored-by: Dalton Russell <dalton.russell@tangramflex.com>
Co-committed-by: Dalton Russell <dalton.russell@tangramflex.com>
(cherry picked from commit dd304c1c1ac3726924d7311a688cd68c6883ffaa)

Conflicts:
 unittests/deployment/basic.yaml
This commit is contained in:
Dalton Russell 2024-05-02 04:43:42 +00:00 committed by Michael Kriese
parent 2fb58b0314
commit d307773ff1
No known key found for this signature in database
GPG key ID: F8D7748549A5986A
2 changed files with 18 additions and 1 deletions

View file

@ -8,6 +8,9 @@ metadata:
{{- end }}
labels:
{{- include "gitea.labels" . | nindent 4 }}
{{- if .Values.deployment.labels }}
{{- toYaml .Values.deployment.labels | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
@ -397,4 +400,4 @@ spec:
{{- else if not .Values.persistence.enabled }}
- name: data
emptyDir: {}
{{- end }}
{{- end }}

View file

@ -15,3 +15,17 @@ tests:
kind: Deployment
apiVersion: apps/v1
name: forgejo-unittests
- it: deployment labels are set
template: templates/gitea/deployment.yaml
set:
deployment.labels:
hello: world
asserts:
- isSubset:
path: metadata.labels
content:
hello: world
- isSubset:
path: spec.template.metadata.labels
content:
hello: world