Repository navigation
K8SPG-1099 clear inner PostgresCluster standby when spec.standby removed - #1823
Merged
egegunes merged 1 commit intoOct 6, 2026
Merged
Conversation
KR-Ravindra
marked this pull request as ready for review
September 9, 2026 16:16
KR-Ravindra
requested review from
egegunes,
gkech,
hors,
mayankshah1607,
nmarukovich,
oksana-grishchenko and
pooknull
as code owners
September 9, 2026 16:16
ToCrunchy() only assigned postgresCluster.Spec.Standby when the PerconaPGCluster had spec.standby set. Because ToCrunchy mutates the live PostgresCluster inside controllerutil.CreateOrUpdate, a standby block that was later removed from the PerconaPGCluster stayed on the inner object and the cluster never left standby mode. Reset Spec.Standby before the conditional assignment so the inner PostgresCluster always mirrors the PerconaPGCluster, and add a ToCrunchy unit test covering removal of spec.standby.
KR-Ravindra
force-pushed
the
K8SPG-1099-clear-standby-on-removal
branch
from
September 20, 2026 21:42
45d30d1 to
60244fe
Compare
Collaborator
commit: 60244fe |
egegunes
approved these changes
Sep 21, 2026
Contributor
Author
|
@gkech @mayankshah1607 this has one approval and a clean Jenkins run; could one of you take the second review when you have a moment? Drafted with AI assistance and checked against the code. |
oksana-grishchenko
approved these changes
Oct 6, 2026
gkech
approved these changes
Oct 6, 2026
Contributor
|
@KR-Ravindra thank you for your contribution! |
|
@KR-Ravindra, thank you for your contributions. As a token of our appreciation, we'd like to send you a Percona contributor challenge coin. To receive it, fill in this form: https://forms.gle/b5qovTkTGVod6e2YA (or email [email protected] with the link to this PR). Then leave a quick "done" here so we know it's you. And send us a pic when the coin arrives 📸 |
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
When
spec.standbyis removed from aPerconaPGCluster, the innerPostgresClusterkeeps its previousspec.standby(enabled: true), so the cluster stays in standby and never promotes even though the user's CR no longer asks for it. The workaround today is to setspec.standby.enabled: falseexplicitly instead of deleting the block.Cause
PerconaPGCluster.ToCrunchy()only assignspostgresCluster.Spec.Standbywhencr.Spec.Standby != nil.ToCrunchyruns inside theCreateOrUpdatemutate function, so it operates on the livePostgresClusterfetched from the API server; with noelsebranch, aStandbyset on an earlier reconcile is never cleared. Neighbouring fields (Paused,Shutdown,DataSource,Patroni) are assigned unconditionally and do not have this problem.Solution
Reset
postgresCluster.Spec.Standbytonilbefore the conditional assignment, so the inner cluster always mirrors thePerconaPGCluster. One line, no API or CRD changes.A case added to
TestPerconaPGCluster_ToCrunchystarts from aPostgresClusterwithStandbyset and aPerconaPGClusterwith none, and asserts the result isnil.Links
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability
Yes, AI-assisted; reviewed by me.