[bitnami/nginx] feat: add checksum annotation for existingServerBlockConfigmap via lookup (#36470)

* feat(nginx): add checksum annotation for existingServerBlockConfigmap

When existingServerBlockConfigmap or existingStreamServerBlockConfigmap
are set, use helm lookup to read the ConfigMap from the cluster and
compute a checksum annotation on the pod template. This triggers a
rolling restart whenever the referenced ConfigMap content changes,
consistent with the behavior already provided for inline serverBlock.

Also fix a copy-paste error: the stream server block checksum condition
was checking existingServerBlockConfigmap instead of
existingStreamServerBlockConfigmap.

Note: lookup returns nil during helm template (offline dry-run), so
the annotation is silently omitted in that case. This is expected
and consistent with how lookup behaves across all Helm charts.

Signed-off-by: Andrea Pilo <apilo@cuebiq.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

---------

Signed-off-by: Andrea Pilo <apilo@cuebiq.com>
Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
Co-authored-by: Bitnami Bot <bitnami.bot@broadcom.com>
This commit is contained in:
Andrea Pilo
2026-03-04 10:02:41 +01:00
committed by GitHub
parent dd993efcda
commit d65039a51e
3 changed files with 20 additions and 3 deletions

View File

@@ -1,8 +1,13 @@
# Changelog
## 22.1.1 (2026-02-23)
* [bitnami/nginx] feat: add checksum annotation for existingServerBlockConfigmap via lookup ([#36470](https://github.com/bitnami/charts/pull/36470))
## 22.1.0 (2025-10-01)
* [bitnami/nginx] allow to change probes for metrics container ([#36296](https://github.com/bitnami/charts/pull/36296))
* [bitnami/*] Remove annotations.category (#36224) ([2abc0f9](https://github.com/bitnami/charts/commit/2abc0f9d7e89a5453e57f029c66f581b3d5855ef)), closes [#36224](https://github.com/bitnami/charts/issues/36224)
* [bitnami/nginx] allow to change probes for metrics container (#36296) ([e044aec](https://github.com/bitnami/charts/commit/e044aecf0bfede5c2a12eb0ecb920cd5ef11b82d)), closes [#36296](https://github.com/bitnami/charts/issues/36296)
## <small>21.1.23 (2025-08-18)</small>

View File

@@ -36,4 +36,4 @@ maintainers:
name: nginx
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/nginx
version: 22.1.0
version: 22.1.1

View File

@@ -36,9 +36,21 @@ spec:
{{- if and .Values.serverBlock (not .Values.existingServerBlockConfigmap) }}
checksum/server-block-configuration: {{ include (print $.Template.BasePath "/server-block-configmap.yaml") . | sha256sum }}
{{- end }}
{{- if and .Values.streamServerBlock (not .Values.existingServerBlockConfigmap) }}
{{- if .Values.existingServerBlockConfigmap }}
{{- $existingCM := lookup "v1" "ConfigMap" (include "common.names.namespace" .) .Values.existingServerBlockConfigmap }}
{{- if $existingCM }}
checksum/server-block-configuration: {{ $existingCM.data | toYaml | sha256sum }}
{{- end }}
{{- end }}
{{- if and .Values.streamServerBlock (not .Values.existingStreamServerBlockConfigmap) }}
checksum/stream-server-block-configuration: {{ include (print $.Template.BasePath "/stream-server-block-configmap.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.existingStreamServerBlockConfigmap }}
{{- $existingStreamCM := lookup "v1" "ConfigMap" (include "common.names.namespace" .) .Values.existingStreamServerBlockConfigmap }}
{{- if $existingStreamCM }}
checksum/stream-server-block-configuration: {{ $existingStreamCM.data | toYaml | sha256sum }}
{{- end }}
{{- end }}
{{- if or .Values.contextIncludes.main .Values.contextIncludes.events .Values.contextIncludes.http }}
checksum/context-includes-configuration: {{ include (print $.Template.BasePath "/context-includes-configmap.yaml") . | sha256sum }}
{{- end }}