Skip to content

Commit cca9e61

Browse files
committed
Fix issue with cluster paused map function
Switch to using the API package's GroupVersion to supply the GroupVersionKind for the map function, as azCluster's APIVersion and Kind fields were empty, resulting in the map function never matching on AzureCluster. Signed-off-by: Andy Goldstein <[email protected]>
1 parent 47524f2 commit cca9e61

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

controllers/azurecluster_controller.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ type AzureClusterReconciler struct {
5151
}
5252

5353
func (r *AzureClusterReconciler) SetupWithManager(mgr ctrl.Manager, options controller.Options) error {
54-
azCluster := &infrav1.AzureCluster{}
5554
c, err := ctrl.NewControllerManagedBy(mgr).
5655
WithOptions(options).
57-
For(azCluster).
56+
For(&infrav1.AzureCluster{}).
5857
WithEventFilter(predicates.ResourceNotPaused(r.Log)). // don't queue reconcile if resource is paused
5958
Build(r)
6059
if err != nil {
@@ -65,7 +64,7 @@ func (r *AzureClusterReconciler) SetupWithManager(mgr ctrl.Manager, options cont
6564
if err = c.Watch(
6665
&source.Kind{Type: &clusterv1.Cluster{}},
6766
&handler.EnqueueRequestsFromMapFunc{
68-
ToRequests: util.ClusterToInfrastructureMapFunc(azCluster.GroupVersionKind()),
67+
ToRequests: util.ClusterToInfrastructureMapFunc(infrav1.GroupVersion.WithKind("AzureCluster")),
6968
},
7069
predicates.ClusterUnpaused(r.Log),
7170
); err != nil {

0 commit comments

Comments
 (0)