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:
@@ -1122,7 +1122,7 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
|
|||||||
### deployment
|
### deployment
|
||||||
|
|
||||||
| Name | Description | Value |
|
| Name | Description | Value |
|
||||||
| ------------------------------------------ | ------------------------------------------------------ | ----- |
|
| ------------------------------------------ | ---------------------------------------------------------------- | ------ |
|
||||||
| `resources` | Kubernetes resources | `{}` |
|
| `resources` | Kubernetes resources | `{}` |
|
||||||
| `schedulerName` | Use an alternate scheduler, e.g. "stork" | `""` |
|
| `schedulerName` | Use an alternate scheduler, e.g. "stork" | `""` |
|
||||||
| `nodeSelector` | NodeSelector for the deployment | `{}` |
|
| `nodeSelector` | NodeSelector for the deployment | `{}` |
|
||||||
@@ -1130,11 +1130,12 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
|
|||||||
| `topologySpreadConstraints` | TopologySpreadConstraints for the deployment | `[]` |
|
| `topologySpreadConstraints` | TopologySpreadConstraints for the deployment | `[]` |
|
||||||
| `dnsConfig` | dnsConfig for the deployment | `{}` |
|
| `dnsConfig` | dnsConfig for the deployment | `{}` |
|
||||||
| `priorityClassName` | priorityClassName for the deployment | `""` |
|
| `priorityClassName` | priorityClassName for the deployment | `""` |
|
||||||
| `deployment.affinity` | Affinity for the deployment. | `{}` |
|
| `deployment.enabled` | Enable the deployment of Gitea. | `true` |
|
||||||
| `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 | `{}` |
|
|
||||||
| `deployment.annotations` | Annotations for the Gitea deployment to be created | `{}` |
|
| `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.gitea.env` | Additional environment variables to pass to the Gitea container. | `[]` |
|
||||||
|
|
||||||
### Secret
|
### Secret
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{{- if .Values.deployment.enabled -}}
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@@ -100,8 +101,8 @@ spec:
|
|||||||
value: /data
|
value: /data
|
||||||
- name: GITEA_TEMP
|
- name: GITEA_TEMP
|
||||||
value: /tmp/gitea
|
value: /tmp/gitea
|
||||||
{{- if .Values.deployment.env }}
|
{{- if .Values.deployment.gitea.env }}
|
||||||
{{- toYaml .Values.deployment.env | nindent 12 }}
|
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.secrets.gpg.enabled }}
|
{{- if .Values.secrets.gpg.enabled }}
|
||||||
- name: GNUPGHOME
|
- name: GNUPGHOME
|
||||||
@@ -153,8 +154,8 @@ spec:
|
|||||||
value: /tmp/existing-envs
|
value: /tmp/existing-envs
|
||||||
- name: ENV_TO_INI_MOUNT_POINT
|
- name: ENV_TO_INI_MOUNT_POINT
|
||||||
value: /env-to-ini-mounts
|
value: /env-to-ini-mounts
|
||||||
{{- if .Values.deployment.env }}
|
{{- if .Values.deployment.gitea.env }}
|
||||||
{{- toYaml .Values.deployment.env | nindent 12 }}
|
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.gitea.additionalConfigFromEnvs }}
|
{{- if .Values.gitea.additionalConfigFromEnvs }}
|
||||||
{{- tpl (toYaml .Values.gitea.additionalConfigFromEnvs) $ | nindent 12 }}
|
{{- tpl (toYaml .Values.gitea.additionalConfigFromEnvs) $ | nindent 12 }}
|
||||||
@@ -311,8 +312,8 @@ spec:
|
|||||||
- name: GITEA_ADMIN_PASSWORD_MODE
|
- name: GITEA_ADMIN_PASSWORD_MODE
|
||||||
value: {{ include "gitea.secret.admin.passwordMode" $ }}
|
value: {{ include "gitea.secret.admin.passwordMode" $ }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.deployment.env }}
|
{{- if .Values.deployment.gitea.env }}
|
||||||
{{- toYaml .Values.deployment.env | nindent 12 }}
|
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: init
|
- name: init
|
||||||
@@ -373,8 +374,8 @@ spec:
|
|||||||
name: {{ include "gitea.secret.gpg.name" . }}
|
name: {{ include "gitea.secret.gpg.name" . }}
|
||||||
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.deployment.env }}
|
{{- if .Values.deployment.gitea.env }}
|
||||||
{{- toYaml .Values.deployment.env | nindent 12 }}
|
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
ports:
|
ports:
|
||||||
- name: ssh
|
- name: ssh
|
||||||
@@ -482,3 +483,4 @@ spec:
|
|||||||
- name: data
|
- name: data
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|||||||
@@ -44,4 +44,9 @@
|
|||||||
{{- if .Values.affinity -}}
|
{{- if .Values.affinity -}}
|
||||||
{{- fail "`affinity` does no longer exist. Please refer to the changelog and configure `deployment.affinity` instead." -}}
|
{{- fail "`affinity` does no longer exist. Please refer to the changelog and configure `deployment.affinity` instead." -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* DEPLOYMENT ENV */}}
|
||||||
|
{{- if .Values.deployment.env -}}
|
||||||
|
{{- fail "`deployment.env` does no longer exist. Please refer to the changelog and configure `deployment.gitea.env` instead." -}}
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ tests:
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
name: gitea-unittests
|
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
|
- it: deployment labels are set
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/gitea/deployment.yaml
|
||||||
set:
|
set:
|
||||||
@@ -113,6 +120,33 @@ tests:
|
|||||||
content:
|
content:
|
||||||
name: ENV_TO_INI_MOUNT_POINT
|
name: ENV_TO_INI_MOUNT_POINT
|
||||||
value: /env-to-ini-mounts
|
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
|
- it: CPU resources are defined as well as GOMAXPROCS
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/gitea/deployment.yaml
|
||||||
set:
|
set:
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
suite: deprecation template (deployment)
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
templates:
|
||||||
|
- templates/gitea/deprecation.yaml
|
||||||
|
tests:
|
||||||
|
- it: renders nothing with the default values
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
- it: fails when the removed `affinity` value is set
|
||||||
|
set:
|
||||||
|
affinity:
|
||||||
|
nodeAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
nodeSelectorTerms:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: kubernetes.io/os
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- linux
|
||||||
|
asserts:
|
||||||
|
- failedTemplate:
|
||||||
|
errorMessage: "`affinity` does no longer exist. Please refer to the changelog and configure `deployment.affinity` instead."
|
||||||
|
- it: fails when the removed `deployment.env` value is set
|
||||||
|
set:
|
||||||
|
deployment.env:
|
||||||
|
- name: VARIABLE
|
||||||
|
value: my-value
|
||||||
|
asserts:
|
||||||
|
- failedTemplate:
|
||||||
|
errorMessage: "`deployment.env` does no longer exist. Please refer to the changelog and configure `deployment.gitea.env` instead."
|
||||||
|
- it: skips the deprecation checks when `checkDeprecation` is disabled
|
||||||
|
set:
|
||||||
|
checkDeprecation: false
|
||||||
|
affinity:
|
||||||
|
nodeAffinity: {}
|
||||||
|
deployment.env:
|
||||||
|
- name: VARIABLE
|
||||||
|
value: my-value
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
+14
-6
@@ -328,12 +328,17 @@ dnsConfig: {}
|
|||||||
## @param priorityClassName priorityClassName for the deployment
|
## @param priorityClassName priorityClassName for the deployment
|
||||||
priorityClassName: ""
|
priorityClassName: ""
|
||||||
|
|
||||||
## @param deployment.affinity Affinity for the deployment.
|
## @param deployment.enabled Enable the deployment of Gitea.
|
||||||
## @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
|
## @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:
|
deployment:
|
||||||
|
enabled: true
|
||||||
|
annotations: {}
|
||||||
|
labels: {}
|
||||||
|
|
||||||
affinity: {}
|
affinity: {}
|
||||||
# nodeAffinity:
|
# nodeAffinity:
|
||||||
# requiredDuringSchedulingIgnoredDuringExecution:
|
# requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
@@ -352,12 +357,15 @@ deployment:
|
|||||||
# values:
|
# values:
|
||||||
# - amd64
|
# - amd64
|
||||||
|
|
||||||
|
|
||||||
|
gitea:
|
||||||
|
## @param deployment.gitea.env Additional environment variables to pass to the gitea container.
|
||||||
env: []
|
env: []
|
||||||
# - name: VARIABLE
|
# - name: VARIABLE
|
||||||
# value: my-value
|
# value: my-value
|
||||||
|
|
||||||
terminationGracePeriodSeconds: 60
|
terminationGracePeriodSeconds: 60
|
||||||
labels: {}
|
|
||||||
annotations: {}
|
|
||||||
|
|
||||||
## @section Secret
|
## @section Secret
|
||||||
secrets:
|
secrets:
|
||||||
|
|||||||
Reference in New Issue
Block a user