Repository navigation
fix(backups): clear useSystemBucket on Postgres in-place restore - #3573
Andrey Kolkov (androndo) wants to merge 1 commit into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
dc9b120 to
1f4cae7
Compare
A Postgres app created with the platform-recommended backup.useSystemBucket=true cannot be restored in place. The CNPG restore driver writes explicit backup coordinates (destinationPath / endpointURL / s3CredentialsSecret) and flips bootstrap.enabled=true, but it never cleared the server-side useSystemBucket=true. The chart then fails its `bootstrap.enabled + useSystemBucket` render guard, the HelmRelease never re-renders bootstrap.recovery, and the RestoreJob can never converge (helm remediation retries forever). Clear backup.useSystemBucket in the restore patch so the chart receives a self-consistent value set: explicit coordinates, no system-bucket flag, recovery on. postgresapp.Backup.UseSystemBucket intentionally omits `omitempty` so the false zero-value survives into the JSON merge patch and actually overwrites the server value; with omitempty it would be dropped and the bug would persist. Signed-off-by: Andrey Kolkov <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1f4cae7 to
fcdf59a
Compare
|
Andrey Kolkov (@androndo) #3959 already resets UseSystemBucket in the CNPG strategy controller, and #3327 is closed as completed. Closing. |
What this PR does
Fixes #3327.
A Postgres app created with the platform-recommended
backup.useSystemBucket=trueflow cannot be restored in place on
main. The failure is by construction:buildPostgresAppRestorePatch) writes explicit backupcoordinates onto the target CR (
destinationPath/endpointURL/s3CredentialsSecret/endpointCA) and flipsbootstrap.enabled=true— i.e.it converts the app to the explicit-coordinates (legacy) backup flow, which is
exactly what the chart's
bootstrap.recovery+externalClustersblock needs.backup.useSystemBucket=true. Thepartial
postgresapp.Backupstruct had no such field, so the JSON merge patchleft it untouched.
(
bootstrap.enabled=true is incompatible with backup.useSystemBucket=true,packages/apps/postgres/templates/db.yaml). The HelmRelease drops into apermanent render-error,
bootstrap.recoverynever renders, and the RestoreJobcan never converge — precisely the "cannot converge" symptom in the issue.
Fix: clear
backup.useSystemBucketin the restore patch so the chart receives aself-consistent value set (explicit coordinates, no system-bucket flag, recovery on).
The new
postgresapp.Backup.UseSystemBucketfield intentionally omitsomitempty:otherwise the
falsezero-value is dropped from the merge patch, the server'struesurvives, and the bug persists. The chart guard is left in place — it is still correct
defensive behavior for a genuinely broken combo; this change stops the driver from
producing that combo.
Verification
TestBuildPostgresAppRestorePatch_ClearsUseSystemBucketasserts boththe struct flip and that the raw merge patch serializes
"useSystemBucket":false(guards the
omitemptyregression directly). Fullinternal/backupcontrollerpackage green;
go vetclean.helm templateofpackages/apps/postgreswith the exact values the driver nowproduces (
bootstrap.enabled=true,useSystemBucket=false, explicit coords):useSystemBucket=true) → render fails on the guard atdb.yaml:150.useSystemBucket=false) → renders the full recovery topology:bootstrap.recovery.source,externalClusters→-recoveryObjectStore, plus theongoing backup ObjectStore.
Screenshots
n/a — controller-internal change, no UI.
Downstream repositories
Walked the trigger map in
docs/agents/contributing.mdfile-by-file against the diff.The change touches only
internal/backupcontroller/(the CNPG restore driver and itspartial mirror struct) — no CRD (
Package/Plan/RestoreJobare untouched), no chartvalues (
useSystemBucketalready exists in the postgres chart), no annotation and notelemetry metric. Nothing downstream is affected.
Release note