mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-17 23:15:48 +02:00
Avoid passing the role into the recreatePod.
Conceptually, the operator's task is just to change the pod. As it has no influence over the role the pod will take (either the master or a replica), it shouldn't wait for the specific role. This fixes at least one issue, where the pod running in a single-pod cluster has been waited for forever by the operator expecting it to have a wrong role (since Patroni callback assiging it the original replica role has been killed after a quick promote by the next callback.)
This commit is contained in:
committed by
Murat Kabilov
parent
8e658174e8
commit
176c6e8b19
+2
-3
@@ -152,7 +152,6 @@ func (c *Cluster) syncPods() error {
|
||||
|
||||
//First check if we have left overs from the previous rolling update
|
||||
for _, pod := range pods.Items {
|
||||
podRole := util.PodSpiloRole(&pod)
|
||||
podName := spec.PodName{
|
||||
Namespace: pod.Namespace,
|
||||
Name: pod.Name,
|
||||
@@ -161,7 +160,7 @@ func (c *Cluster) syncPods() error {
|
||||
if match && pod.Status.Phase == v1.PodPending {
|
||||
c.logger.Infof("Waiting for left over Pod '%s'", podName)
|
||||
ch := c.registerPodSubscriber(podName)
|
||||
c.waitForPodLabel(ch, podRole)
|
||||
c.waitForPodLabel(ch)
|
||||
c.unregisterPodSubscriber(podName)
|
||||
}
|
||||
}
|
||||
@@ -177,7 +176,7 @@ func (c *Cluster) syncPods() error {
|
||||
if util.PodSpiloRole(&pod) == "master" {
|
||||
//TODO: do manual failover first
|
||||
}
|
||||
err = c.recreatePod(pod, "replica") // newly created pods are always "replica"s
|
||||
err = c.recreatePod(pod)
|
||||
|
||||
c.logger.Infof("Pod '%s' has been successfully recreated", util.NameFromMeta(pod.ObjectMeta))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user