@@ -35,6 +35,7 @@ import (
35
35
machinedeploymenttopologycontroller "sigs.k8s.io/cluster-api/internal/controllers/topology/machinedeployment"
36
36
machinesettopologycontroller "sigs.k8s.io/cluster-api/internal/controllers/topology/machineset"
37
37
runtimeclient "sigs.k8s.io/cluster-api/internal/runtime/client"
38
+ "sigs.k8s.io/cluster-api/util/predicates"
38
39
)
39
40
40
41
// Following types provides access to reconcilers implemented in internal/controllers, thus
@@ -46,16 +47,16 @@ type ClusterReconciler struct {
46
47
UnstructuredCachingClient client.Client
47
48
APIReader client.Reader
48
49
49
- // WatchFilterValue is the label value used to filter events prior to reconciliation.
50
- WatchFilterValue string
50
+ // WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
51
+ WatchFilterPredicate predicates. LabelMatcher
51
52
}
52
53
53
54
func (r * ClusterReconciler ) SetupWithManager (ctx context.Context , mgr ctrl.Manager , options controller.Options ) error {
54
55
return (& clustercontroller.Reconciler {
55
56
Client : r .Client ,
56
57
UnstructuredCachingClient : r .UnstructuredCachingClient ,
57
58
APIReader : r .APIReader ,
58
- WatchFilterValue : r . WatchFilterValue ,
59
+ WatchFilterPredicate : r . WatchFilterPredicate ,
59
60
}).SetupWithManager (ctx , mgr , options )
60
61
}
61
62
@@ -66,8 +67,8 @@ type MachineReconciler struct {
66
67
APIReader client.Reader
67
68
Tracker * remote.ClusterCacheTracker
68
69
69
- // WatchFilterValue is the label value used to filter events prior to reconciliation.
70
- WatchFilterValue string
70
+ // WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
71
+ WatchFilterPredicate predicates. LabelMatcher
71
72
72
73
// NodeDrainClientTimeout timeout of the client used for draining nodes.
73
74
NodeDrainClientTimeout time.Duration
@@ -79,7 +80,7 @@ func (r *MachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manag
79
80
UnstructuredCachingClient : r .UnstructuredCachingClient ,
80
81
APIReader : r .APIReader ,
81
82
Tracker : r .Tracker ,
82
- WatchFilterValue : r . WatchFilterValue ,
83
+ WatchFilterPredicate : r . WatchFilterPredicate ,
83
84
NodeDrainClientTimeout : r .NodeDrainClientTimeout ,
84
85
}).SetupWithManager (ctx , mgr , options )
85
86
}
@@ -91,8 +92,8 @@ type MachineSetReconciler struct {
91
92
APIReader client.Reader
92
93
Tracker * remote.ClusterCacheTracker
93
94
94
- // WatchFilterValue is the label value used to filter events prior to reconciliation.
95
- WatchFilterValue string
95
+ // WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
96
+ WatchFilterPredicate predicates. LabelMatcher
96
97
}
97
98
98
99
func (r * MachineSetReconciler ) SetupWithManager (ctx context.Context , mgr ctrl.Manager , options controller.Options ) error {
@@ -101,7 +102,7 @@ func (r *MachineSetReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
101
102
UnstructuredCachingClient : r .UnstructuredCachingClient ,
102
103
APIReader : r .APIReader ,
103
104
Tracker : r .Tracker ,
104
- WatchFilterValue : r . WatchFilterValue ,
105
+ WatchFilterPredicate : r . WatchFilterPredicate ,
105
106
}).SetupWithManager (ctx , mgr , options )
106
107
}
107
108
@@ -111,16 +112,16 @@ type MachineDeploymentReconciler struct {
111
112
UnstructuredCachingClient client.Client
112
113
APIReader client.Reader
113
114
114
- // WatchFilterValue is the label value used to filter events prior to reconciliation.
115
- WatchFilterValue string
115
+ // WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
116
+ WatchFilterPredicate predicates. LabelMatcher
116
117
}
117
118
118
119
func (r * MachineDeploymentReconciler ) SetupWithManager (ctx context.Context , mgr ctrl.Manager , options controller.Options ) error {
119
120
return (& machinedeploymentcontroller.Reconciler {
120
121
Client : r .Client ,
121
122
UnstructuredCachingClient : r .UnstructuredCachingClient ,
122
123
APIReader : r .APIReader ,
123
- WatchFilterValue : r . WatchFilterValue ,
124
+ WatchFilterPredicate : r . WatchFilterPredicate ,
124
125
}).SetupWithManager (ctx , mgr , options )
125
126
}
126
127
@@ -129,15 +130,15 @@ type MachineHealthCheckReconciler struct {
129
130
Client client.Client
130
131
Tracker * remote.ClusterCacheTracker
131
132
132
- // WatchFilterValue is the label value used to filter events prior to reconciliation.
133
- WatchFilterValue string
133
+ // WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
134
+ WatchFilterPredicate predicates. LabelMatcher
134
135
}
135
136
136
137
func (r * MachineHealthCheckReconciler ) SetupWithManager (ctx context.Context , mgr ctrl.Manager , options controller.Options ) error {
137
138
return (& machinehealthcheckcontroller.Reconciler {
138
- Client : r .Client ,
139
- Tracker : r .Tracker ,
140
- WatchFilterValue : r .WatchFilterValue ,
139
+ Client : r .Client ,
140
+ Tracker : r .Tracker ,
141
+ WatchFilterPredicate : r .WatchFilterPredicate ,
141
142
}).SetupWithManager (ctx , mgr , options )
142
143
}
143
144
@@ -150,8 +151,8 @@ type ClusterTopologyReconciler struct {
150
151
151
152
RuntimeClient runtimeclient.Client
152
153
153
- // WatchFilterValue is the label value used to filter events prior to reconciliation.
154
- WatchFilterValue string
154
+ // WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
155
+ WatchFilterPredicate predicates. LabelMatcher
155
156
156
157
// UnstructuredCachingClient provides a client that forces caching of unstructured objects,
157
158
// thus allowing to optimize reads for templates or provider specific objects in a managed topology.
@@ -164,7 +165,7 @@ func (r *ClusterTopologyReconciler) SetupWithManager(ctx context.Context, mgr ct
164
165
APIReader : r .APIReader ,
165
166
RuntimeClient : r .RuntimeClient ,
166
167
UnstructuredCachingClient : r .UnstructuredCachingClient ,
167
- WatchFilterValue : r . WatchFilterValue ,
168
+ WatchFilterPredicate : r . WatchFilterPredicate ,
168
169
}).SetupWithManager (ctx , mgr , options )
169
170
}
170
171
@@ -176,15 +177,15 @@ type MachineDeploymentTopologyReconciler struct {
176
177
Client client.Client
177
178
// APIReader is used to list MachineSets directly via the API server to avoid
178
179
// race conditions caused by an outdated cache.
179
- APIReader client.Reader
180
- WatchFilterValue string
180
+ APIReader client.Reader
181
+ WatchFilterPredicate predicates. LabelMatcher
181
182
}
182
183
183
184
func (r * MachineDeploymentTopologyReconciler ) SetupWithManager (ctx context.Context , mgr ctrl.Manager , options controller.Options ) error {
184
185
return (& machinedeploymenttopologycontroller.Reconciler {
185
- Client : r .Client ,
186
- APIReader : r .APIReader ,
187
- WatchFilterValue : r .WatchFilterValue ,
186
+ Client : r .Client ,
187
+ APIReader : r .APIReader ,
188
+ WatchFilterPredicate : r .WatchFilterPredicate ,
188
189
}).SetupWithManager (ctx , mgr , options )
189
190
}
190
191
@@ -196,15 +197,15 @@ type MachineSetTopologyReconciler struct {
196
197
Client client.Client
197
198
// APIReader is used to list MachineSets directly via the API server to avoid
198
199
// race conditions caused by an outdated cache.
199
- APIReader client.Reader
200
- WatchFilterValue string
200
+ APIReader client.Reader
201
+ WatchFilterPredicate predicates. LabelMatcher
201
202
}
202
203
203
204
func (r * MachineSetTopologyReconciler ) SetupWithManager (ctx context.Context , mgr ctrl.Manager , options controller.Options ) error {
204
205
return (& machinesettopologycontroller.Reconciler {
205
- Client : r .Client ,
206
- APIReader : r .APIReader ,
207
- WatchFilterValue : r .WatchFilterValue ,
206
+ Client : r .Client ,
207
+ APIReader : r .APIReader ,
208
+ WatchFilterPredicate : r .WatchFilterPredicate ,
208
209
}).SetupWithManager (ctx , mgr , options )
209
210
}
210
211
@@ -216,8 +217,8 @@ type ClusterClassReconciler struct {
216
217
// RuntimeClient is a client for calling runtime extensions.
217
218
RuntimeClient runtimeclient.Client
218
219
219
- // WatchFilterValue is the label value used to filter events prior to reconciliation.
220
- WatchFilterValue string
220
+ // WatchFilterPredicate is the label selector value used to filter events prior to reconciliation.
221
+ WatchFilterPredicate predicates. LabelMatcher
221
222
222
223
// UnstructuredCachingClient provides a client that forces caching of unstructured objects,
223
224
// thus allowing to optimize reads for templates or provider specific objects.
@@ -230,6 +231,6 @@ func (r *ClusterClassReconciler) SetupWithManager(ctx context.Context, mgr ctrl.
230
231
APIReader : r .APIReader ,
231
232
RuntimeClient : r .RuntimeClient ,
232
233
UnstructuredCachingClient : r .UnstructuredCachingClient ,
233
- WatchFilterValue : r . WatchFilterValue ,
234
+ WatchFilterPredicate : r . WatchFilterPredicate ,
234
235
}).SetupWithManager (ctx , mgr , options )
235
236
}
0 commit comments