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:
Shubham Padkonde
2026-09-24 14:37:22 +02:00
committed by GitHub
co-authored by Felix Kunde
parent 5cfb26f8b9
commit c8e0225f8f
3 changed files with 134 additions and 5 deletions
+1 -1
View File
@@ -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)