From 25b3fff3ebc2bd6be1776e50e777bca3aa6b9c65 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Fri, 4 Sep 2026 11:17:50 +0200 Subject: [PATCH] feat(deployment)!: move `nodeSelector` to `deployment.nodeSelector` `nodeSelector` was a top-level value although it exclusively configures the pod spec of the Gitea Deployment. With `affinity`, `dnsConfig` and the container environment already moved into the `deployment` dict, keeping `nodeSelector` at the root level leaves the scheduling configuration split across two places. Moving it into the `deployment` dict continues the consolidation of Deployment-scoped values and keeps `nodeSelector` next to the closely related `affinity` setting. The `@param` annotations are grouped with the values they document so the generated README table stays in sync with the structure. A deprecation check is added so that existing installations fail fast with an actionable error message. Without it, the node selection would be dropped silently and pods could be scheduled on nodes that do not meet the intended requirements. BREAKING CHANGE: `nodeSelector` no longer exists. Use `deployment.nodeSelector` instead. Installations that still set `nodeSelector` will fail unless `checkDeprecation` is set to `false`. Co-authored-by: Copilot --- README.md | 4 ++-- templates/gitea/deployment.yaml | 2 +- templates/gitea/deprecation.yaml | 5 +++++ unittests/helm/deployment/basic.yaml | 2 +- unittests/helm/deployment/deprecations.yaml | 9 +++++++++ values.yaml | 17 ++++++++--------- 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 0d73eb4..a1f007e 100644 --- a/README.md +++ b/README.md @@ -1125,7 +1125,6 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo | ------------------------------------------ | ---------------------------------------------------------------- | ------ | | `resources` | Kubernetes resources | `{}` | | `schedulerName` | Use an alternate scheduler, e.g. "stork" | `""` | -| `nodeSelector` | NodeSelector for the deployment | `{}` | | `tolerations` | Tolerations for the deployment | `[]` | | `topologySpreadConstraints` | TopologySpreadConstraints for the deployment | `[]` | | `priorityClassName` | priorityClassName for the deployment | `""` | @@ -1133,9 +1132,10 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo | `deployment.annotations` | Annotations for the Gitea deployment to be created | `{}` | | `deployment.labels` | Labels for the deployment | `{}` | | `deployment.affinity` | Affinity for the deployment. | `{}` | -| `deployment.terminationGracePeriodSeconds` | How long to wait until forcefully kill the pod | `60` | | `deployment.dnsConfig` | dnsConfig of the Gitea deployment. | `{}` | | `deployment.gitea.env` | Additional environment variables to pass to the Gitea container. | `[]` | +| `deployment.nodeSelector` | NodeSelector for the deployment | `{}` | +| `deployment.terminationGracePeriodSeconds` | How long to wait until forcefully kill the pod | `60` | ### Secret diff --git a/templates/gitea/deployment.yaml b/templates/gitea/deployment.yaml index e8dfedd..6926159 100644 --- a/templates/gitea/deployment.yaml +++ b/templates/gitea/deployment.yaml @@ -423,7 +423,7 @@ spec: hostAliases: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.nodeSelector }} + {{- with .Values.deployment.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/templates/gitea/deprecation.yaml b/templates/gitea/deprecation.yaml index 00eaf95..6fcc647 100644 --- a/templates/gitea/deprecation.yaml +++ b/templates/gitea/deprecation.yaml @@ -54,4 +54,9 @@ {{- if .Values.dnsConfig -}} {{- fail "`dnsConfig` does no longer exist. Please refer to the changelog and configure `deployment.dnsConfig` instead." -}} {{- end -}} + + {{/* NODE SELECTOR */}} + {{- if .Values.nodeSelector -}} + {{- fail "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead." -}} + {{- end -}} {{- end -}} diff --git a/unittests/helm/deployment/basic.yaml b/unittests/helm/deployment/basic.yaml index 65eb376..6ceed48 100644 --- a/unittests/helm/deployment/basic.yaml +++ b/unittests/helm/deployment/basic.yaml @@ -64,7 +64,7 @@ tests: template: templates/gitea/deployment.yaml - it: nodeSelector is defined set: - nodeSelector: + deployment.nodeSelector: foo: bar bar: foo asserts: diff --git a/unittests/helm/deployment/deprecations.yaml b/unittests/helm/deployment/deprecations.yaml index b8b00ae..dedcb4d 100644 --- a/unittests/helm/deployment/deprecations.yaml +++ b/unittests/helm/deployment/deprecations.yaml @@ -39,6 +39,13 @@ tests: asserts: - failedTemplate: errorMessage: "`dnsConfig` does no longer exist. Please refer to the changelog and configure `deployment.dnsConfig` instead." + - it: fails when the removed `nodeSelector` value is set + set: + nodeSelector: + foo: bar + asserts: + - failedTemplate: + errorMessage: "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead." - it: skips the deprecation checks when `checkDeprecation` is disabled set: checkDeprecation: false @@ -50,6 +57,8 @@ tests: dnsConfig: nameservers: - 192.0.2.1 + nodeSelector: + foo: bar asserts: - hasDocuments: count: 0 diff --git a/values.yaml b/values.yaml index fb5349a..f4bc763 100644 --- a/values.yaml +++ b/values.yaml @@ -313,9 +313,6 @@ resources: {} ## @param schedulerName Use an alternate scheduler, e.g. "stork" schedulerName: "" -## @param nodeSelector NodeSelector for the deployment -nodeSelector: {} - ## @param tolerations Tolerations for the deployment tolerations: [] @@ -325,17 +322,15 @@ topologySpreadConstraints: [] ## @param priorityClassName priorityClassName for the deployment priorityClassName: "" -## @param deployment.enabled Enable the deployment of Gitea. -## @param deployment.annotations Annotations for the Gitea deployment to be created -## @param deployment.labels Labels for the deployment -## @param deployment.affinity Affinity for the deployment. -## @param deployment.terminationGracePeriodSeconds How long to wait until forcefully kill the pod - deployment: + ## @param deployment.enabled Enable the deployment of Gitea. + ## @param deployment.annotations Annotations for the Gitea deployment to be created + ## @param deployment.labels Labels for the deployment enabled: true annotations: {} labels: {} + ## @param deployment.affinity Affinity for the deployment. affinity: {} # nodeAffinity: # requiredDuringSchedulingIgnoredDuringExecution: @@ -372,6 +367,10 @@ deployment: # - name: VARIABLE # value: my-value + ## @param deployment.nodeSelector NodeSelector for the deployment + nodeSelector: {} + + ## @param deployment.terminationGracePeriodSeconds How long to wait until forcefully kill the pod terminationGracePeriodSeconds: 60