From 48d778d6a7c80ce6b0e62cdb277a3a59378c573b Mon Sep 17 00:00:00 2001 From: Alvaro Aleman Date: Sat, 22 Mar 2025 14:06:39 -0400 Subject: [PATCH] :seedling: TypedRequestForOwner: Decrease priority when unchanged We already did this for RequestForOwner, but not the typed variation, this change adds that. --- pkg/handler/enqueue_owner.go | 4 ++-- pkg/handler/eventhandler_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pkg/handler/enqueue_owner.go b/pkg/handler/enqueue_owner.go index 80cb27c1b4..e8fc8eb46e 100644 --- a/pkg/handler/enqueue_owner.go +++ b/pkg/handler/enqueue_owner.go @@ -48,7 +48,7 @@ type OwnerOption func(e enqueueRequestForOwnerInterface) // // - a handler.enqueueRequestForOwner EventHandler with an OwnerType of ReplicaSet and OnlyControllerOwner set to true. func EnqueueRequestForOwner(scheme *runtime.Scheme, mapper meta.RESTMapper, ownerType client.Object, opts ...OwnerOption) EventHandler { - return WithLowPriorityWhenUnchanged(TypedEnqueueRequestForOwner[client.Object](scheme, mapper, ownerType, opts...)) + return TypedEnqueueRequestForOwner[client.Object](scheme, mapper, ownerType, opts...) } // TypedEnqueueRequestForOwner enqueues Requests for the Owners of an object. E.g. the object that created @@ -72,7 +72,7 @@ func TypedEnqueueRequestForOwner[object client.Object](scheme *runtime.Scheme, m for _, opt := range opts { opt(e) } - return e + return WithLowPriorityWhenUnchanged(e) } // OnlyControllerOwner if provided will only look at the first OwnerReference with Controller: true. diff --git a/pkg/handler/eventhandler_test.go b/pkg/handler/eventhandler_test.go index 38f76dab37..7cf5076e7c 100644 --- a/pkg/handler/eventhandler_test.go +++ b/pkg/handler/eventhandler_test.go @@ -798,6 +798,16 @@ var _ = Describe("Eventhandler", func() { ) }, }, + { + name: "TypedEnqueueRequestForOwner", + handler: func() handler.EventHandler { + return handler.TypedEnqueueRequestForOwner[client.Object]( + scheme.Scheme, + mapper, + &corev1.Pod{}, + ) + }, + }, { name: "Funcs", handler: func() handler.EventHandler {