mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-21 00:26:09 +02:00
Avoid switchover after migrating a single-pod cluster (#3187)
Leave the replica candidate unset for single-pod clusters so migration returns after recreating the master instead of contacting its stale IP. Add migration regressions and document the recreate-only path. Signed-off-by: Shubham Padkonde <shubhampadkonde12@gmail.com> Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
This commit is contained in:
co-authored by
Felix Kunde
parent
5cfb26f8b9
commit
c8e0225f8f
+1
-1
@@ -250,7 +250,7 @@ func (c *Cluster) MigrateMasterPod(podName spec.NamespacedName) error {
|
||||
}
|
||||
// we may not have a cached statefulset if the initial cluster sync has aborted, revert to the spec in that case
|
||||
masterCandidateName := podName
|
||||
masterCandidatePod := oldMaster
|
||||
var masterCandidatePod *v1.Pod
|
||||
if *c.Statefulset.Spec.Replicas > 1 {
|
||||
if masterCandidateName, err = c.getSwitchoverCandidate(oldMaster); err != nil {
|
||||
return fmt.Errorf("could not find suitable replica pod as candidate for failover: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user