From ba39daaecf7df120759fba54667975cc59fb7335 Mon Sep 17 00:00:00 2001 From: Guanzhou Song Date: Mon, 19 Oct 2026 09:05:39 -0400 Subject: [PATCH] fix: fail chart render when walReplica uses the unpublished image Signed-off-by: Guanzhou Song --- CHANGELOG.md | 5 +++++ .../templates/03_documentdb_wal_replica.yaml | 4 ++++ .../tests/03_wal_replica_test.yaml | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9f93246a..05282eb0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [Unreleased] + +### Upgrade notes +- **`walReplica: true` with the default image fails to render**: no `wal-replica` image is published, so point `image.registry` or `image.walreplica.repository` at one you built. + ## [1.0.0] - 2026-10-19 First generally available operator release, for DocumentDB 1.0. The operator and the DocumentDB engine keep separate version numbers; this chart deploys engine `1.0.0` (extension schema `1.0-0`) by default. See [Upgrading to DocumentDB 1.0](docs/operator-public-documentation/preview/operations/upgrades.md#upgrading-to-documentdb-10). diff --git a/operator/documentdb-helm-chart/templates/03_documentdb_wal_replica.yaml b/operator/documentdb-helm-chart/templates/03_documentdb_wal_replica.yaml index 326638a7e..fe1a1d47b 100644 --- a/operator/documentdb-helm-chart/templates/03_documentdb_wal_replica.yaml +++ b/operator/documentdb-helm-chart/templates/03_documentdb_wal_replica.yaml @@ -1,4 +1,8 @@ {{- if .Values.walReplica }} +{{- $walRepo := include "documentdb.imageRef" (dict "name" "image.walreplica.repository" "registry" .Values.image.registry "repo" .Values.image.walreplica.repository "tag" "") }} +{{- if eq $walRepo "ghcr.io/documentdb/documentdb-kubernetes-operator/wal-replica" }} +{{- fail "walReplica=true: no wal-replica image is published at ghcr.io/documentdb; point image.registry or image.walreplica.repository at one you built" -}} +{{- end }} apiVersion: v1 kind: Service metadata: diff --git a/operator/documentdb-helm-chart/tests/03_wal_replica_test.yaml b/operator/documentdb-helm-chart/tests/03_wal_replica_test.yaml index 93abd60f2..0990832a3 100644 --- a/operator/documentdb-helm-chart/tests/03_wal_replica_test.yaml +++ b/operator/documentdb-helm-chart/tests/03_wal_replica_test.yaml @@ -7,6 +7,10 @@ capabilities: apiVersions: - cert-manager.io/v1/Certificate +# No wal-replica image is published upstream, so the chart requires a custom one. +set: + image.registry: registry.example.com + tests: # ------------------------------------------------------------------- # Feature gate (walReplica) @@ -88,14 +92,22 @@ tests: path: spec.template.spec.containers[0].name value: cnpg-i-wal-replica - - it: should use the default wal-replica image with appVersion tag + - it: should fail when walReplica is enabled with the unpublished default image + set: + walReplica: true + image.registry: ghcr.io + asserts: + - failedTemplate: + errorPattern: "no wal-replica image is published" + + - it: should use appVersion as the tag for a custom wal-replica image set: walReplica: true documentIndex: 3 asserts: - equal: path: spec.template.spec.containers[0].image - value: "ghcr.io/documentdb/documentdb-kubernetes-operator/wal-replica:1.0.0" + value: "registry.example.com/documentdb/documentdb-kubernetes-operator/wal-replica:1.0.0" - it: should use a custom wal-replica image tag when set set: @@ -105,7 +117,7 @@ tests: asserts: - equal: path: spec.template.spec.containers[0].image - value: "ghcr.io/documentdb/documentdb-kubernetes-operator/wal-replica:v9.9.9" + value: "registry.example.com/documentdb/documentdb-kubernetes-operator/wal-replica:v9.9.9" # ------------------------------------------------------------------- # RBAC