@@ -160,6 +160,12 @@ func main() {
160
160
managerOpts .RetryPeriod = & retryPeriod
161
161
}
162
162
163
+ var maxConcurrentReconciles int
164
+ if maxConcurrentReconcilesEnvValue := getIntEnv (controllers .MaxConcurrentReconciles ); maxConcurrentReconcilesEnvValue > 0 {
165
+ maxConcurrentReconciles = maxConcurrentReconcilesEnvValue
166
+ log .Info (fmt .Sprintf ("maxConcurrentReconciles set to %d" , maxConcurrentReconciles ))
167
+ }
168
+
163
169
if enableDebugPprof , ok := os .LookupEnv ("ENABLE_DEBUG_PPROF" ); ok {
164
170
pprofEnabled , err := strconv .ParseBool (enableDebugPprof )
165
171
if err == nil && pprofEnabled {
@@ -187,6 +193,7 @@ func main() {
187
193
KubernetesClusterDomain : clusterDomain ,
188
194
ReconcileFunc : & controllers.QueueReconciler {},
189
195
ConnectUsingPlainHTTP : usePlainHTTP ,
196
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
190
197
}).SetupWithManager (mgr ); err != nil {
191
198
log .Error (err , "unable to create controller" , "controller" , controllers .QueueControllerName )
192
199
os .Exit (1 )
@@ -202,6 +209,7 @@ func main() {
202
209
KubernetesClusterDomain : clusterDomain ,
203
210
ReconcileFunc : & controllers.ExchangeReconciler {},
204
211
ConnectUsingPlainHTTP : usePlainHTTP ,
212
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
205
213
}).SetupWithManager (mgr ); err != nil {
206
214
log .Error (err , "unable to create controller" , "controller" , controllers .ExchangeControllerName )
207
215
os .Exit (1 )
@@ -217,6 +225,7 @@ func main() {
217
225
KubernetesClusterDomain : clusterDomain ,
218
226
ReconcileFunc : & controllers.BindingReconciler {},
219
227
ConnectUsingPlainHTTP : usePlainHTTP ,
228
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
220
229
}).SetupWithManager (mgr ); err != nil {
221
230
log .Error (err , "unable to create controller" , "controller" , controllers .BindingControllerName )
222
231
os .Exit (1 )
@@ -233,6 +242,7 @@ func main() {
233
242
WatchTypes : []client.Object {},
234
243
ReconcileFunc : & controllers.UserReconciler {Client : mgr .GetClient (), Scheme : mgr .GetScheme ()},
235
244
ConnectUsingPlainHTTP : usePlainHTTP ,
245
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
236
246
}).SetupWithManager (mgr ); err != nil {
237
247
log .Error (err , "unable to create controller" , "controller" , controllers .UserControllerName )
238
248
os .Exit (1 )
@@ -248,6 +258,7 @@ func main() {
248
258
KubernetesClusterDomain : clusterDomain ,
249
259
ReconcileFunc : & controllers.VhostReconciler {Client : mgr .GetClient ()},
250
260
ConnectUsingPlainHTTP : usePlainHTTP ,
261
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
251
262
}).SetupWithManager (mgr ); err != nil {
252
263
log .Error (err , "unable to create controller" , "controller" , controllers .VhostControllerName )
253
264
os .Exit (1 )
@@ -263,6 +274,7 @@ func main() {
263
274
KubernetesClusterDomain : clusterDomain ,
264
275
ReconcileFunc : & controllers.PolicyReconciler {},
265
276
ConnectUsingPlainHTTP : usePlainHTTP ,
277
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
266
278
}).SetupWithManager (mgr ); err != nil {
267
279
log .Error (err , "unable to create controller" , "controller" , controllers .PolicyControllerName )
268
280
os .Exit (1 )
@@ -278,6 +290,7 @@ func main() {
278
290
KubernetesClusterDomain : clusterDomain ,
279
291
ReconcileFunc : & controllers.OperatorPolicyReconciler {},
280
292
ConnectUsingPlainHTTP : usePlainHTTP ,
293
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
281
294
}).SetupWithManager (mgr ); err != nil {
282
295
log .Error (err , "unable to create controller" , "controller" , controllers .OperatorPolicyControllerName )
283
296
os .Exit (1 )
@@ -293,6 +306,7 @@ func main() {
293
306
KubernetesClusterDomain : clusterDomain ,
294
307
ReconcileFunc : & controllers.PermissionReconciler {Client : mgr .GetClient (), Scheme : mgr .GetScheme ()},
295
308
ConnectUsingPlainHTTP : usePlainHTTP ,
309
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
296
310
}).SetupWithManager (mgr ); err != nil {
297
311
log .Error (err , "unable to create controller" , "controller" , controllers .PermissionControllerName )
298
312
os .Exit (1 )
@@ -308,6 +322,7 @@ func main() {
308
322
KubernetesClusterDomain : clusterDomain ,
309
323
ReconcileFunc : & controllers.SchemaReplicationReconciler {Client : mgr .GetClient ()},
310
324
ConnectUsingPlainHTTP : usePlainHTTP ,
325
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
311
326
}).SetupWithManager (mgr ); err != nil {
312
327
log .Error (err , "unable to create controller" , "controller" , controllers .SchemaReplicationControllerName )
313
328
os .Exit (1 )
@@ -323,6 +338,7 @@ func main() {
323
338
KubernetesClusterDomain : clusterDomain ,
324
339
ReconcileFunc : & controllers.FederationReconciler {Client : mgr .GetClient ()},
325
340
ConnectUsingPlainHTTP : usePlainHTTP ,
341
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
326
342
}).SetupWithManager (mgr ); err != nil {
327
343
log .Error (err , "unable to create controller" , "controller" , controllers .FederationControllerName )
328
344
os .Exit (1 )
@@ -338,6 +354,7 @@ func main() {
338
354
KubernetesClusterDomain : clusterDomain ,
339
355
ReconcileFunc : & controllers.ShovelReconciler {Client : mgr .GetClient ()},
340
356
ConnectUsingPlainHTTP : usePlainHTTP ,
357
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
341
358
}).SetupWithManager (mgr ); err != nil {
342
359
log .Error (err , "unable to create controller" , "controller" , controllers .ShovelControllerName )
343
360
os .Exit (1 )
@@ -353,17 +370,19 @@ func main() {
353
370
KubernetesClusterDomain : clusterDomain ,
354
371
ReconcileFunc : & controllers.TopicPermissionReconciler {Client : mgr .GetClient (), Scheme : mgr .GetScheme ()},
355
372
ConnectUsingPlainHTTP : usePlainHTTP ,
373
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
356
374
}).SetupWithManager (mgr ); err != nil {
357
375
log .Error (err , "unable to create controller" , "controller" , controllers .TopicPermissionControllerName )
358
376
os .Exit (1 )
359
377
}
360
378
361
379
if err = (& controllers.SuperStreamReconciler {
362
- Client : mgr .GetClient (),
363
- Log : ctrl .Log .WithName (controllers .SuperStreamControllerName ),
364
- Scheme : mgr .GetScheme (),
365
- Recorder : mgr .GetEventRecorderFor (controllers .SuperStreamControllerName ),
366
- RabbitmqClientFactory : rabbitmqclient .RabbitholeClientFactory ,
380
+ Client : mgr .GetClient (),
381
+ Log : ctrl .Log .WithName (controllers .SuperStreamControllerName ),
382
+ Scheme : mgr .GetScheme (),
383
+ Recorder : mgr .GetEventRecorderFor (controllers .SuperStreamControllerName ),
384
+ RabbitmqClientFactory : rabbitmqclient .RabbitholeClientFactory ,
385
+ MaxConcurrentReconciles : maxConcurrentReconciles ,
367
386
}).SetupWithManager (mgr ); err != nil {
368
387
log .Error (err , "unable to create controller" , "controller" , controllers .SuperStreamControllerName )
369
388
os .Exit (1 )
@@ -456,3 +475,15 @@ func getBoolEnv(envName string) bool {
456
475
}
457
476
return boolVar
458
477
}
478
+
479
+ func getIntEnv (envName string ) int {
480
+ var intVar int
481
+ if initStr , ok := os .LookupEnv (envName ); ok {
482
+ var err error
483
+ if intVar , err = strconv .Atoi (initStr ); err != nil {
484
+ log .Error (err , fmt .Sprintf ("unable to parse provided '%s'" , envName ))
485
+ os .Exit (1 )
486
+ }
487
+ }
488
+ return intVar
489
+ }
0 commit comments