70
70
webhookCertDir string
71
71
healthAddr string
72
72
watchConfigSecretChanges bool
73
+ watchConfigMapChanges bool
73
74
managerOptions = flags.ManagerOptions {}
74
75
)
75
76
@@ -103,6 +104,9 @@ func InitFlags(fs *pflag.FlagSet) {
103
104
fs .BoolVar (& watchConfigSecretChanges , "watch-configsecret" , false ,
104
105
"Watch for changes to the ConfigSecret resource and reconcile all providers using it." )
105
106
107
+ fs .BoolVar (& watchConfigMapChanges , "watch-configmap" , false ,
108
+ "Watch for changes to ConfigMaps used by providers with fetchConfig.selector and reconcile all providers using them." )
109
+
106
110
fs .StringVar (& watchNamespace , "namespace" , "" ,
107
111
"Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces." )
108
112
@@ -201,7 +205,7 @@ func main() {
201
205
ctx := ctrl .SetupSignalHandler ()
202
206
203
207
setupChecks (mgr )
204
- setupReconcilers (ctx , mgr , watchConfigSecretChanges )
208
+ setupReconcilers (ctx , mgr , watchConfigSecretChanges , watchConfigMapChanges )
205
209
setupWebhooks (mgr )
206
210
207
211
// +kubebuilder:scaffold:builder
@@ -225,13 +229,14 @@ func setupChecks(mgr ctrl.Manager) {
225
229
}
226
230
}
227
231
228
- func setupReconcilers (ctx context.Context , mgr ctrl.Manager , watchConfigSecretChanges bool ) {
232
+ func setupReconcilers (ctx context.Context , mgr ctrl.Manager , watchConfigSecretChanges , watchConfigMapChanges bool ) {
229
233
if err := (& providercontroller.GenericProviderReconciler {
230
234
Provider : & operatorv1.CoreProvider {},
231
235
ProviderList : & operatorv1.CoreProviderList {},
232
236
Client : mgr .GetClient (),
233
237
Config : mgr .GetConfig (),
234
238
WatchConfigSecretChanges : watchConfigSecretChanges ,
239
+ WatchConfigMapChanges : watchConfigMapChanges ,
235
240
}).SetupWithManager (ctx , mgr , concurrency (concurrencyNumber )); err != nil {
236
241
setupLog .Error (err , "unable to create controller" , "controller" , "CoreProvider" )
237
242
os .Exit (1 )
@@ -243,6 +248,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchConfigSecretCh
243
248
Client : mgr .GetClient (),
244
249
Config : mgr .GetConfig (),
245
250
WatchConfigSecretChanges : watchConfigSecretChanges ,
251
+ WatchConfigMapChanges : watchConfigMapChanges ,
246
252
WatchCoreProviderChanges : true ,
247
253
}).SetupWithManager (ctx , mgr , concurrency (concurrencyNumber )); err != nil {
248
254
setupLog .Error (err , "unable to create controller" , "controller" , "InfrastructureProvider" )
@@ -255,6 +261,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchConfigSecretCh
255
261
Client : mgr .GetClient (),
256
262
Config : mgr .GetConfig (),
257
263
WatchConfigSecretChanges : watchConfigSecretChanges ,
264
+ WatchConfigMapChanges : watchConfigMapChanges ,
258
265
WatchCoreProviderChanges : true ,
259
266
}).SetupWithManager (ctx , mgr , concurrency (concurrencyNumber )); err != nil {
260
267
setupLog .Error (err , "unable to create controller" , "controller" , "BootstrapProvider" )
@@ -267,6 +274,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchConfigSecretCh
267
274
Client : mgr .GetClient (),
268
275
Config : mgr .GetConfig (),
269
276
WatchConfigSecretChanges : watchConfigSecretChanges ,
277
+ WatchConfigMapChanges : watchConfigMapChanges ,
270
278
WatchCoreProviderChanges : true ,
271
279
}).SetupWithManager (ctx , mgr , concurrency (concurrencyNumber )); err != nil {
272
280
setupLog .Error (err , "unable to create controller" , "controller" , "ControlPlaneProvider" )
@@ -279,6 +287,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchConfigSecretCh
279
287
Client : mgr .GetClient (),
280
288
Config : mgr .GetConfig (),
281
289
WatchConfigSecretChanges : watchConfigSecretChanges ,
290
+ WatchConfigMapChanges : watchConfigMapChanges ,
282
291
WatchCoreProviderChanges : true ,
283
292
}).SetupWithManager (ctx , mgr , concurrency (concurrencyNumber )); err != nil {
284
293
setupLog .Error (err , "unable to create controller" , "controller" , "AddonProvider" )
@@ -291,6 +300,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchConfigSecretCh
291
300
Client : mgr .GetClient (),
292
301
Config : mgr .GetConfig (),
293
302
WatchConfigSecretChanges : watchConfigSecretChanges ,
303
+ WatchConfigMapChanges : watchConfigMapChanges ,
294
304
WatchCoreProviderChanges : true ,
295
305
}).SetupWithManager (ctx , mgr , concurrency (concurrencyNumber )); err != nil {
296
306
setupLog .Error (err , "unable to create controller" , "controller" , "IPAMProvider" )
@@ -303,6 +313,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchConfigSecretCh
303
313
Client : mgr .GetClient (),
304
314
Config : mgr .GetConfig (),
305
315
WatchConfigSecretChanges : watchConfigSecretChanges ,
316
+ WatchConfigMapChanges : watchConfigMapChanges ,
306
317
WatchCoreProviderChanges : true ,
307
318
}).SetupWithManager (ctx , mgr , concurrency (concurrencyNumber )); err != nil {
308
319
setupLog .Error (err , "unable to create controller" , "controller" , "RuntimeExtensionProvider" )
0 commit comments