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>
141 lines
5.2 KiB
YAML
141 lines
5.2 KiB
YAML
suite: deployment template (image configuration)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
chart:
|
|
# Override appVersion to be consistent with used digest :)
|
|
appVersion: 1.19.3
|
|
templates:
|
|
- templates/gitea/deployment.yaml
|
|
- templates/gitea/secret_admin.yaml
|
|
- templates/gitea/secret_config.yaml
|
|
- templates/gitea/secret_gpg.yaml
|
|
- templates/gitea/secret_init.yaml
|
|
- templates/gitea/secret_inlineConfig.yaml
|
|
- templates/gitea/secret_metrics.yaml
|
|
tests:
|
|
- it: default values
|
|
template: templates/gitea/deployment.yaml
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "docker.gitea.com/gitea:1.19.3-rootless"
|
|
- it: tag override
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
deployment.gitea.image.tag: "1.19.4"
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "docker.gitea.com/gitea:1.19.4-rootless"
|
|
- it: root-based image
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
deployment.gitea.image.rootless: false
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "docker.gitea.com/gitea:1.19.3"
|
|
- it: scoped registry
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
deployment.gitea.image.registry: "example.com"
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "example.com/gitea:1.19.3-rootless"
|
|
- it: global registry
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
global.imageRegistry: "global.example.com"
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "global.example.com/gitea:1.19.3-rootless"
|
|
- it: digest for rootless image
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
deployment:
|
|
gitea:
|
|
image:
|
|
rootless: true
|
|
digest: sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "docker.gitea.com/gitea:1.19.3-rootless@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
|
- it: image fullOverride (does not append rootless)
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
deployment:
|
|
gitea:
|
|
image:
|
|
fullOverride: docker.gitea.com/gitea:1.19.3
|
|
# setting rootless, registry, repository, tag, and digest to prove that override works
|
|
rootless: true
|
|
registry: example.com
|
|
repository: example/image
|
|
tag: "1.0.0"
|
|
digest: sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "docker.gitea.com/gitea:1.19.3"
|
|
- it: digest for root-based image
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
deployment:
|
|
gitea:
|
|
image:
|
|
rootless: false
|
|
digest: sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "docker.gitea.com/gitea:1.19.3@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
|
- it: digest and global registry
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
global.imageRegistry: "global.example.com"
|
|
deployment.gitea.image.digest: "sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "global.example.com/gitea:1.19.3-rootless@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
|
- it: correctly renders floating tag references
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
# use non-quoted values on purpose. See: https://gitea.com/gitea/helm-gitea/issues/631
|
|
deployment.gitea.image.tag: 1.21
|
|
deployment.initDirectories.image.tag: 1.21
|
|
deployment.initAppIni.image.tag: 1.21
|
|
deployment.initConfigureGitea.image.tag: 1.21
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].image
|
|
value: "docker.gitea.com/gitea:1.21-rootless"
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].image
|
|
value: "docker.gitea.com/gitea:1.21-rootless"
|
|
- equal:
|
|
path: spec.template.spec.initContainers[2].image
|
|
value: "docker.gitea.com/gitea:1.21-rootless"
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "docker.gitea.com/gitea:1.21-rootless"
|
|
- it: init containers use their own image configuration
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
deployment.initDirectories.image.registry: "init.example.com"
|
|
deployment.initDirectories.image.tag: "1.19.4"
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].image
|
|
value: "init.example.com/gitea:1.19.4-rootless"
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].image
|
|
value: "docker.gitea.com/gitea:1.19.3-rootless"
|
|
- equal:
|
|
path: spec.template.spec.containers[0].image
|
|
value: "docker.gitea.com/gitea:1.19.3-rootless"
|