File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,15 @@ import (
44 "context"
55 "fmt"
66 "math/rand"
7+ "time"
78
89 appsv1 "k8s.io/api/apps/v1"
910 v1 "k8s.io/api/core/v1"
1011 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1112
1213 "github.com/zalando/postgres-operator/pkg/spec"
1314 "github.com/zalando/postgres-operator/pkg/util"
15+ "github.com/zalando/postgres-operator/pkg/util/retryutil"
1416)
1517
1618func (c * Cluster ) listPods () ([]v1.Pod , error ) {
@@ -309,7 +311,23 @@ func (c *Cluster) isSafeToRecreatePods(pods *v1.PodList) bool {
309311 }
310312
311313 for _ , pod := range pods .Items {
312- state , err := c .patroni .GetPatroniMemberState (& pod )
314+
315+ var state string
316+
317+ err := retryutil .Retry (1 * time .Second , 5 * time .Second ,
318+ func () (bool , error ) {
319+
320+ var err error
321+
322+ state , err = c .patroni .GetPatroniMemberState (& pod )
323+
324+ if err != nil {
325+ return false , err
326+ }
327+ return true , nil
328+ },
329+ )
330+
313331 if err != nil {
314332 c .logger .Errorf ("failed to get Patroni state for pod: %s" , err )
315333 return false
You can’t perform that action at this time.
0 commit comments