The chart-managed init containers were hardcoded inside `deployment.yaml`. Their image, environment, resources, security context and volume mounts could not be adjusted individually, and custom init containers could only be prepended or appended as a whole via `preExtraInitContainers`/`postExtraInitContainers`. The init containers are now rendered from `deployment.initContainers`, an ordered list whose entries either `link` a chart-managed init container (`initDirectories`, `initAppIni`, `initConfigureGPG`, `initConfigureGitea`) or provide a free-form `container` definition. This allows custom containers at any position and makes the execution order explicit. Each linked init container has its own configuration block in `values.yaml` and falls back to `deployment.gitea.securityContext` and `initContainers.resources` when unset. To support per-container images, `gitea.image` was split into the generic helper `gitea.image.name`, which renders an arbitrary `image` dict instead of only `deployment.gitea.image`. The pod annotations moved from `deployment.yaml` into the new helper `gitea.pod.annotations`. The SHA sum annotations now also cover user-provided Secrets: their content is unknown to the chart, so the Secret is read from the cluster via Helm's `lookup` function. Chart-managed Secrets keep using the rendered manifest, because the cluster still holds their pre-upgrade state during rendering. Because `lookup` requires `get` permission on Secrets and silently returns nothing during client-side rendering (`helm template`, `--dry-run`, Argo CD without a live cluster), `addSHASumAnnotation` now defaults to `false`. The trade-offs are documented in the README so users can make an informed decision. BREAKING CHANGE: `preExtraInitContainers` and `postExtraInitContainers` have been removed. Add an entry with a `container` key before or after the linked init containers in `deployment.initContainers` instead. BREAKING CHANGE: `secrets.<secret>.addSHASumAnnotation` now defaults to `false`. Set it to `true` explicitly to keep the rollout trigger on Secret changes. Co-authored-by: Copilot <copilot@github.com>
203 lines
7.5 KiB
YAML
203 lines
7.5 KiB
YAML
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 `containerSecurityContext` value is set
|
|
set:
|
|
containerSecurityContext:
|
|
runAsUser: 1000
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`containerSecurityContext` does no longer exist. Please refer to the changelog and configure `deployment.gitea.securityContext` 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: fails when the removed `dnsConfig` value is set
|
|
set:
|
|
dnsConfig:
|
|
nameservers:
|
|
- 192.0.2.1
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`dnsConfig` does no longer exist. Please refer to the changelog and configure `deployment.dnsConfig` instead."
|
|
- it: fails when the removed `extraContainerVolumeMounts` value is set
|
|
set:
|
|
extraContainerVolumeMounts:
|
|
- name: postgres-ssl-vol
|
|
mountPath: /pg-ssl
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`extraContainerVolumeMounts` does no longer exist. Please refer to the changelog and configure `deployment.gitea.volumeMounts` instead."
|
|
- it: fails when the removed `extraVolumes` value is set
|
|
set:
|
|
extraVolumes:
|
|
- name: postgres-ssl-vol
|
|
secret:
|
|
secretName: gitea-postgres-ssl
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`extraVolumes` does no longer exist. Please refer to the changelog and configure `deployment.volumes` 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: fails when the removed `priorityClassName` value is set
|
|
set:
|
|
priorityClassName: high-priority
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`priorityClassName` does no longer exist. Please refer to the changelog and configure `deployment.priorityClassName` instead."
|
|
- it: fails when the removed `podSecurityContext` value is set
|
|
set:
|
|
podSecurityContext:
|
|
fsGroup: 1000
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`podSecurityContext` does no longer exist. Please refer to the changelog and configure `deployment.securityContext` instead."
|
|
- it: fails when the removed `postExtraInitContainers` value is set
|
|
set:
|
|
postExtraInitContainers:
|
|
- name: post-init-container
|
|
image: docker.io/library/busybox
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`postExtraInitContainers` does no longer exist. Please refer to the changelog and append an entry with a `container` key to `deployment.initContainers` instead."
|
|
- it: fails when the removed `preExtraInitContainers` value is set
|
|
set:
|
|
preExtraInitContainers:
|
|
- name: pre-init-container
|
|
image: docker.io/library/busybox
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`preExtraInitContainers` does no longer exist. Please refer to the changelog and prepend an entry with a `container` key to `deployment.initContainers` instead."
|
|
- it: fails when the removed `resources` value is set
|
|
set:
|
|
resources:
|
|
limits:
|
|
cpu: 100m
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`resources` does no longer exist. Please refer to the changelog and configure `deployment.gitea.resources` instead."
|
|
- it: fails when the removed `replicaCount` value is set
|
|
set:
|
|
replicaCount: 2
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`replicaCount` does no longer exist. Please refer to the changelog and configure `deployment.replicas` instead."
|
|
- it: fails when the removed `schedulerName` value is set
|
|
set:
|
|
schedulerName: stork
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`schedulerName` does no longer exist. Please refer to the changelog and configure `deployment.schedulerName` instead."
|
|
- it: fails when the removed `securityContext` value is set
|
|
set:
|
|
securityContext:
|
|
runAsUser: 1000
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`securityContext` does no longer exist. Please refer to the changelog and configure `deployment.securityContext` and `deployment.gitea.securityContext` instead."
|
|
- it: fails when the removed `strategy` value is set
|
|
set:
|
|
strategy:
|
|
type: Recreate
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`strategy` does no longer exist. Please refer to the changelog and configure `deployment.strategy` instead."
|
|
- it: fails when the removed `tolerations` value is set
|
|
set:
|
|
tolerations:
|
|
- key: database/type
|
|
operator: Equal
|
|
value: postgres
|
|
effect: NoSchedule
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`tolerations` does no longer exist. Please refer to the changelog and configure `deployment.tolerations` instead."
|
|
- it: fails when the removed `topologySpreadConstraints` value is set
|
|
set:
|
|
topologySpreadConstraints:
|
|
- topologyKey: kubernetes.io/hostname
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "`topologySpreadConstraints` does no longer exist. Please refer to the changelog and configure `deployment.topologySpreadConstraints` instead."
|
|
- it: skips the deprecation checks when `checkDeprecation` is disabled
|
|
set:
|
|
checkDeprecation: false
|
|
affinity:
|
|
nodeAffinity: {}
|
|
containerSecurityContext:
|
|
runAsUser: 1000
|
|
deployment.env:
|
|
- name: VARIABLE
|
|
value: my-value
|
|
dnsConfig:
|
|
nameservers:
|
|
- 192.0.2.1
|
|
extraContainerVolumeMounts:
|
|
- name: postgres-ssl-vol
|
|
mountPath: /pg-ssl
|
|
extraVolumes:
|
|
- name: postgres-ssl-vol
|
|
secret:
|
|
secretName: gitea-postgres-ssl
|
|
nodeSelector:
|
|
foo: bar
|
|
podSecurityContext:
|
|
fsGroup: 1000
|
|
postExtraInitContainers:
|
|
- name: post-init-container
|
|
image: docker.io/library/busybox
|
|
preExtraInitContainers:
|
|
- name: pre-init-container
|
|
image: docker.io/library/busybox
|
|
priorityClassName: high-priority
|
|
replicaCount: 2
|
|
resources:
|
|
limits:
|
|
cpu: 100m
|
|
schedulerName: stork
|
|
securityContext:
|
|
runAsUser: 1000
|
|
strategy:
|
|
type: Recreate
|
|
tolerations:
|
|
- key: database/type
|
|
operator: Equal
|
|
value: postgres
|
|
effect: NoSchedule
|
|
topologySpreadConstraints:
|
|
- topologyKey: kubernetes.io/hostname
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|