1- # Stack Concurrency Configuration
1+ # Concurrency Control Configuration
22
33## Overview
44
5- Control the number of Stack reconciliations that run in parallel to prevent cluster overload.
5+ Control the number of concurrent reconciliations (Stacks, Modules, and other resources) that run in parallel to prevent cluster overload and manage deployment pace .
66
77## Configuration
88
@@ -12,14 +12,14 @@ Edit your `values.yaml` or use `--set`:
1212
1313``` yaml
1414operator :
15- stackMaxConcurrent : 5 # Max 5 concurrent stack reconciliations
15+ maxConcurrentReconciles : 5 # Max 5 concurrent reconciliations (all resources)
1616` ` `
1717
1818Or with Helm command:
1919
2020` ` ` bash
2121helm install operator ./helm/operator \
22- --set operator.stackMaxConcurrent =5
22+ --set operator.maxConcurrentReconciles =5
2323```
2424
2525### Default Behavior
@@ -43,7 +43,7 @@ helm install operator ./helm/operator \
4343``` yaml
4444# values.yaml
4545operator :
46- stackMaxConcurrent : 3
46+ maxConcurrentReconciles : 3
4747` ` `
4848
4949` ` ` bash
@@ -55,7 +55,7 @@ helm upgrade operator ./helm/operator -f values.yaml
5555``` yaml
5656# values-prod.yaml
5757operator :
58- stackMaxConcurrent : 10
58+ maxConcurrentReconciles : 10
5959 enableLeaderElection : true
6060 region : " eu-west-1"
6161 env : " production"
@@ -69,16 +69,16 @@ helm upgrade operator ./helm/operator -f values-prod.yaml
6969
7070``` bash
7171helm upgrade operator ./helm/operator \
72- --set operator.stackMaxConcurrent =5 \
72+ --set operator.maxConcurrentReconciles =5 \
7373 --set operator.region=us-east-1
7474```
7575
7676## How It Works
7777
78- 1 . The Helm chart sets the ` STACK_MAX_CONCURRENT ` environment variable
78+ 1 . The Helm chart sets the ` MAX_CONCURRENT_RECONCILES ` environment variable
79792 . The operator reads this value on startup
80- 3 . Stack reconciliations are limited to N concurrent executions
81- 4 . Additional stacks are queued automatically by Kubernetes
80+ 3 . All reconciliations (Stacks, Modules like Ledger/Payments, etc.) are limited to N concurrent executions
81+ 4 . Additional reconciliations are queued automatically by Kubernetes
8282
8383### Behavior
8484
@@ -111,12 +111,12 @@ Check if the environment variable is set:
111111POD=$( kubectl get pods -n formance-system -l control-plane=formance-controller-manager -o jsonpath=' {.items[0].metadata.name}' )
112112
113113# Check environment variables
114- kubectl exec -n formance-system $POD -- env | grep STACK_MAX_CONCURRENT
114+ kubectl exec -n formance-system $POD -- env | grep MAX_CONCURRENT_RECONCILES
115115```
116116
117117Expected output:
118118```
119- STACK_MAX_CONCURRENT =5
119+ MAX_CONCURRENT_RECONCILES =5
120120```
121121
122122## Troubleshooting
@@ -130,7 +130,7 @@ STACK_MAX_CONCURRENT=5
130130
1311312 . ** Verify deployment:**
132132 ``` bash
133- kubectl get deployment operator-manager -n formance-system -o yaml | grep -A 2 " STACK_MAX_CONCURRENT "
133+ kubectl get deployment operator-manager -n formance-system -o yaml | grep -A 2 " MAX_CONCURRENT_RECONCILES "
134134 ```
135135
1361363 . ** Restart pods to apply changes:**
@@ -176,17 +176,17 @@ kubectl logs -n formance-system -l control-plane=formance-controller-manager -f
176176``` yaml
177177# values-dev.yaml
178178operator :
179- stackMaxConcurrent : 2
179+ maxConcurrentReconciles : 2
180180 env : " dev"
181181
182182# values-staging.yaml
183183operator :
184- stackMaxConcurrent : 5
184+ maxConcurrentReconciles : 5
185185 env : " staging"
186186
187187# values-prod.yaml
188188operator :
189- stackMaxConcurrent : 10
189+ maxConcurrentReconciles : 10
190190 env : " production"
191191` ` `
192192
@@ -208,7 +208,7 @@ spec:
208208 helm :
209209 values : |
210210 operator:
211- stackMaxConcurrent : 5
211+ maxConcurrentReconciles : 5
212212 region: "eu-west-1"
213213 env: "production"
214214` ` `
@@ -217,26 +217,30 @@ spec:
217217
218218### Implementation
219219
220- - **Environment Variable:** ` STACK_MAX_CONCURRENT `
221- - **Read by:** `internal/resources/stacks/config .go::GetStackConcurrency ()`
222- - **Applied in:** `internal/resources/stacks/init.go`
220+ - **Environment Variable:** ` MAX_CONCURRENT_RECONCILES `
221+ - **Read by:** `internal/core/concurrency .go::GetMaxConcurrentReconciles ()`
222+ - **Applied in:** All reconcilers (Stacks, Modules, Resources)
223223- **Uses:** Native controller-runtime `MaxConcurrentReconciles`
224224
225225# ## Source Code
226226
227227` ` ` go
228- // internal/resources/stacks/config .go
229- func GetStackConcurrency () int {
230- if v := os.Getenv("STACK_MAX_CONCURRENT "); v != "" {
231- if n, err := strconv.Atoi(v); err == nil && n > 0 {
228+ // internal/core/concurrency .go
229+ func GetMaxConcurrentReconciles () int {
230+ if v := os.Getenv("MAX_CONCURRENT_RECONCILES "); v != "" {
231+ if n, err := strconv.Atoi(v); err == nil && n >= 0 {
232232 return n
233233 }
234234 }
235- return 0 // Default: unlimited
235+ return 5 // Default: 5 concurrent reconciliations
236236}
237237` ` `
238238
239- # # Related Documentation
239+ # # What This Controls
240240
241- - [How to Limit Concurrent Stacks](../../docs/HOW_TO_LIMIT_CONCURRENT_STACKS.md)
242- - [Concurrent Limit Implementation](../../CONCURRENT_LIMIT_IMPLEMENTATION.md)
241+ This setting limits **all types** of reconciliations :
242+ - **Stack reconciliations**: Namespace creation, configuration updates
243+ - **Module reconciliations**: Ledger, Payments, Wallets, Gateway, etc. deployments
244+ - **Resource reconciliations**: Database, Broker, BrokerTopic management
245+
246+ This prevents "big bang" deployments where all resources are processed simultaneously.
0 commit comments