Skip to content

Commit a5f7214

Browse files
authored
Merge pull request #3815 from k8s-infra-cherrypick-robot/cherry-pick-3809-to-release-1.10
[release-1.10] fix Cluster -> AzureManagedMachinePool mapper
2 parents 007794c + 50232eb commit a5f7214

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

controllers/azuremanagedmachinepool_controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,15 @@ func (ammpr *AzureManagedMachinePoolReconciler) SetupWithManager(ctx context.Con
107107
return errors.Wrap(err, "error creating controller")
108108
}
109109

110+
azureManagedMachinePoolMapper, err := util.ClusterToObjectsMapper(ammpr.Client, &infrav1.AzureManagedMachinePoolList{}, mgr.GetScheme())
111+
if err != nil {
112+
return errors.Wrap(err, "failed to create mapper for Cluster to AzureManagedMachinePools")
113+
}
114+
110115
// Add a watch on clusterv1.Cluster object for unpause & ready notifications.
111116
if err = c.Watch(
112117
&source.Kind{Type: &clusterv1.Cluster{}},
113-
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrav1.GroupVersion.WithKind("AzureManagedMachinePool"), mgr.GetClient(), &infrav1.AzureManagedMachinePool{})),
118+
handler.EnqueueRequestsFromMapFunc(azureManagedMachinePoolMapper),
114119
predicates.ClusterUnpausedAndInfrastructureReady(log),
115120
predicates.ResourceNotPausedAndHasFilterLabel(log, ammpr.WatchFilterValue),
116121
); err != nil {

0 commit comments

Comments
 (0)