Skip to content

Commit

Permalink
Merge pull request #3815 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…3809-to-release-1.10

[release-1.10] fix Cluster -> AzureManagedMachinePool mapper
  • Loading branch information
k8s-ci-robot authored Aug 8, 2023
2 parents 007794c + 50232eb commit a5f7214
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion controllers/azuremanagedmachinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,15 @@ func (ammpr *AzureManagedMachinePoolReconciler) SetupWithManager(ctx context.Con
return errors.Wrap(err, "error creating controller")
}

azureManagedMachinePoolMapper, err := util.ClusterToObjectsMapper(ammpr.Client, &infrav1.AzureManagedMachinePoolList{}, mgr.GetScheme())
if err != nil {
return errors.Wrap(err, "failed to create mapper for Cluster to AzureManagedMachinePools")
}

// Add a watch on clusterv1.Cluster object for unpause & ready notifications.
if err = c.Watch(
&source.Kind{Type: &clusterv1.Cluster{}},
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrav1.GroupVersion.WithKind("AzureManagedMachinePool"), mgr.GetClient(), &infrav1.AzureManagedMachinePool{})),
handler.EnqueueRequestsFromMapFunc(azureManagedMachinePoolMapper),
predicates.ClusterUnpausedAndInfrastructureReady(log),
predicates.ResourceNotPausedAndHasFilterLabel(log, ammpr.WatchFilterValue),
); err != nil {
Expand Down

0 comments on commit a5f7214

Please sign in to comment.