6262 let controller = kube_runtime:: controller:: Controller :: new (
6363 Api :: < Ctx :: Resource > :: namespaced ( client. clone ( ) , namespace) ,
6464 wc,
65+ )
66+ . with_config (
67+ kube_runtime:: Config :: default ( )
68+ . concurrency ( Ctx :: MAX_CONCURRENT_RECILIATIONS . to_owned ( ) ) ,
6569 ) ;
6670 Self {
6771 client,
9195 let controller = kube_runtime:: controller:: Controller :: new (
9296 Api :: < Ctx :: Resource > :: all ( client. clone ( ) ) ,
9397 wc,
98+ )
99+ . with_config (
100+ kube_runtime:: Config :: default ( )
101+ . concurrency ( Ctx :: MAX_CONCURRENT_RECILIATIONS . to_owned ( ) ) ,
94102 ) ;
95103 Self {
96104 client,
@@ -117,6 +125,10 @@ where
117125 let controller = kube_runtime:: controller:: Controller :: new (
118126 Api :: < Ctx :: Resource > :: all ( client. clone ( ) ) ,
119127 wc,
128+ )
129+ . with_config (
130+ kube_runtime:: Config :: default ( )
131+ . concurrency ( Ctx :: MAX_CONCURRENT_RECILIATIONS . to_owned ( ) ) ,
120132 ) ;
121133 Self {
122134 client,
@@ -209,6 +221,12 @@ pub trait Context {
209221 /// run against the same resource, unexpected behavior can occur.
210222 const FINALIZER_NAME : & ' static str ;
211223
224+ /// Max objects to reconcile concurrently.
225+ /// Set to 0 for unbound concurrency.
226+ /// Regardless of this attribute a given object
227+ /// will not be reconciled twice at the same time.
228+ const MAX_CONCURRENT_RECILIATIONS : & ' static u16 = & 0u16 ;
229+
212230 /// This method is called when a watched resource is created or updated.
213231 /// The [`Client`] used by the controller is passed in to allow making
214232 /// additional API requests, as is the resource which triggered this
0 commit comments