Skip to content

Commit 02e43b0

Browse files
authored
Remove redundant watch of leader pod + increase e2e test timeout (#791)
* Remove redundant watch of leader pod * Increase e2e test timeout to 2m
1 parent 1cfadf3 commit 02e43b0

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

pkg/controllers/leaderworkerset_controller.go

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -211,31 +211,16 @@ func (r *LeaderWorkerSetReconciler) SetupWithManager(mgr ctrl.Manager) error {
211211
Owns(&corev1.Service{}).
212212
Watches(&appsv1.StatefulSet{},
213213
handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, a client.Object) []reconcile.Request {
214-
return enqueueLWSRequests(a)
215-
})).
216-
Watches(&corev1.Pod{},
217-
handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, a client.Object) []reconcile.Request {
218-
if a.GetLabels()[leaderworkerset.WorkerIndexLabelKey] != "0" {
219-
return nil
214+
return []reconcile.Request{
215+
{NamespacedName: types.NamespacedName{
216+
Name: a.GetLabels()[leaderworkerset.SetNameLabelKey],
217+
Namespace: a.GetNamespace(),
218+
}},
220219
}
221-
return enqueueLWSRequests(a)
222220
})).
223221
Complete(r)
224222
}
225223

226-
func enqueueLWSRequests(a client.Object) []reconcile.Request {
227-
name := a.GetLabels()[leaderworkerset.SetNameLabelKey]
228-
if name == "" {
229-
return nil
230-
}
231-
return []reconcile.Request{
232-
{NamespacedName: types.NamespacedName{
233-
Name: name,
234-
Namespace: a.GetNamespace(),
235-
}},
236-
}
237-
}
238-
239224
func SetupIndexes(indexer client.FieldIndexer) error {
240225
return indexer.IndexField(context.Background(), &appsv1.StatefulSet{}, lwsOwnerKey, func(rawObj client.Object) []string {
241226
// grab the statefulSet object, extract the owner...

test/e2e/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import (
4343
)
4444

4545
const (
46-
timeout = 30 * time.Second
46+
timeout = 2 * time.Minute
4747
interval = time.Millisecond * 250
4848
)
4949

test/testutils/validators.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
)
3939

4040
const (
41-
Timeout = 30 * time.Second
41+
Timeout = 2 * time.Minute
4242
Interval = time.Millisecond * 250
4343
)
4444

0 commit comments

Comments
 (0)