feat(deployment)!: move deployment.env to deployment.gitea.env and add deployment.enabled

The `deployment` dict mixes values that apply to the Deployment object itself (`annotations`, `labels`,
`affinity`, `terminationGracePeriodSeconds`) with values that apply to a single container. `deployment.env` was
the only container-scoped key, which made it unclear which container it targets once further containers get
their own configuration.

Grouping container-scoped values under `deployment.gitea` establishes a per-container namespace and leaves room
for sibling sections without another breaking rename later. The value ordering in `values.yaml` is aligned with
the chart conventions (`enabled`, `annotations`, `labels` first).

`deployment.enabled` is introduced and wired up in the template so the Deployment can be skipped entirely. This
allows the chart to be used for rendering only the surrounding resources, e.g. when the workload itself is
managed elsewhere.

A deprecation check is added so that existing installations fail fast with an actionable error message instead
of silently dropping their environment variables, which would otherwise surface as hard-to-debug runtime
misconfiguration.

Unit tests cover the disabled Deployment, the propagation of `deployment.gitea.env` into all init containers and
the Gitea container, and the deprecation checks for `affinity` and `deployment.env`.

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

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-09-04 11:05:29 +02:00
co-authored by Copilot
parent 150c08eabc
commit 55964679ea
6 changed files with 125 additions and 31 deletions
+34
View File
@@ -20,6 +20,13 @@ tests:
kind: Deployment
apiVersion: apps/v1
name: gitea-unittests
- it: renders no deployment when disabled
template: templates/gitea/deployment.yaml
set:
deployment.enabled: false
asserts:
- hasDocuments:
count: 0
- it: deployment labels are set
template: templates/gitea/deployment.yaml
set:
@@ -113,6 +120,33 @@ tests:
content:
name: ENV_TO_INI_MOUNT_POINT
value: /env-to-ini-mounts
- it: "deployment.gitea.env is injected into all init containers and the gitea container"
template: templates/gitea/deployment.yaml
set:
deployment.gitea.env:
- name: VARIABLE
value: my-value
asserts:
- contains:
path: spec.template.spec.initContainers[0].env
content:
name: VARIABLE
value: my-value
- contains:
path: spec.template.spec.initContainers[1].env
content:
name: VARIABLE
value: my-value
- contains:
path: spec.template.spec.initContainers[2].env
content:
name: VARIABLE
value: my-value
- contains:
path: spec.template.spec.containers[0].env
content:
name: VARIABLE
value: my-value
- it: CPU resources are defined as well as GOMAXPROCS
template: templates/gitea/deployment.yaml
set: