Skip to content

Commit cad5496

Browse files
committed
Add MD watch to the MS controller
Signed-off-by: Stefan Büringer buringerst@vmware.com
1 parent bf63a73 commit cad5496

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/controllers/machineset/machineset_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
114114
if err != nil {
115115
return err
116116
}
117+
mdToMachineSets, err := util.MachineDeploymentToObjectsMapper(mgr.GetClient(), &clusterv1.MachineSetList{}, mgr.GetScheme())
118+
if err != nil {
119+
return err
120+
}
117121

118122
err = ctrl.NewControllerManagedBy(mgr).
119123
For(&clusterv1.MachineSet{}).
@@ -123,6 +127,10 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
123127
&clusterv1.Machine{},
124128
handler.EnqueueRequestsFromMapFunc(r.MachineToMachineSets),
125129
).
130+
Watches(
131+
&clusterv1.MachineDeployment{},
132+
handler.EnqueueRequestsFromMapFunc(mdToMachineSets),
133+
).
126134
WithOptions(options).
127135
WithEventFilter(predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
128136
Watches(

0 commit comments

Comments
 (0)