6767 webhookPort int
6868 webhookCertDir string
6969 healthAddr string
70+ watchConfigSecretChanges bool
7071 diagnosticsOptions = flags.DiagnosticsOptions {}
7172)
7273
@@ -98,6 +99,9 @@ func InitFlags(fs *pflag.FlagSet) {
9899 fs .StringVar (& watchFilterValue , "watch-filter" , "" ,
99100 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 ))
100101
102+ fs .BoolVar (& watchConfigSecretChanges , "watch-configsecret" , false ,
103+ "Watch for changes to the ConfigSecret resource and reconcile all providers using it." )
104+
101105 fs .StringVar (& watchNamespace , "namespace" , "" ,
102106 "Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces." )
103107
@@ -185,7 +189,7 @@ func main() {
185189 ctx := ctrl .SetupSignalHandler ()
186190
187191 setupChecks (mgr )
188- setupReconcilers (mgr )
192+ setupReconcilers (mgr , watchConfigSecretChanges )
189193 setupWebhooks (mgr )
190194
191195 // +kubebuilder:scaffold:builder
@@ -209,72 +213,79 @@ func setupChecks(mgr ctrl.Manager) {
209213 }
210214}
211215
212- func setupReconcilers (mgr ctrl.Manager ) {
216+ func setupReconcilers (mgr ctrl.Manager , watchConfigSecretChanges bool ) {
213217 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 ,
218223 }).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
219224 setupLog .Error (err , "unable to create controller" , "controller" , "CoreProvider" )
220225 os .Exit (1 )
221226 }
222227
223228 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 ,
228234 }).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
229235 setupLog .Error (err , "unable to create controller" , "controller" , "InfrastructureProvider" )
230236 os .Exit (1 )
231237 }
232238
233239 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 ,
238245 }).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
239246 setupLog .Error (err , "unable to create controller" , "controller" , "BootstrapProvider" )
240247 os .Exit (1 )
241248 }
242249
243250 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 ,
248256 }).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
249257 setupLog .Error (err , "unable to create controller" , "controller" , "ControlPlaneProvider" )
250258 os .Exit (1 )
251259 }
252260
253261 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 ,
258267 }).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
259268 setupLog .Error (err , "unable to create controller" , "controller" , "AddonProvider" )
260269 os .Exit (1 )
261270 }
262271
263272 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 ,
268278 }).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
269279 setupLog .Error (err , "unable to create controller" , "controller" , "IPAMProvider" )
270280 os .Exit (1 )
271281 }
272282
273283 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 ,
278289 }).SetupWithManager (mgr , concurrency (concurrencyNumber )); err != nil {
279290 setupLog .Error (err , "unable to create controller" , "controller" , "RuntimeExtensionProvider" )
280291 os .Exit (1 )
0 commit comments