@@ -237,11 +237,10 @@ func SetPodGroupsToReady(ctx context.Context, k8sClient client.Client, lws *lead
237
237
}
238
238
}
239
239
240
- // SetPodGroupToReady set one podGroup(leaderPod+workerStatefulset) of leaderWorkerSet to ready state, workerPods not included.
241
- func SetPodGroupToReady (ctx context.Context , k8sClient client.Client , statefulsetName string , lws * leaderworkerset.LeaderWorkerSet ) {
240
+ func SetLeaderPodToReady (ctx context.Context , k8sClient client.Client , podName string , lws * leaderworkerset.LeaderWorkerSet ) {
242
241
gomega .Eventually (func () error {
243
242
var leaderPod corev1.Pod
244
- if err := k8sClient .Get (ctx , client.ObjectKey {Namespace : lws .Namespace , Name : statefulsetName }, & leaderPod ); err != nil {
243
+ if err := k8sClient .Get (ctx , client.ObjectKey {Namespace : lws .Namespace , Name : podName }, & leaderPod ); err != nil {
245
244
return err
246
245
}
247
246
@@ -256,7 +255,7 @@ func SetPodGroupToReady(ctx context.Context, k8sClient client.Client, statefulse
256
255
257
256
gomega .Eventually (func () error {
258
257
var leaderPod corev1.Pod
259
- if err := k8sClient .Get (ctx , client.ObjectKey {Namespace : lws .Namespace , Name : statefulsetName }, & leaderPod ); err != nil {
258
+ if err := k8sClient .Get (ctx , client.ObjectKey {Namespace : lws .Namespace , Name : podName }, & leaderPod ); err != nil {
260
259
return err
261
260
}
262
261
@@ -268,7 +267,11 @@ func SetPodGroupToReady(ctx context.Context, k8sClient client.Client, statefulse
268
267
leaderPod .Status .Conditions = append (leaderPod .Status .Conditions , condition )
269
268
return k8sClient .Status ().Update (ctx , & leaderPod )
270
269
}, Timeout , Interval ).Should (gomega .Succeed ())
270
+ }
271
271
272
+ // SetPodGroupToReady set one podGroup(leaderPod+workerStatefulset) of leaderWorkerSet to ready state, workerPods not included.
273
+ func SetPodGroupToReady (ctx context.Context , k8sClient client.Client , statefulsetName string , lws * leaderworkerset.LeaderWorkerSet ) {
274
+ SetLeaderPodToReady (ctx , k8sClient , statefulsetName , lws )
272
275
gomega .Eventually (func () error {
273
276
var sts appsv1.StatefulSet
274
277
if err := k8sClient .Get (ctx , types.NamespacedName {Name : statefulsetName , Namespace : lws .Namespace }, & sts ); err != nil {
@@ -492,3 +495,17 @@ func DeleteNamespace(ctx context.Context, c client.Client, ns *corev1.Namespace)
492
495
}
493
496
return nil
494
497
}
498
+
499
+ func SetLeaderPodsToReady (ctx context.Context , k8sClient client.Client , lws * leaderworkerset.LeaderWorkerSet , start , end int ) {
500
+ var leaderSts appsv1.StatefulSet
501
+ gomega .Eventually (func () error {
502
+ if err := k8sClient .Get (ctx , types.NamespacedName {Name : lws .Name , Namespace : lws .Namespace }, & leaderSts ); err != nil {
503
+ return err
504
+ }
505
+ return nil
506
+ }, Timeout , Interval ).Should (gomega .Succeed ())
507
+
508
+ for i := start ; i < end ; i ++ {
509
+ SetLeaderPodToReady (ctx , k8sClient , fmt .Sprintf ("%s-%d" , leaderSts .Name , i ), lws )
510
+ }
511
+ }
0 commit comments