Skip to content

🌱 TypedEnqueueRequestForOwner: Decrease priority when unchanged #3174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/handler/enqueue_owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions pkg/handler/eventhandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading