Skip to content

Commit aec0565

Browse files
authored
Merge pull request #11448 from sbueringer/pr-md-watch-ms-controller
🌱 Add MD watch to the MS controller
2 parents 5aa05ae + cad5496 commit aec0565

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/controllers/machineset/machineset_controller.go

+8
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)