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 @@ -5,10 +5,13 @@ import (
5
5
"context"
6
6
"fmt"
7
7
"strings"
8
+ "time"
8
9
9
10
"github.com/pkg/errors"
10
11
corev1 "k8s.io/api/core/v1"
11
12
"k8s.io/apimachinery/pkg/labels"
13
+ "k8s.io/apimachinery/pkg/util/wait"
14
+ "k8s.io/client-go/util/retry"
12
15
"sigs.k8s.io/controller-runtime/pkg/client"
13
16
logf "sigs.k8s.io/controller-runtime/pkg/log"
14
17
@@ -102,7 +105,22 @@ func (r *PerconaServerMySQLReconciler) reconcileFullClusterCrash(ctx context.Con
102
105
break
103
106
}
104
107
105
- primary , err := r .getPrimaryPod (ctx , cr )
108
+ var primary * corev1.Pod
109
+ err = retry .OnError (wait.Backoff {
110
+ Duration : 10 * time .Second ,
111
+ Factor : 1.5 ,
112
+ Steps : 10 ,
113
+ }, func (err error ) bool { return true }, func () error {
114
+ var err error
115
+
116
+ primary , err = r .getPrimaryPod (ctx , cr )
117
+ if err != nil {
118
+ log .V (1 ).Error (err , "failed to get primary pod" )
119
+ return err
120
+ }
121
+
122
+ return nil
123
+ })
106
124
if err != nil {
107
125
log .Error (err , "failed to get primary pod" )
108
126
break
You can’t perform that action at this time.
0 commit comments