Skip to content

Commit

Permalink
Merge pull request #11448 from sbueringer/pr-md-watch-ms-controller
Browse files Browse the repository at this point in the history
🌱 Add MD watch to the MS controller
  • Loading branch information
k8s-ci-robot authored Nov 19, 2024
2 parents 5aa05ae + cad5496 commit aec0565
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/controllers/machineset/machineset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
if err != nil {
return err
}
mdToMachineSets, err := util.MachineDeploymentToObjectsMapper(mgr.GetClient(), &clusterv1.MachineSetList{}, mgr.GetScheme())
if err != nil {
return err
}

err = ctrl.NewControllerManagedBy(mgr).
For(&clusterv1.MachineSet{}).
Expand All @@ -123,6 +127,10 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
&clusterv1.Machine{},
handler.EnqueueRequestsFromMapFunc(r.MachineToMachineSets),
).
Watches(
&clusterv1.MachineDeployment{},
handler.EnqueueRequestsFromMapFunc(mdToMachineSets),
).
WithOptions(options).
WithEventFilter(predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
Watches(
Expand Down

0 comments on commit aec0565

Please sign in to comment.