From c79c2a7b4449520420d81f7f3783861947e20c6f Mon Sep 17 00:00:00 2001 From: wangbo Date: Tue, 4 Aug 2026 23:29:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(cluster):=20=E5=85=BC=E5=AE=B9=20CNPG=20?= =?UTF-8?q?=E5=8D=95=E5=AE=9E=E4=BE=8B=E9=A2=84=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 发布前先通过 merge patch 删除旧同步复制配置,期望清单不再写入 CRD 不接受的 null 值,确保 server-side dry-run 与正式 apply 使用相同的有效单实例状态。 --- deploy/kubernetes/easyai-ai-gateway-cluster-release | 2 +- deploy/kubernetes/production/database.yaml | 3 --- tests/release/manual-release-test.sh | 5 ++++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deploy/kubernetes/easyai-ai-gateway-cluster-release b/deploy/kubernetes/easyai-ai-gateway-cluster-release index a2c115a..59a11bf 100755 --- a/deploy/kubernetes/easyai-ai-gateway-cluster-release +++ b/deploy/kubernetes/easyai-ai-gateway-cluster-release @@ -716,7 +716,7 @@ prepare_postgres_single_instance() { local source_sha=$1 local current_instances current_primary primary_node synchronous_enabled if ! grep -Eq '^ instances: 1$' "$DESIRED_STATE_DIR/database.yaml" || - ! grep -Eq '^ synchronous: null$' "$DESIRED_STATE_DIR/database.yaml"; then + grep -Eq '^[[:space:]]+synchronous:' "$DESIRED_STATE_DIR/database.yaml"; then echo 'production PostgreSQL desired state must declare one instance with synchronous replication disabled' >&2 return 1 fi diff --git a/deploy/kubernetes/production/database.yaml b/deploy/kubernetes/production/database.yaml index d50d7e4..8c77060 100644 --- a/deploy/kubernetes/production/database.yaml +++ b/deploy/kubernetes/production/database.yaml @@ -117,9 +117,6 @@ spec: cpu: "2" memory: 3Gi postgresql: - # Keep this explicit null so server-side apply atomically removes the old - # two-instance synchronous setting during preflight field management. - synchronous: null parameters: # A 16 MiB WAL segment every 60 seconds requires at least 2.24 Mbit/s # of continuous cross-region throughput even while the database is idle. diff --git a/tests/release/manual-release-test.sh b/tests/release/manual-release-test.sh index f4bfd57..ddf062e 100755 --- a/tests/release/manual-release-test.sh +++ b/tests/release/manual-release-test.sh @@ -316,7 +316,10 @@ if grep -Fq 'archive_timeout: 60s' "$root/deploy/kubernetes/production/database. fi grep -Fq ' instances: 1' "$root/deploy/kubernetes/production/database.yaml" grep -Fq ' easyai.io/site: ningbo' "$root/deploy/kubernetes/production/database.yaml" -grep -Fq ' synchronous: null' "$root/deploy/kubernetes/production/database.yaml" +if grep -Eq '^[[:space:]]+synchronous:' "$root/deploy/kubernetes/production/database.yaml"; then + echo 'production single-instance PostgreSQL must not declare synchronous replication' >&2 + exit 1 +fi grep -Fq 'wal_sender_timeout: 30s' "$root/deploy/kubernetes/production/database.yaml" grep -Fq 'wal_receiver_timeout: 30s' "$root/deploy/kubernetes/production/database.yaml" bash -n "$root/scripts/cluster/configure-control-plane-io.sh"