mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-18 18:39:41 +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
+5
-2
@@ -146,12 +146,15 @@ func (c *Cluster) getTeamMembers() ([]string, error) {
|
||||
return teamInfo.Members, nil
|
||||
}
|
||||
|
||||
func (c *Cluster) waitForPodLabel(podEvents chan spec.PodEvent, spiloRole string) error {
|
||||
func (c *Cluster) waitForPodLabel(podEvents chan spec.PodEvent) error {
|
||||
for {
|
||||
select {
|
||||
case podEvent := <-podEvents:
|
||||
role := util.PodSpiloRole(podEvent.CurPod)
|
||||
if role == spiloRole { // TODO: newly-created Pods are always replicas => check against empty string only
|
||||
// We cannot assume any role of the newly created pod. Normally, for a multi-pod cluster
|
||||
// we should observe the 'replica' value, but it could be that some pods are not allowed
|
||||
// to promote, therefore, the new pod could be a master as well.
|
||||
if role == "master" || role == "replica" {
|
||||
return nil
|
||||
}
|
||||
case <-time.After(c.OpConfig.PodLabelWaitTimeout):
|
||||
|
||||
Reference in New Issue
Block a user