feat(deployment)!: move affinity to deployment.affinity

Moving `affinity` into the `deployment` dict groups it with the other Deployment-specific values and prepares a
consistent structure for further migrations of pod-level settings.

A deprecation check is added so that existing installations fail fast with an actionable error message instead of
silently dropping the affinity rules, which would otherwise lead to pods being scheduled on unintended nodes.

BREAKING CHANGE: `affinity` no longer exists. Use `deployment.affinity` instead. Installations that still set
`affinity` will fail unless `checkDeprecation` is set to `false`.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-09-04 09:12:58 +02:00
co-authored by Copilot
parent 229ba12744
commit 150c08eabc
5 changed files with 58 additions and 8 deletions
+2 -2
View File
@@ -1127,10 +1127,10 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| `schedulerName` | Use an alternate scheduler, e.g. "stork" | `""` |
| `nodeSelector` | NodeSelector for the deployment | `{}` |
| `tolerations` | Tolerations for the deployment | `[]` |
| `affinity` | Affinity for the deployment | `{}` |
| `topologySpreadConstraints` | TopologySpreadConstraints for the deployment | `[]` |
| `dnsConfig` | dnsConfig for the deployment | `{}` |
| `priorityClassName` | priorityClassName for the deployment | `""` |
| `deployment.affinity` | Affinity for the deployment. | `{}` |
| `deployment.env` | Additional environment variables to pass to containers | `[]` |
| `deployment.terminationGracePeriodSeconds` | How long to wait until forcefully kill the pod | `60` |
| `deployment.labels` | Labels for the deployment | `{}` |
@@ -1151,7 +1151,7 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| `secrets.admin.new.annotations` | Annotations for the admin Secret | `{}` |
| `secrets.admin.new.labels` | Labels for the admin Secret | `{}` |
| `secrets.admin.new.email` | Email of the Gitea admin user | `gitea@local.domain` |
| `secrets.admin.new.password` | Password of the Gitea admin user | `r8sA8CPHD9!bt6d` |
| `secrets.admin.new.password` | Password of the Gitea admin user. | `r8sA8CPHD9!bt6d` |
| `secrets.admin.new.username` | Username of the Gitea admin user | `gitea_admin` |
| `secrets.config.addSHASumAnnotation` | Add a pod annotation with the SHA sum of the config Secret to trigger a rollout on change | `true` |
| `secrets.config.existingSecret.enabled` | Use an already existing Secret instead of creating the config Secret | `false` |
+1 -1
View File
@@ -426,7 +426,7 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
{{- with .Values.deployment.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
+5
View File
@@ -39,4 +39,9 @@
{{- if .Values.signing -}}
{{- fail "`signing` does no longer exist. Please refer to the changelog and configure `secrets.gpg` instead." -}}
{{- end -}}
{{/* AFFINITY */}}
{{- if .Values.affinity -}}
{{- fail "`affinity` does no longer exist. Please refer to the changelog and configure `deployment.affinity` instead." -}}
{{- end -}}
{{- end -}}
+29
View File
@@ -67,6 +67,35 @@ tests:
foo: bar
bar: foo
template: templates/gitea/deployment.yaml
- it: affinity is undefined
template: templates/gitea/deployment.yaml
asserts:
- notExists:
path: spec.template.spec.affinity
- it: affinity is defined
template: templates/gitea/deployment.yaml
set:
deployment.affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
asserts:
- equal:
path: spec.template.spec.affinity
value:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
- it: "injects TMP_EXISTING_ENVS_FILE as environment variable to 'init-app-ini' init container"
template: templates/gitea/deployment.yaml
+21 -5
View File
@@ -319,9 +319,6 @@ nodeSelector: {}
## @param tolerations Tolerations for the deployment
tolerations: []
## @param affinity Affinity for the deployment
affinity: {}
## @param topologySpreadConstraints TopologySpreadConstraints for the deployment
topologySpreadConstraints: []
@@ -331,11 +328,30 @@ dnsConfig: {}
## @param priorityClassName priorityClassName for the deployment
priorityClassName: ""
## @param deployment.env Additional environment variables to pass to containers
## @param deployment.affinity Affinity for the deployment.
## @param deployment.env Additional environment variables to pass to containers
## @param deployment.terminationGracePeriodSeconds How long to wait until forcefully kill the pod
## @param deployment.labels Labels for the deployment
## @param deployment.annotations Annotations for the Gitea deployment to be created
deployment:
affinity: {}
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: kubernetes.io/os
# operator: In
# values:
# - linux
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 20
# preference:
# matchExpressions:
# - key: kubernetes.io/arch
# operator: In
# values:
# - amd64
env: []
# - name: VARIABLE
# value: my-value
@@ -370,7 +386,7 @@ secrets:
## @param secrets.admin.new.annotations Annotations for the admin Secret
## @param secrets.admin.new.labels Labels for the admin Secret
## @param secrets.admin.new.email Email of the Gitea admin user
## @param secrets.admin.new.password Password of the Gitea admin user
## @param secrets.admin.new.password Password of the Gitea admin user.
## @param secrets.admin.new.username Username of the Gitea admin user
new:
annotations: {}