Skip to content

Commit 0cfa523

Browse files
committed
Properly respect externally managed annotation
We already have a predicate for events from AzureClusters that skip their reconciliation if they are managed externally. We do however not have such a check for events that come from a Cluster, resulting in us doing a reconciliation for AzureClusters anyways.
1 parent c19ce90 commit 0cfa523

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

controllers/azurecluster_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (acr *AzureClusterReconciler) SetupWithManager(ctx context.Context, mgr ctr
9595
// Add a watch on clusterv1.Cluster object for unpause notifications.
9696
if err = c.Watch(
9797
&source.Kind{Type: &clusterv1.Cluster{}},
98-
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(infrav1.GroupVersion.WithKind("AzureCluster"))),
98+
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFuncWithExternallyManagedCheck(ctx, infrav1.GroupVersion.WithKind("AzureCluster"), mgr.GetClient(), &infrav1.AzureCluster{})),
9999
predicates.ClusterUnpaused(log),
100100
predicates.ResourceNotPausedAndHasFilterLabel(log, acr.WatchFilterValue),
101101
); err != nil {

controllers/azureidentity_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func (r *AzureIdentityReconciler) SetupWithManager(ctx context.Context, mgr ctrl
6363
WithOptions(options).
6464
For(&infrav1.AzureCluster{}).
6565
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue)).
66+
WithEventFilter(predicates.ResourceIsNotExternallyManaged(log)).
6667
Named("AzureIdentity").
6768
Build(r)
6869
if err != nil {
@@ -83,7 +84,7 @@ func (r *AzureIdentityReconciler) SetupWithManager(ctx context.Context, mgr ctrl
8384
// Add a watch on clusterv1.Cluster object for unpause notifications.
8485
if err = c.Watch(
8586
&source.Kind{Type: &clusterv1.Cluster{}},
86-
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(infrav1.GroupVersion.WithKind("AzureCluster"))),
87+
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFuncWithExternallyManagedCheck(ctx, infrav1.GroupVersion.WithKind("AzureCluster"), mgr.GetClient(), &infrav1.AzureCluster{})),
8788
predicates.ClusterUnpaused(log),
8889
predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue),
8990
); err != nil {

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ require (
4242
k8s.io/klog/v2 v2.30.0
4343
k8s.io/kubectl v0.23.0
4444
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
45-
sigs.k8s.io/cluster-api v1.1.0
45+
sigs.k8s.io/cluster-api v1.1.1
4646
sigs.k8s.io/cluster-api/test v1.1.0
4747
sigs.k8s.io/controller-runtime v0.11.0
4848
sigs.k8s.io/kind v0.11.1
@@ -171,4 +171,4 @@ require (
171171
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
172172
)
173173

174-
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.1.0
174+
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.1.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,8 +1665,8 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
16651665
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
16661666
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
16671667
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.25/go.mod h1:Mlj9PNLmG9bZ6BHFwFKDo5afkpWyUISkb9Me0GnK66I=
1668-
sigs.k8s.io/cluster-api v1.1.0 h1:zJJzIUezEveYK3Ljmk/jku+DYd96RP5bZ181l2W9gVg=
1669-
sigs.k8s.io/cluster-api v1.1.0/go.mod h1:aSxmmNwDjmg9rDaL0RhRELpGX9uSTTwLF02AMtk/XGY=
1668+
sigs.k8s.io/cluster-api v1.1.1 h1:wU1J+Yyu9xDC5M2uACH4Ii8vrIk37oZiCKeMEfyL0pk=
1669+
sigs.k8s.io/cluster-api v1.1.1/go.mod h1:aSxmmNwDjmg9rDaL0RhRELpGX9uSTTwLF02AMtk/XGY=
16701670
sigs.k8s.io/cluster-api/test v1.1.0 h1:eBVFCWxu9/fb/By02uFjOreG9GAd9eax9uZKsCXP58s=
16711671
sigs.k8s.io/cluster-api/test v1.1.0/go.mod h1:ct7zQrWXsYIAhL/lMLFPfCAqGLDBTEzx+AtwIXpI45o=
16721672
sigs.k8s.io/controller-runtime v0.11.0 h1:DqO+c8mywcZLFJWILq4iktoECTyn30Bkj0CwgqMpZWQ=

0 commit comments

Comments
 (0)