K8SPG-911 restore fix - #1795
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, aligns with the stated restore flapping issue, and is covered by a targeted new unit test plus E2E hardening.
Pull request overview
This PR addresses K8SPG-911 by preventing pg_tde.wal_encrypt from being toggled off during restore-related pod restarts (e.g., while pg_rewind is in progress), which can otherwise trigger an unwanted primary restart. It does this by keeping the Vault provider “ready” status intact when the provider is already configured but not all pods are currently running, plus it strengthens test stability via unit and E2E timing/retry adjustments.
Changes:
- Keep
PGTDEVaultProviderReady=Truewhen instances are temporarily not all running, avoiding WAL encryption flapping during restore. - Add a unit test covering the “configured provider remains ready while waiting for instances” behavior.
- Increase / harden KUTTL E2E steps with longer timeouts and retries for post-upgrade verification.
File summaries
| File | Description |
|---|---|
| internal/controller/postgrescluster/postgres.go | Avoids flipping PGTDEVaultProviderReady to false when already configured and pods are not all running, preventing WAL encryption from being disabled transiently. |
| internal/controller/postgrescluster/pgtde_test.go | Adds a regression test ensuring the provider-ready condition remains True/Configured and no exec occurs while waiting for instances. |
| e2e-tests/tests/pg-tde-wal-encrypt/15-assert.yaml | Increases KUTTL assert timeout to reduce flakes in WAL-encryption-related assertions. |
| e2e-tests/tests/major-upgrade-17-to-18/06-post-upgrade.yaml | Adds command timeout and retry wrappers to make post-upgrade verification resilient to transient restarts/election delays. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
egegunes
marked this pull request as ready for review
September 1, 2026 05:18
egegunes
requested review from
DhruthiKV,
eleo007,
gkech,
hors,
jvpasinatto,
mayankshah1607,
nmarukovich,
oksana-grishchenko,
pooknull and
valmiranogueira
as code owners
September 1, 2026 05:18
gkech
approved these changes
Sep 1, 2026
mayankshah1607
approved these changes
Sep 1, 2026
nmarukovich
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGE DESCRIPTION
Problem:
pg_tde.wal_encrypt might flap after restore and make primary restart during pg_rewind.
Solution:
If all pods are not running, operator should prevent enabling WAL encryption but shouldn't disable if it's already enabled.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability