@@ -195,8 +195,7 @@ func AddToManager(mgr manager.Manager, r reconcile.Reconciler, concurrentReconci
195
195
}
196
196
197
197
// Watch for changes to ClusterDeployment
198
- err = c .Watch (source .Kind (mgr .GetCache (), & hivev1.ClusterDeployment {}),
199
- controllerutils .NewRateLimitedUpdateEventHandler (& handler.EnqueueRequestForObject {}, controllerutils .IsClusterDeploymentErrorUpdateEvent ))
198
+ err = c .Watch (source .Kind (mgr .GetCache (), & hivev1.ClusterDeployment {}, controllerutils .NewTypedRateLimitedUpdateEventHandler (& handler.TypedEnqueueRequestForObject [* hivev1.ClusterDeployment ]{}, controllerutils .IsClusterDeploymentErrorUpdateEvent )))
200
199
if err != nil {
201
200
logger .WithError (err ).Error ("Error watching cluster deployment" )
202
201
return err
@@ -208,37 +207,37 @@ func AddToManager(mgr manager.Manager, r reconcile.Reconciler, concurrentReconci
208
207
}
209
208
210
209
// Watch for jobs created by a ClusterDeployment:
211
- err = c .Watch (source .Kind (mgr .GetCache (), & batchv1.Job {}) , handler .EnqueueRequestForOwner (mgr .GetScheme (), mgr .GetRESTMapper (), & hivev1.ClusterDeployment {}, handler .OnlyControllerOwner ()))
210
+ err = c .Watch (source .Kind (mgr .GetCache (), & batchv1.Job {}, handler .TypedEnqueueRequestForOwner [ * batchv1. Job ] (mgr .GetScheme (), mgr .GetRESTMapper (), & hivev1.ClusterDeployment {}, handler .OnlyControllerOwner () )))
212
211
if err != nil {
213
212
logger .WithError (err ).Error ("Error watching cluster deployment job" )
214
213
return err
215
214
}
216
215
217
216
// Watch for pods created by an install job
218
- err = c .Watch (source .Kind (mgr .GetCache (), & corev1.Pod {}) , handler .EnqueueRequestsFromMapFunc (selectorPodWatchHandler ))
217
+ err = c .Watch (source .Kind (mgr .GetCache (), & corev1.Pod {}, handler .TypedEnqueueRequestsFromMapFunc (selectorPodWatchHandler ) ))
219
218
if err != nil {
220
219
logger .WithError (err ).Error ("Error watching cluster deployment pods" )
221
220
return err
222
221
}
223
222
224
223
// Watch for deprovision requests created by a ClusterDeployment
225
- err = c .Watch (source .Kind (mgr .GetCache (), & hivev1.ClusterDeprovision {}) , handler .EnqueueRequestForOwner (mgr .GetScheme (), mgr .GetRESTMapper (), & hivev1.ClusterDeployment {}, handler .OnlyControllerOwner ()))
224
+ err = c .Watch (source .Kind (mgr .GetCache (), & hivev1.ClusterDeprovision {}, handler .TypedEnqueueRequestForOwner [ * hivev1. ClusterDeprovision ] (mgr .GetScheme (), mgr .GetRESTMapper (), & hivev1.ClusterDeployment {}, handler .OnlyControllerOwner () )))
226
225
if err != nil {
227
226
logger .WithError (err ).Error ("Error watching deprovision request created by cluster deployment" )
228
227
return err
229
228
}
230
229
231
230
// Watch for dnszones created by a ClusterDeployment
232
- err = c .Watch (source .Kind (mgr .GetCache (), & hivev1.DNSZone {}) , handler .EnqueueRequestForOwner (mgr .GetScheme (), mgr .GetRESTMapper (), & hivev1.ClusterDeployment {}, handler .OnlyControllerOwner ()))
231
+ err = c .Watch (source .Kind (mgr .GetCache (), & hivev1.DNSZone {}, handler .TypedEnqueueRequestForOwner [ * hivev1. DNSZone ] (mgr .GetScheme (), mgr .GetRESTMapper (), & hivev1.ClusterDeployment {}, handler .OnlyControllerOwner () )))
233
232
if err != nil {
234
233
logger .WithError (err ).Error ("Error watching cluster deployment dnszones" )
235
234
return err
236
235
}
237
236
238
237
// Watch for changes to ClusterSyncs
239
238
if err := c .Watch (
240
- source .Kind (mgr .GetCache (), & hiveintv1alpha1.ClusterSync {}) ,
241
- handler .EnqueueRequestForOwner (mgr .GetScheme (), mgr .GetRESTMapper (), & hivev1.ClusterDeployment {}),
239
+ source .Kind (mgr .GetCache (), & hiveintv1alpha1.ClusterSync {},
240
+ handler .TypedEnqueueRequestForOwner [ * hiveintv1alpha1. ClusterSync ] (mgr .GetScheme (), mgr .GetRESTMapper (), & hivev1.ClusterDeployment {}) ),
242
241
); err != nil {
243
242
return errors .Wrap (err , "cannot start watch on ClusterSyncs" )
244
243
}
@@ -1828,15 +1827,9 @@ func (r *ReconcileClusterDeployment) createManagedDNSZone(cd *hivev1.ClusterDepl
1828
1827
return nil
1829
1828
}
1830
1829
1831
- func selectorPodWatchHandler (ctx context.Context , a client. Object ) []reconcile.Request {
1830
+ func selectorPodWatchHandler (ctx context.Context , pod * corev1. Pod ) []reconcile.Request {
1832
1831
retval := []reconcile.Request {}
1833
1832
1834
- pod := a .(* corev1.Pod )
1835
- if pod == nil {
1836
- // Wasn't a Pod, bail out. This should not happen.
1837
- log .Errorf ("Error converting MapObject.Object to Pod. Value: %+v" , a )
1838
- return retval
1839
- }
1840
1833
if pod .Labels == nil {
1841
1834
return retval
1842
1835
}
0 commit comments