67
67
webhookPort int
68
68
webhookCertDir string
69
69
healthAddr string
70
+ watchConfigSecretChanges bool
70
71
diagnosticsOptions = flags.DiagnosticsOptions {}
71
72
)
72
73
@@ -98,6 +99,9 @@ func InitFlags(fs *pflag.FlagSet) {
98
99
fs .StringVar (& watchFilterValue , "watch-filter" , "" ,
99
100
fmt .Sprintf ("Label value that the controller watches to reconcile cluster-api objects. Label key is always %s. If unspecified, the controller watches for all cluster-api objects." , clusterv1 .WatchLabel ))
100
101
102
+ fs .BoolVar (& watchConfigSecretChanges , "watch-configsecret" , false ,
103
+ "Watch for changes to the ConfigSecret resource and reconcile all providers using it." )
104
+
101
105
fs .StringVar (& watchNamespace , "namespace" , "" ,
102
106
"Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces." )
103
107
@@ -185,7 +189,7 @@ func main() {
185
189
ctx := ctrl .SetupSignalHandler ()
186
190
187
191
setupChecks (mgr )
188
- setupReconcilers (mgr )
192
+ setupReconcilers (mgr , watchConfigSecretChanges )
189
193
setupWebhooks (mgr )
190
194
191
195
// +kubebuilder:scaffold:builder
@@ -209,72 +213,79 @@ func setupChecks(mgr ctrl.Manager) {
209
213
}
210
214
}
211
215
212
- func setupReconcilers (mgr ctrl.Manager ) {
216
+ func setupReconcilers (mgr ctrl.Manager , watchConfigSecretChanges bool ) {
213
217
if err := (& providercontroller.GenericProviderReconciler {
214
- Provider : & operatorv1.CoreProvider {},
215
- ProviderList : & operatorv1.CoreProviderList {},
216
- Client : mgr .GetClient (),
217
- Config : mgr .GetConfig (),
218
+ Provider : & operatorv1.CoreProvider {},
219
+ ProviderList : & operatorv1.CoreProviderList {},
220
+ Client : mgr .GetClient (),
221
+ Config : mgr .GetConfig (),
222
+ WatchConfigSecretChanges : watchConfigSecretChanges ,
218
223
}).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
219
224
setupLog .Error (err , "unable to create controller" , "controller" , "CoreProvider" )
220
225
os .Exit (1 )
221
226
}
222
227
223
228
if err := (& providercontroller.GenericProviderReconciler {
224
- Provider : & operatorv1.InfrastructureProvider {},
225
- ProviderList : & operatorv1.InfrastructureProviderList {},
226
- Client : mgr .GetClient (),
227
- Config : mgr .GetConfig (),
229
+ Provider : & operatorv1.InfrastructureProvider {},
230
+ ProviderList : & operatorv1.InfrastructureProviderList {},
231
+ Client : mgr .GetClient (),
232
+ Config : mgr .GetConfig (),
233
+ WatchConfigSecretChanges : watchConfigSecretChanges ,
228
234
}).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
229
235
setupLog .Error (err , "unable to create controller" , "controller" , "InfrastructureProvider" )
230
236
os .Exit (1 )
231
237
}
232
238
233
239
if err := (& providercontroller.GenericProviderReconciler {
234
- Provider : & operatorv1.BootstrapProvider {},
235
- ProviderList : & operatorv1.BootstrapProviderList {},
236
- Client : mgr .GetClient (),
237
- Config : mgr .GetConfig (),
240
+ Provider : & operatorv1.BootstrapProvider {},
241
+ ProviderList : & operatorv1.BootstrapProviderList {},
242
+ Client : mgr .GetClient (),
243
+ Config : mgr .GetConfig (),
244
+ WatchConfigSecretChanges : watchConfigSecretChanges ,
238
245
}).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
239
246
setupLog .Error (err , "unable to create controller" , "controller" , "BootstrapProvider" )
240
247
os .Exit (1 )
241
248
}
242
249
243
250
if err := (& providercontroller.GenericProviderReconciler {
244
- Provider : & operatorv1.ControlPlaneProvider {},
245
- ProviderList : & operatorv1.ControlPlaneProviderList {},
246
- Client : mgr .GetClient (),
247
- Config : mgr .GetConfig (),
251
+ Provider : & operatorv1.ControlPlaneProvider {},
252
+ ProviderList : & operatorv1.ControlPlaneProviderList {},
253
+ Client : mgr .GetClient (),
254
+ Config : mgr .GetConfig (),
255
+ WatchConfigSecretChanges : watchConfigSecretChanges ,
248
256
}).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
249
257
setupLog .Error (err , "unable to create controller" , "controller" , "ControlPlaneProvider" )
250
258
os .Exit (1 )
251
259
}
252
260
253
261
if err := (& providercontroller.GenericProviderReconciler {
254
- Provider : & operatorv1.AddonProvider {},
255
- ProviderList : & operatorv1.AddonProviderList {},
256
- Client : mgr .GetClient (),
257
- Config : mgr .GetConfig (),
262
+ Provider : & operatorv1.AddonProvider {},
263
+ ProviderList : & operatorv1.AddonProviderList {},
264
+ Client : mgr .GetClient (),
265
+ Config : mgr .GetConfig (),
266
+ WatchConfigSecretChanges : watchConfigSecretChanges ,
258
267
}).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
259
268
setupLog .Error (err , "unable to create controller" , "controller" , "AddonProvider" )
260
269
os .Exit (1 )
261
270
}
262
271
263
272
if err := (& providercontroller.GenericProviderReconciler {
264
- Provider : & operatorv1.IPAMProvider {},
265
- ProviderList : & operatorv1.IPAMProviderList {},
266
- Client : mgr .GetClient (),
267
- Config : mgr .GetConfig (),
273
+ Provider : & operatorv1.IPAMProvider {},
274
+ ProviderList : & operatorv1.IPAMProviderList {},
275
+ Client : mgr .GetClient (),
276
+ Config : mgr .GetConfig (),
277
+ WatchConfigSecretChanges : watchConfigSecretChanges ,
268
278
}).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
269
279
setupLog .Error (err , "unable to create controller" , "controller" , "IPAMProvider" )
270
280
os .Exit (1 )
271
281
}
272
282
273
283
if err := (& providercontroller.GenericProviderReconciler {
274
- Provider : & operatorv1.RuntimeExtensionProvider {},
275
- ProviderList : & operatorv1.RuntimeExtensionProviderList {},
276
- Client : mgr .GetClient (),
277
- Config : mgr .GetConfig (),
284
+ Provider : & operatorv1.RuntimeExtensionProvider {},
285
+ ProviderList : & operatorv1.RuntimeExtensionProviderList {},
286
+ Client : mgr .GetClient (),
287
+ Config : mgr .GetConfig (),
288
+ WatchConfigSecretChanges : watchConfigSecretChanges ,
278
289
}).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
279
290
setupLog .Error (err , "unable to create controller" , "controller" , "RuntimeExtensionProvider" )
280
291
os .Exit (1 )
0 commit comments