Skip to content

Commit 5e8d578

Browse files
author
Danil-Grigorev
committed
Limit manager concurrency on concurrencyNumber
Signed-off-by: Danil-Grigorev <[email protected]>
1 parent be0efd3 commit 5e8d578

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ import (
4040
ctrl "sigs.k8s.io/controller-runtime"
4141
"sigs.k8s.io/controller-runtime/pkg/cache"
4242
"sigs.k8s.io/controller-runtime/pkg/client"
43+
"sigs.k8s.io/controller-runtime/pkg/config"
4344
"sigs.k8s.io/controller-runtime/pkg/controller"
4445
"sigs.k8s.io/controller-runtime/pkg/healthz"
46+
4547
ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
4648

4749
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
@@ -63,6 +65,7 @@ var (
6365
profilerAddress string
6466
enableContentionProfiling bool
6567
concurrencyNumber int
68+
managerConcurrency int
6669
syncPeriod time.Duration
6770
webhookPort int
6871
webhookCertDir string
@@ -113,6 +116,9 @@ func InitFlags(fs *pflag.FlagSet) {
113116
fs.IntVar(&concurrencyNumber, "concurrency", 1,
114117
"Number of core resources to process simultaneously")
115118

119+
fs.IntVar(&managerConcurrency, "manager-concurrency", 10,
120+
"Number of concurrent reconciles to process simultaneously across all controllers")
121+
116122
fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute,
117123
"The minimum interval at which watched resources are reconciled (e.g. 15m)")
118124

@@ -174,6 +180,9 @@ func main() {
174180
},
175181
},
176182
},
183+
Controller: config.Controller{
184+
MaxConcurrentReconciles: managerConcurrency,
185+
},
177186
WebhookServer: ctrlwebhook.NewServer(
178187
ctrlwebhook.Options{
179188
Port: webhookPort,

0 commit comments

Comments
 (0)