Skip to content

Commit e44db26

Browse files
Revert to WatchFilterValue
1 parent f133da3 commit e44db26

File tree

37 files changed

+244
-241
lines changed

37 files changed

+244
-241
lines changed

bootstrap/kubeadm/controllers/alias.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ type KubeadmConfigReconciler struct {
4444

4545
Tracker *remote.ClusterCacheTracker
4646

47-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
48-
WatchFilterPredicate predicates.LabelMatcher
47+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
48+
WatchFilterValue predicates.LabelMatcher
4949

5050
// TokenTTL is the amount of time a bootstrap token (and therefore a KubeadmConfig) will be valid.
5151
TokenTTL time.Duration
@@ -54,10 +54,10 @@ type KubeadmConfigReconciler struct {
5454
// SetupWithManager sets up the reconciler with the Manager.
5555
func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
5656
return (&kubeadmbootstrapcontrollers.KubeadmConfigReconciler{
57-
Client: r.Client,
58-
SecretCachingClient: r.SecretCachingClient,
59-
Tracker: r.Tracker,
60-
WatchFilterPredicate: r.WatchFilterPredicate,
61-
TokenTTL: r.TokenTTL,
57+
Client: r.Client,
58+
SecretCachingClient: r.SecretCachingClient,
59+
Tracker: r.Tracker,
60+
WatchFilterValue: r.WatchFilterValue,
61+
TokenTTL: r.TokenTTL,
6262
}).SetupWithManager(ctx, mgr, options)
6363
}

bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ type KubeadmConfigReconciler struct {
8181
Tracker *remote.ClusterCacheTracker
8282
KubeadmInitLock InitLocker
8383

84-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
85-
WatchFilterPredicate predicates.LabelMatcher
84+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
85+
WatchFilterValue predicates.LabelMatcher
8686

8787
// TokenTTL is the amount of time a bootstrap token (and therefore a KubeadmConfig) will be valid.
8888
TokenTTL time.Duration
@@ -111,7 +111,7 @@ func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl
111111
Watches(
112112
&clusterv1.Machine{},
113113
handler.EnqueueRequestsFromMapFunc(r.MachineToBootstrapMapFunc),
114-
).WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterPredicate))
114+
).WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue))
115115

116116
if feature.Gates.Enabled(feature.MachinePool) {
117117
b = b.Watches(
@@ -126,7 +126,7 @@ func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl
126126
builder.WithPredicates(
127127
predicates.All(ctrl.LoggerFrom(ctx),
128128
predicates.ClusterUnpausedAndInfrastructureReady(ctrl.LoggerFrom(ctx)),
129-
predicates.ResourceHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterPredicate),
129+
predicates.ResourceHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue),
130130
),
131131
),
132132
)

bootstrap/kubeadm/main.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -318,20 +318,20 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
318318
}
319319

320320
if err := (&remote.ClusterCacheReconciler{
321-
Client: mgr.GetClient(),
322-
Tracker: tracker,
323-
WatchFilterPredicate: labelSelector,
321+
Client: mgr.GetClient(),
322+
Tracker: tracker,
323+
WatchFilterValue: labelSelector,
324324
}).SetupWithManager(ctx, mgr, concurrency(clusterConcurrency)); err != nil {
325325
setupLog.Error(err, "unable to create controller", "controller", "ClusterCacheReconciler")
326326
os.Exit(1)
327327
}
328328

329329
if err := (&kubeadmbootstrapcontrollers.KubeadmConfigReconciler{
330-
Client: mgr.GetClient(),
331-
SecretCachingClient: secretCachingClient,
332-
Tracker: tracker,
333-
WatchFilterPredicate: labelSelector,
334-
TokenTTL: tokenTTL,
330+
Client: mgr.GetClient(),
331+
SecretCachingClient: secretCachingClient,
332+
Tracker: tracker,
333+
WatchFilterValue: labelSelector,
334+
TokenTTL: tokenTTL,
335335
}).SetupWithManager(ctx, mgr, concurrency(kubeadmConfigConcurrency)); err != nil {
336336
setupLog.Error(err, "unable to create controller", "controller", "KubeadmConfig")
337337
os.Exit(1)

controllers/alias.go

+33-33
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ type ClusterReconciler struct {
4747
UnstructuredCachingClient client.Client
4848
APIReader client.Reader
4949

50-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
51-
WatchFilterPredicate predicates.LabelMatcher
50+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
51+
WatchFilterValue predicates.LabelMatcher
5252
}
5353

5454
func (r *ClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
5555
return (&clustercontroller.Reconciler{
5656
Client: r.Client,
5757
UnstructuredCachingClient: r.UnstructuredCachingClient,
5858
APIReader: r.APIReader,
59-
WatchFilterPredicate: r.WatchFilterPredicate,
59+
WatchFilterValue: r.WatchFilterValue,
6060
}).SetupWithManager(ctx, mgr, options)
6161
}
6262

@@ -67,8 +67,8 @@ type MachineReconciler struct {
6767
APIReader client.Reader
6868
Tracker *remote.ClusterCacheTracker
6969

70-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
71-
WatchFilterPredicate predicates.LabelMatcher
70+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
71+
WatchFilterValue predicates.LabelMatcher
7272

7373
// NodeDrainClientTimeout timeout of the client used for draining nodes.
7474
NodeDrainClientTimeout time.Duration
@@ -80,7 +80,7 @@ func (r *MachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manag
8080
UnstructuredCachingClient: r.UnstructuredCachingClient,
8181
APIReader: r.APIReader,
8282
Tracker: r.Tracker,
83-
WatchFilterPredicate: r.WatchFilterPredicate,
83+
WatchFilterValue: r.WatchFilterValue,
8484
NodeDrainClientTimeout: r.NodeDrainClientTimeout,
8585
}).SetupWithManager(ctx, mgr, options)
8686
}
@@ -92,8 +92,8 @@ type MachineSetReconciler struct {
9292
APIReader client.Reader
9393
Tracker *remote.ClusterCacheTracker
9494

95-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
96-
WatchFilterPredicate predicates.LabelMatcher
95+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
96+
WatchFilterValue predicates.LabelMatcher
9797
}
9898

9999
func (r *MachineSetReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
@@ -102,7 +102,7 @@ func (r *MachineSetReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
102102
UnstructuredCachingClient: r.UnstructuredCachingClient,
103103
APIReader: r.APIReader,
104104
Tracker: r.Tracker,
105-
WatchFilterPredicate: r.WatchFilterPredicate,
105+
WatchFilterValue: r.WatchFilterValue,
106106
}).SetupWithManager(ctx, mgr, options)
107107
}
108108

@@ -112,16 +112,16 @@ type MachineDeploymentReconciler struct {
112112
UnstructuredCachingClient client.Client
113113
APIReader client.Reader
114114

115-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
116-
WatchFilterPredicate predicates.LabelMatcher
115+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
116+
WatchFilterValue predicates.LabelMatcher
117117
}
118118

119119
func (r *MachineDeploymentReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
120120
return (&machinedeploymentcontroller.Reconciler{
121121
Client: r.Client,
122122
UnstructuredCachingClient: r.UnstructuredCachingClient,
123123
APIReader: r.APIReader,
124-
WatchFilterPredicate: r.WatchFilterPredicate,
124+
WatchFilterValue: r.WatchFilterValue,
125125
}).SetupWithManager(ctx, mgr, options)
126126
}
127127

@@ -130,15 +130,15 @@ type MachineHealthCheckReconciler struct {
130130
Client client.Client
131131
Tracker *remote.ClusterCacheTracker
132132

133-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
134-
WatchFilterPredicate predicates.LabelMatcher
133+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
134+
WatchFilterValue predicates.LabelMatcher
135135
}
136136

137137
func (r *MachineHealthCheckReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
138138
return (&machinehealthcheckcontroller.Reconciler{
139-
Client: r.Client,
140-
Tracker: r.Tracker,
141-
WatchFilterPredicate: r.WatchFilterPredicate,
139+
Client: r.Client,
140+
Tracker: r.Tracker,
141+
WatchFilterValue: r.WatchFilterValue,
142142
}).SetupWithManager(ctx, mgr, options)
143143
}
144144

@@ -151,8 +151,8 @@ type ClusterTopologyReconciler struct {
151151

152152
RuntimeClient runtimeclient.Client
153153

154-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
155-
WatchFilterPredicate predicates.LabelMatcher
154+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
155+
WatchFilterValue predicates.LabelMatcher
156156

157157
// UnstructuredCachingClient provides a client that forces caching of unstructured objects,
158158
// thus allowing to optimize reads for templates or provider specific objects in a managed topology.
@@ -165,7 +165,7 @@ func (r *ClusterTopologyReconciler) SetupWithManager(ctx context.Context, mgr ct
165165
APIReader: r.APIReader,
166166
RuntimeClient: r.RuntimeClient,
167167
UnstructuredCachingClient: r.UnstructuredCachingClient,
168-
WatchFilterPredicate: r.WatchFilterPredicate,
168+
WatchFilterValue: r.WatchFilterValue,
169169
}).SetupWithManager(ctx, mgr, options)
170170
}
171171

@@ -177,15 +177,15 @@ type MachineDeploymentTopologyReconciler struct {
177177
Client client.Client
178178
// APIReader is used to list MachineSets directly via the API server to avoid
179179
// race conditions caused by an outdated cache.
180-
APIReader client.Reader
181-
WatchFilterPredicate predicates.LabelMatcher
180+
APIReader client.Reader
181+
WatchFilterValue predicates.LabelMatcher
182182
}
183183

184184
func (r *MachineDeploymentTopologyReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
185185
return (&machinedeploymenttopologycontroller.Reconciler{
186-
Client: r.Client,
187-
APIReader: r.APIReader,
188-
WatchFilterPredicate: r.WatchFilterPredicate,
186+
Client: r.Client,
187+
APIReader: r.APIReader,
188+
WatchFilterValue: r.WatchFilterValue,
189189
}).SetupWithManager(ctx, mgr, options)
190190
}
191191

@@ -197,15 +197,15 @@ type MachineSetTopologyReconciler struct {
197197
Client client.Client
198198
// APIReader is used to list MachineSets directly via the API server to avoid
199199
// race conditions caused by an outdated cache.
200-
APIReader client.Reader
201-
WatchFilterPredicate predicates.LabelMatcher
200+
APIReader client.Reader
201+
WatchFilterValue predicates.LabelMatcher
202202
}
203203

204204
func (r *MachineSetTopologyReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
205205
return (&machinesettopologycontroller.Reconciler{
206-
Client: r.Client,
207-
APIReader: r.APIReader,
208-
WatchFilterPredicate: r.WatchFilterPredicate,
206+
Client: r.Client,
207+
APIReader: r.APIReader,
208+
WatchFilterValue: r.WatchFilterValue,
209209
}).SetupWithManager(ctx, mgr, options)
210210
}
211211

@@ -217,8 +217,8 @@ type ClusterClassReconciler struct {
217217
// RuntimeClient is a client for calling runtime extensions.
218218
RuntimeClient runtimeclient.Client
219219

220-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
221-
WatchFilterPredicate predicates.LabelMatcher
220+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
221+
WatchFilterValue predicates.LabelMatcher
222222

223223
// UnstructuredCachingClient provides a client that forces caching of unstructured objects,
224224
// thus allowing to optimize reads for templates or provider specific objects.
@@ -231,6 +231,6 @@ func (r *ClusterClassReconciler) SetupWithManager(ctx context.Context, mgr ctrl.
231231
APIReader: r.APIReader,
232232
RuntimeClient: r.RuntimeClient,
233233
UnstructuredCachingClient: r.UnstructuredCachingClient,
234-
WatchFilterPredicate: r.WatchFilterPredicate,
234+
WatchFilterValue: r.WatchFilterValue,
235235
}).SetupWithManager(ctx, mgr, options)
236236
}

controllers/remote/cluster_cache_reconciler.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ type ClusterCacheReconciler struct {
3636
Client client.Client
3737
Tracker *ClusterCacheTracker
3838

39-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
40-
WatchFilterPredicate predicates.LabelMatcher
39+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
40+
WatchFilterValue predicates.LabelMatcher
4141
}
4242

4343
func (r *ClusterCacheReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
4444
err := ctrl.NewControllerManagedBy(mgr).
4545
Named("remote/clustercache").
4646
For(&clusterv1.Cluster{}).
4747
WithOptions(options).
48-
WithEventFilter(predicates.ResourceHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterPredicate)).
48+
WithEventFilter(predicates.ResourceHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
4949
Complete(r)
5050

5151
if err != nil {

controlplane/kubeadm/controllers/alias.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ type KubeadmControlPlaneReconciler struct {
3838
EtcdDialTimeout time.Duration
3939
EtcdCallTimeout time.Duration
4040

41-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
42-
WatchFilterPredicate predicates.LabelMatcher
41+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
42+
WatchFilterValue predicates.LabelMatcher
4343
}
4444

4545
// SetupWithManager sets up the reconciler with the Manager.
4646
func (r *KubeadmControlPlaneReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
4747
return (&kubeadmcontrolplanecontrollers.KubeadmControlPlaneReconciler{
48-
Client: r.Client,
49-
SecretCachingClient: r.SecretCachingClient,
50-
Tracker: r.Tracker,
51-
EtcdDialTimeout: r.EtcdDialTimeout,
52-
EtcdCallTimeout: r.EtcdCallTimeout,
53-
WatchFilterPredicate: r.WatchFilterPredicate,
48+
Client: r.Client,
49+
SecretCachingClient: r.SecretCachingClient,
50+
Tracker: r.Tracker,
51+
EtcdDialTimeout: r.EtcdDialTimeout,
52+
EtcdCallTimeout: r.EtcdCallTimeout,
53+
WatchFilterValue: r.WatchFilterValue,
5454
}).SetupWithManager(ctx, mgr, options)
5555
}

controlplane/kubeadm/internal/controllers/controller.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ type KubeadmControlPlaneReconciler struct {
8080
EtcdDialTimeout time.Duration
8181
EtcdCallTimeout time.Duration
8282

83-
// WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
84-
WatchFilterPredicate predicates.LabelMatcher
83+
// WatchFilterValue is the label selector value used to filter events prior to reconciliation.
84+
WatchFilterValue predicates.LabelMatcher
8585

8686
managementCluster internal.ManagementCluster
8787
managementClusterUncached internal.ManagementCluster
@@ -99,13 +99,13 @@ func (r *KubeadmControlPlaneReconciler) SetupWithManager(ctx context.Context, mg
9999
For(&controlplanev1.KubeadmControlPlane{}).
100100
Owns(&clusterv1.Machine{}).
101101
WithOptions(options).
102-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterPredicate)).
102+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
103103
Watches(
104104
&clusterv1.Cluster{},
105105
handler.EnqueueRequestsFromMapFunc(r.ClusterToKubeadmControlPlane),
106106
builder.WithPredicates(
107107
predicates.All(ctrl.LoggerFrom(ctx),
108-
predicates.ResourceHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterPredicate),
108+
predicates.ResourceHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue),
109109
predicates.ClusterUnpausedAndInfrastructureReady(ctrl.LoggerFrom(ctx)),
110110
),
111111
),

controlplane/kubeadm/main.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -331,21 +331,21 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
331331
}
332332

333333
if err := (&remote.ClusterCacheReconciler{
334-
Client: mgr.GetClient(),
335-
Tracker: tracker,
336-
WatchFilterPredicate: labelSelector,
334+
Client: mgr.GetClient(),
335+
Tracker: tracker,
336+
WatchFilterValue: labelSelector,
337337
}).SetupWithManager(ctx, mgr, concurrency(kubeadmControlPlaneConcurrency)); err != nil {
338338
setupLog.Error(err, "unable to create controller", "controller", "ClusterCacheReconciler")
339339
os.Exit(1)
340340
}
341341

342342
if err := (&kubeadmcontrolplanecontrollers.KubeadmControlPlaneReconciler{
343-
Client: mgr.GetClient(),
344-
SecretCachingClient: secretCachingClient,
345-
Tracker: tracker,
346-
WatchFilterPredicate: labelSelector,
347-
EtcdDialTimeout: etcdDialTimeout,
348-
EtcdCallTimeout: etcdCallTimeout,
343+
Client: mgr.GetClient(),
344+
SecretCachingClient: secretCachingClient,
345+
Tracker: tracker,
346+
WatchFilterValue: labelSelector,
347+
EtcdDialTimeout: etcdDialTimeout,
348+
EtcdCallTimeout: etcdCallTimeout,
349349
}).SetupWithManager(ctx, mgr, concurrency(kubeadmControlPlaneConcurrency)); err != nil {
350350
setupLog.Error(err, "unable to create controller", "controller", "KubeadmControlPlane")
351351
os.Exit(1)

0 commit comments

Comments
 (0)