Repository navigation
chore(deps): PostgreSQL 18 for CloudNativePG clusters, copied first - #217
Yoshiofthewire wants to merge 5 commits into
Conversation
A Cluster an earlier release made runs PostgreSQL 17. The new step kyidentity.database-upgrade (before deploy) moves it as the owner decided on 2026-11-25: - create a pre-upgrade-pg17-<claim> copy claim for every claim the Cluster owns (a refused claim stops nothing); - hibernate the Cluster, copy and verify each claim as uid 26, one pod per instance, with the existing claim copier; - one patch sets the 18.7-minimal-trixie image and wakes the Cluster, so CloudNativePG runs its in-place pg_upgrade --link; - wait until it is healthy, then vacuumdb --analyze-only --missing-stats-only. A failed copy, or an operator that refuses the image, wakes the Cluster on 17 unchanged. An upgrade still on 17 data after the timeout gets the 17 image back, which is CloudNativePG's documented rollback. Deploy refuses any major change by itself. Copies are never deleted, and a same-named copy of another Cluster is refused. Fresh Clusters start on 18. docs/guided-setup.md documents going back to 17 from the primary's copy; the new e2e shard kube-cluster-upgrade runs it on kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process: ⏱️ Estimated effort to review: 5 🔵🔵🔵🔵🔵🧪 PR contains tests⚡ No major issues detectedAdvisory only: this comment never gates the pull request. |
Security review - clearedDetail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kyquickstart-217, where it is readable by the operator and expires seven days after the last post. gpt-6.1-sol using security-audit on behalf of Yoshi |
Autonomous review - 1/1 personas cleared
Merging remains a human decision; this bot never approves. gpt-6.1-sol using security-audit on behalf of Yoshi |
The image switch carried the resourceVersion read before the copy, and the operator writes the Cluster's status in the meantime, so a real API server refused it (CI e2e kube-cluster-upgrade, run 45719982937). Cluster patches now carry no resourceVersion; the switch re-reads the Cluster first, and both the switch and the wake name its uid. Anything that fails once the hibernation is requested (its answer lost included) wakes the Cluster in one patch on its old image. Each attempt makes its own timestamped copies; none is replaced or deleted. Each instance's copy pod starts once on its node before hibernating, so storage that cannot provide the copies is refused while sign-in still works, naming the earlier copies that take space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…topped PR Reviewer Guide at 949e81a: - An image switch that landed with its answer lost had already woken the Cluster, and the deferred wake set 17 back while CloudNativePG might be upgrading. Re-read it: with the new image set, leave it to the wait (whose rollback checks the data major first); if it cannot be read, report how to check and write nothing. - Copies took instance-role from the claims listed before the storage check, so a failover before the stop labelled a stale standby primary. Re-list the claims once the instances are gone, refuse a changed set, and record the roles as stopped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire Both Guide findings at 949e81a are fixed in 0bf19ae; each has a test that fails without the fix.
The earlier "Stale resourceVersion" finding (c1c9811) was fixed in 147c997: Cluster patches carry no resourceVersion. The switch re-reads the Cluster, and the switch and the wake carry |
PR Reviewer Guide at 0bf19ae: with walStorage, pgdata/pg_wal is a link to CloudNativePG's WAL mount, which the copy pod does not mount, so the copy's diff -r cannot verify it and every upgrade would stop sign-in, then wake on 17. The installer's Cluster spec never sets walStorage, so a WAL claim is refused like a tablespace's: before the claims are made or the Cluster is stopped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire WAL Copies (0bf19ae): fixed in c728a71 by refusing such Clusters, not by copying them.
I did not make |
In one line: An existing highly available KyIdentity database (a CloudNativePG
Clusteron PostgreSQL 17) moves to 18 on the nextapply. Every instance's claim is copied and verified first, and the copies are never deleted or replaced. If anything fails once the Cluster is stopped, it starts again on 17. Fresh Clusters start on 18.What changed
kyidentity.database-upgraderuns before deploy:pre-upgrade-pg17-<claim>-<UTC yyyymmdd-hhmmss>copy claim per Cluster data claim. Every attempt makes its own set. A separate WAL or tablespace claim, which the installer never makes, refuses before anything stops.postgresql:18.7-minimal-trixie@sha256:c8caac98…88ccand wakes it, so CloudNativePG runspg_upgrade --link.vacuumdb --analyze-only --missing-stats-only.resourceVersion. The operator writes the Cluster's status all the time, so the old image switch was refused with "the object has been modified". The switch and the wake carry the Cluster'smetadata.uidinstead, so the API server refuses them on a Cluster recreated since.walStorage,pgdata/pg_walis a link to a mount the copy pod lacks, so verification could never pass. The installer's Cluster spec sets nowalStorage, so such a claim is now refused up front instead of stopping sign-in for a copy that must fail.instance-rolecomes from that list. A failover during the storage check can no longer label a stale standby "primary" for the rollback. An upgrade still on 17 data after 15 min gets the 17 image back, which is CloudNativePG's documented rollback.kubectl delete pvccommand.applyClusterrefuses any major change by itself. Docs: "PostgreSQL 17 to 18" and "Going back to PostgreSQL 17" indocs/guided-setup.md. The plan gains list onpersistentvolumeclaims. New e2e shardkube-cluster-upgrade.Review this
copyAndSwitch: the storage check, the hibernation and the wake-on-17 defer. The defer is registered before the hibernation. A mistake here leaves sign-in down, or upgrades without a copy.docs/guided-setup.md: step 3 deletes the 18 Cluster and its claims. The e2e runs it.warnings/pinToextraction inpreupgrade.go(no behaviour change), and the test index shifts.Checked (at
c728a71, which containschore/postgres-1802e5c57)make ciexit 0 on k81 at c728a71: notes, tidy, gofmt, vet including e2e tags, andgo test -race ./.... It also passed at 0bf19ae, 949e81a and 147c997.e2e (kube-cluster-upgrade)on real CloudNativePG (upgrade 5m32s, documented rollback 58s), the PostgreSQL 17-to-18 job and documentation (mdbook). The security reviewer cleared each head; the Guide reports no major issues at c728a71.docs/check-links.pypasses: 283 links.mdbook buildis left to this PR'sdocumentationworkflow (the local run was still waiting for a slot).resourceVersionconflicts, as on a real server. All 13 new mutations fail (Detail). Two of them reproduce CI's exact error.hibernation: off, 3/3 ready.Not checked
Decided for you
local-path, kind'sstandard) can still fill up during the copy. That copy then fails, and the Cluster wakes on 17 (sign-in down for that attempt only). A real free-space check is not reliably knowable across storage classes.walStorage, set by hand, never by the installer) cannot be upgraded by the installer. A symlink-aware copier would need its own real-filesystem proof.ANALYZEfailure is reported, not fatal.You need to: merge after #216, once CI, the security reviewer and the Guide are clean. I merged #216's branch at 02e5c57 (kit v4) into this PR after garganey's hand-off, because GitHub runs no CI on a conflicting PR. The conflicts were in AGENTS.md and CHANGELOG.md only, and it was a merge, not a rebase. If #216 moves again, merge it again.
Detail
Mutations of this change (each alone,
go test -run ClusterUpgrade ./internal/kube/):gannet's 8 earlier mutations still apply to the unchanged guards. The "foreign copy overwritten" one is moot now: names are unique per attempt, and a foreign copy is asserted untouched and absent from the note.
Images: 18 operand
ghcr.io/cloudnative-pg/postgresql:18.7-minimal-trixie@sha256:c8caac9817d2b5e5e66297a3ccf86d9fcbd68f097aa6cc00161d83f9635e88cc(the index digest, trixie as for 17.12).CloudNativePG facts relied on (release-1.30 source):
spec.imageName's tag major withstatus.pgDataImageInfo.majorVersion, and runs once the Cluster is awake.cnpg.io/clusterthat have no owner (reconcileRestoredCluster).cnpg.io/pvcRole.🤖 Generated with Claude Code