feat(deployment)!: configurable init containers and Secret checksum lookup
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>
This commit is contained in:
+17
-7
@@ -43,15 +43,25 @@ Create chart name and version as used by the chart label.
|
||||
Create image name and tag used by the deployment.
|
||||
*/}}
|
||||
{{- define "gitea.image" -}}
|
||||
{{- $fullOverride := .Values.deployment.gitea.image.fullOverride | default "" -}}
|
||||
{{- $registry := .Values.global.imageRegistry | default .Values.deployment.gitea.image.registry -}}
|
||||
{{- $repository := .Values.deployment.gitea.image.repository -}}
|
||||
{{- include "gitea.image.name" (list . .Values.deployment.gitea.image) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create image name and tag from an arbitrary `image` dict.
|
||||
Arguments: (list $root $image)
|
||||
*/}}
|
||||
{{- define "gitea.image.name" -}}
|
||||
{{- $root := index . 0 -}}
|
||||
{{- $image := index . 1 -}}
|
||||
{{- $fullOverride := $image.fullOverride | default "" -}}
|
||||
{{- $registry := $root.Values.global.imageRegistry | default $image.registry -}}
|
||||
{{- $repository := $image.repository -}}
|
||||
{{- $separator := ":" -}}
|
||||
{{- $tag := .Values.deployment.gitea.image.tag | default .Chart.AppVersion | toString -}}
|
||||
{{- $rootless := ternary "-rootless" "" (.Values.deployment.gitea.image.rootless) -}}
|
||||
{{- $tag := $image.tag | default $root.Chart.AppVersion | toString -}}
|
||||
{{- $rootless := ternary "-rootless" "" ($image.rootless) -}}
|
||||
{{- $digest := "" -}}
|
||||
{{- if .Values.deployment.gitea.image.digest }}
|
||||
{{- $digest = (printf "@%s" (.Values.deployment.gitea.image.digest | toString)) -}}
|
||||
{{- if $image.digest }}
|
||||
{{- $digest = (printf "@%s" ($image.digest | toString)) -}}
|
||||
{{- end -}}
|
||||
{{- if $fullOverride }}
|
||||
{{- printf "%s" $fullOverride -}}
|
||||
|
||||
Reference in New Issue
Block a user