fix(deployment): remove deployment.labels from selector.matchLabels (#1011)
All checks were successful
changelog / changelog (push) Successful in 19s
check-and-test / check-and-test (push) Successful in 2m5s

This PR removes the inclusion of `deployment.labels` in the Deployment's `selector.matchLabels` field.

## Changes
- Removed the conditional block that adds `deployment.labels` to `selector.matchLabels`
- This ensures the selector remains immutable and only contains pod-identifying labels

Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/1011
Reviewed-by: Markus Pesch <volker.raschek@noreply.gitea.com>
Co-authored-by: Tarun Gaba <tarun.gaba7@gmail.com>
Co-committed-by: Tarun Gaba <tarun.gaba7@gmail.com>
This commit is contained in:
Tarun Gaba
2026-01-22 21:36:10 +00:00
committed by Markus Pesch
parent 648eee9f7d
commit 0d7368c5d0
2 changed files with 16 additions and 3 deletions

View File

@@ -24,9 +24,6 @@ spec:
selector:
matchLabels:
{{- include "gitea.selectorLabels" . | nindent 6 }}
{{- if .Values.deployment.labels }}
{{- toYaml .Values.deployment.labels | nindent 6 }}
{{- end }}
template:
metadata:
annotations:

View File

@@ -29,6 +29,22 @@ tests:
path: spec.template.metadata.labels
content:
hello: world
- isNotSubset:
path: spec.selector.matchLabels
content:
hello: world
- it: deployment labels are not in selector matchLabels
template: templates/gitea/deployment.yaml
set:
deployment.labels:
custom-label: custom-value
another-label: another-value
asserts:
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/name: gitea
app.kubernetes.io/instance: gitea-unittests
- it: nodeSelector is undefined
asserts:
- notExists: