@@ -18,10 +18,8 @@ package handler
18
18
19
19
import (
20
20
"context"
21
- "reflect"
22
21
"time"
23
22
24
- "k8s.io/apimachinery/pkg/types"
25
23
"k8s.io/client-go/util/workqueue"
26
24
"sigs.k8s.io/controller-runtime/pkg/client"
27
25
"sigs.k8s.io/controller-runtime/pkg/controller/priorityqueue"
@@ -113,22 +111,7 @@ type TypedFuncs[object any, request comparable] struct {
113
111
// Create implements EventHandler.
114
112
func (h TypedFuncs [object , request ]) Create (ctx context.Context , e event.TypedCreateEvent [object ], q workqueue.TypedRateLimitingInterface [request ]) {
115
113
if h .CreateFunc != nil {
116
- if reflect .TypeFor [request ]() != reflect .TypeOf (reconcile.Request {}) || ! reflect .TypeFor [object ]().Implements (reflect .TypeFor [client.Object ]()) {
117
- h .CreateFunc (ctx , e , q )
118
- }
119
-
120
- wq , ok := q .(workqueue.TypedRateLimitingInterface [reconcile.Request ])
121
- if ok {
122
- evt , ok := any (e ).(event.TypedCreateEvent [client.Object ])
123
- if ok {
124
- item := reconcile.Request {NamespacedName : types.NamespacedName {
125
- Name : evt .Object .GetName (),
126
- Namespace : evt .Object .GetNamespace (),
127
- }}
128
- addToQueueCreate (wq , evt , item )
129
- }
130
- h .CreateFunc (ctx , e , q )
131
- }
114
+ h .CreateFunc (ctx , e , q )
132
115
}
133
116
}
134
117
@@ -142,33 +125,7 @@ func (h TypedFuncs[object, request]) Delete(ctx context.Context, e event.TypedDe
142
125
// Update implements EventHandler.
143
126
func (h TypedFuncs [object , request ]) Update (ctx context.Context , e event.TypedUpdateEvent [object ], q workqueue.TypedRateLimitingInterface [request ]) {
144
127
if h .UpdateFunc != nil {
145
- if reflect .TypeFor [request ]() != reflect .TypeOf (reconcile.Request {}) || ! reflect .TypeFor [object ]().Implements (reflect .TypeFor [client.Object ]()) {
146
- h .UpdateFunc (ctx , e , q )
147
- }
148
-
149
- wq , ok := q .(workqueue.TypedRateLimitingInterface [reconcile.Request ])
150
- if ok {
151
- evt , ok := any (e ).(event.TypedUpdateEvent [client.Object ])
152
- if ok {
153
- switch {
154
- case ! isNil (evt .ObjectNew ):
155
- item := reconcile.Request {NamespacedName : types.NamespacedName {
156
- Name : evt .ObjectNew .GetName (),
157
- Namespace : evt .ObjectNew .GetNamespace (),
158
- }}
159
- addToQueueUpdate (wq , evt , item )
160
- case ! isNil (evt .ObjectOld ):
161
- item := reconcile.Request {NamespacedName : types.NamespacedName {
162
- Name : evt .ObjectOld .GetName (),
163
- Namespace : evt .ObjectOld .GetNamespace (),
164
- }}
165
- addToQueueUpdate (wq , evt , item )
166
- default :
167
- enqueueLog .Error (nil , "UpdateEvent received with no metadata" , "event" , evt )
168
- }
169
- }
170
- h .UpdateFunc (ctx , e , q )
171
- }
128
+ h .UpdateFunc (ctx , e , q )
172
129
}
173
130
}
174
131
0 commit comments