5151 logOptions = logs .NewOptions ()
5252 webhookPort int
5353 webhookCertDir string
54+
55+ // Flags for reconciler concurrency
56+ ociClusterConcurrency int
57+ ociMachineConcurrency int
58+ ociMachinePoolConcurrency int
5459)
5560
5661const (
@@ -88,6 +93,24 @@ func main() {
8893 )
8994 flag .StringVar (& webhookCertDir , "webhook-cert-dir" , "/tmp/k8s-webhook-server/serving-certs/" ,
9095 "Webhook cert dir, only used when webhook-port is specified." )
96+ flag .IntVar (
97+ & ociClusterConcurrency ,
98+ "ocicluster-concurrency" ,
99+ 5 ,
100+ "Number of OciClusters to process simultaneously" ,
101+ )
102+ flag .IntVar (
103+ & ociMachineConcurrency ,
104+ "ocimachine-concurrency" ,
105+ 10 ,
106+ "Number of OciMachines to process simultaneously" ,
107+ )
108+ flag .IntVar (
109+ & ociMachinePoolConcurrency ,
110+ "ocimachinepool-concurrency" ,
111+ 5 ,
112+ "Number of OciMachinePools to process simultaneously" ,
113+ )
91114
92115 opts := zap.Options {
93116 Development : true ,
@@ -166,7 +189,7 @@ func main() {
166189 Region : region ,
167190 ClientProvider : clientProvider ,
168191 Recorder : mgr .GetEventRecorderFor ("ocicluster-controller" ),
169- }).SetupWithManager (ctx , mgr , controller.Options {}); err != nil {
192+ }).SetupWithManager (ctx , mgr , controller.Options {MaxConcurrentReconciles : ociClusterConcurrency }); err != nil {
170193 setupLog .Error (err , "unable to create controller" , "controller" , scope .OCIClusterKind )
171194 os .Exit (1 )
172195 }
@@ -177,7 +200,7 @@ func main() {
177200 ClientProvider : clientProvider ,
178201 Region : region ,
179202 Recorder : mgr .GetEventRecorderFor ("ocimachine-controller" ),
180- }).SetupWithManager (ctx , mgr , controller.Options {}); err != nil {
203+ }).SetupWithManager (ctx , mgr , controller.Options {MaxConcurrentReconciles : ociMachineConcurrency }); err != nil {
181204 setupLog .Error (err , "unable to create controller" , "controller" , scope .OCIMachineKind )
182205 os .Exit (1 )
183206 }
@@ -191,7 +214,7 @@ func main() {
191214 ClientProvider : clientProvider ,
192215 Recorder : mgr .GetEventRecorderFor ("ocimachinepool-controller" ),
193216 Region : region ,
194- }).SetupWithManager (ctx , mgr , controller.Options {}); err != nil {
217+ }).SetupWithManager (ctx , mgr , controller.Options {MaxConcurrentReconciles : ociMachinePoolConcurrency }); err != nil {
195218 setupLog .Error (err , "unable to create controller" , "controller" , scope .OCIMachinePoolKind )
196219 os .Exit (1 )
197220 }
@@ -205,7 +228,7 @@ func main() {
205228 Region : region ,
206229 ClientProvider : clientProvider ,
207230 Recorder : mgr .GetEventRecorderFor ("ocimanagedmachinepool-controller" ),
208- }).SetupWithManager (ctx , mgr , controller.Options {}); err != nil {
231+ }).SetupWithManager (ctx , mgr , controller.Options {MaxConcurrentReconciles : ociMachinePoolConcurrency }); err != nil {
209232 setupLog .Error (err , "unable to create controller" , "controller" , scope .OCIManagedMachinePoolKind )
210233 os .Exit (1 )
211234 }
@@ -216,7 +239,7 @@ func main() {
216239 Region : region ,
217240 ClientProvider : clientProvider ,
218241 Recorder : mgr .GetEventRecorderFor ("ocimanagedcluster-controller" ),
219- }).SetupWithManager (ctx , mgr , controller.Options {}); err != nil {
242+ }).SetupWithManager (ctx , mgr , controller.Options {MaxConcurrentReconciles : ociClusterConcurrency }); err != nil {
220243 setupLog .Error (err , "unable to create controller" , "controller" , scope .OCIManagedClusterKind )
221244 os .Exit (1 )
222245 }
@@ -227,7 +250,7 @@ func main() {
227250 Region : region ,
228251 ClientProvider : clientProvider ,
229252 Recorder : mgr .GetEventRecorderFor ("ocimanagedclustercontrolplane-controller" ),
230- }).SetupWithManager (ctx , mgr , controller.Options {}); err != nil {
253+ }).SetupWithManager (ctx , mgr , controller.Options {MaxConcurrentReconciles : ociClusterConcurrency }); err != nil {
231254 setupLog .Error (err , "unable to create controller" , "controller" , scope .OCIManagedClusterControlPlaneKind )
232255 os .Exit (1 )
233256 }
0 commit comments