Skip to content

Commit 2032dfa

Browse files
committed
Fix watchers
1 parent e4c9c9f commit 2032dfa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

exp/internal/controllers/machinepool_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ func (r *MachinePoolReconciler) nodeToMachinePool(ctx context.Context, o client.
372372

373373
// infraMachineToMachinePoolMapper is a mapper function that maps an InfraMachine to the MachinePool that owns it.
374374
// This is used to trigger an update of the MachinePool when a InfraMachine is changed.
375-
func infraMachineToMachinePoolMapper(o client.Object) []ctrl.Request {
375+
func infraMachineToMachinePoolMapper(_ context.Context, o client.Object) []ctrl.Request {
376376
labels := o.GetLabels()
377377

378378
if poolName, ok := labels[clusterv1.MachinePoolNameLabel]; ok {

exp/internal/controllers/machinepool_controller_phases.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,9 @@ func (r *MachinePoolReconciler) reconcileMachinePoolMachines(ctx context.Context
383383
_, loaded := r.externalWatchers.LoadOrStore(infraMachine.GroupVersionKind().String(), struct{}{})
384384
if !loaded && r.controller != nil {
385385
log.Info("Adding watcher on external object", "groupVersionKind", infraMachine.GroupVersionKind())
386+
kind := source.Kind(r.cache, infraMachine)
386387
err := r.controller.Watch(
387-
&source.Kind{Type: infraMachine},
388-
// &handler.EnqueueRequestForOwner{OwnerType: &expv1.MachinePool{}},
388+
kind,
389389
handler.EnqueueRequestsFromMapFunc(infraMachineToMachinePoolMapper),
390390
)
391391
if err != nil {

0 commit comments

Comments
 (0)