Skip to content

Commit 3c5b047

Browse files
authored
Merge pull request #9116 from chrischdi/pr-separate-concurrency-cc-tracker
🌱 Add separate concurrency flag for cluster cache tracker
2 parents 4bc48af + 807e0eb commit 3c5b047

File tree

4 files changed

+87
-70
lines changed

4 files changed

+87
-70
lines changed

bootstrap/kubeadm/main.go

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -76,26 +76,27 @@ func init() {
7676
}
7777

7878
var (
79-
metricsBindAddr string
80-
enableLeaderElection bool
81-
leaderElectionLeaseDuration time.Duration
82-
leaderElectionRenewDeadline time.Duration
83-
leaderElectionRetryPeriod time.Duration
84-
watchFilterValue string
85-
watchNamespace string
86-
profilerAddress string
87-
enableContentionProfiling bool
88-
clusterConcurrency int
89-
kubeadmConfigConcurrency int
90-
syncPeriod time.Duration
91-
restConfigQPS float32
92-
restConfigBurst int
93-
webhookPort int
94-
webhookCertDir string
95-
healthAddr string
96-
tokenTTL time.Duration
97-
tlsOptions = flags.TLSOptions{}
98-
logOptions = logs.NewOptions()
79+
metricsBindAddr string
80+
enableLeaderElection bool
81+
leaderElectionLeaseDuration time.Duration
82+
leaderElectionRenewDeadline time.Duration
83+
leaderElectionRetryPeriod time.Duration
84+
watchFilterValue string
85+
watchNamespace string
86+
profilerAddress string
87+
enableContentionProfiling bool
88+
clusterConcurrency int
89+
clusterCacheTrackerConcurrency int
90+
kubeadmConfigConcurrency int
91+
syncPeriod time.Duration
92+
restConfigQPS float32
93+
restConfigBurst int
94+
webhookPort int
95+
webhookCertDir string
96+
healthAddr string
97+
tokenTTL time.Duration
98+
tlsOptions = flags.TLSOptions{}
99+
logOptions = logs.NewOptions()
99100
)
100101

101102
// InitFlags initializes this manager's flags.
@@ -128,6 +129,10 @@ func InitFlags(fs *pflag.FlagSet) {
128129

129130
fs.IntVar(&clusterConcurrency, "cluster-concurrency", 10,
130131
"Number of clusters to process simultaneously")
132+
_ = fs.MarkDeprecated("cluster-concurrency", "This flag has no function anymore and is going to be removed in a next release. Use \"--clustercachetracker-concurrency\" instead.")
133+
134+
fs.IntVar(&clusterCacheTrackerConcurrency, "clustercachetracker-concurrency", 10,
135+
"Number of clusters to process simultaneously")
131136

132137
fs.IntVar(&kubeadmConfigConcurrency, "kubeadmconfig-concurrency", 10,
133138
"Number of kubeadm configs to process simultaneously")
@@ -307,7 +312,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
307312
Client: mgr.GetClient(),
308313
Tracker: tracker,
309314
WatchFilterValue: watchFilterValue,
310-
}).SetupWithManager(ctx, mgr, concurrency(clusterConcurrency)); err != nil {
315+
}).SetupWithManager(ctx, mgr, concurrency(clusterCacheTrackerConcurrency)); err != nil {
311316
setupLog.Error(err, "unable to create controller", "controller", "ClusterCacheReconciler")
312317
os.Exit(1)
313318
}

controlplane/kubeadm/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ var (
9191
profilerAddress string
9292
enableContentionProfiling bool
9393
kubeadmControlPlaneConcurrency int
94+
clusterCacheTrackerConcurrency int
9495
syncPeriod time.Duration
9596
restConfigQPS float32
9697
restConfigBurst int
@@ -134,6 +135,9 @@ func InitFlags(fs *pflag.FlagSet) {
134135
fs.IntVar(&kubeadmControlPlaneConcurrency, "kubeadmcontrolplane-concurrency", 10,
135136
"Number of kubeadm control planes to process simultaneously")
136137

138+
fs.IntVar(&clusterCacheTrackerConcurrency, "clustercachetracker-concurrency", 10,
139+
"Number of clusters to process simultaneously")
140+
137141
fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute,
138142
"The minimum interval at which watched resources are reconciled (e.g. 15m)")
139143

@@ -320,7 +324,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
320324
Client: mgr.GetClient(),
321325
Tracker: tracker,
322326
WatchFilterValue: watchFilterValue,
323-
}).SetupWithManager(ctx, mgr, concurrency(kubeadmControlPlaneConcurrency)); err != nil {
327+
}).SetupWithManager(ctx, mgr, concurrency(clusterCacheTrackerConcurrency)); err != nil {
324328
setupLog.Error(err, "unable to create controller", "controller", "ClusterCacheReconciler")
325329
os.Exit(1)
326330
}

main.go

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,35 @@ var (
8282
controllerName = "cluster-api-controller-manager"
8383

8484
// flags.
85-
metricsBindAddr string
86-
enableLeaderElection bool
87-
leaderElectionLeaseDuration time.Duration
88-
leaderElectionRenewDeadline time.Duration
89-
leaderElectionRetryPeriod time.Duration
90-
watchNamespace string
91-
watchFilterValue string
92-
profilerAddress string
93-
enableContentionProfiling bool
94-
clusterTopologyConcurrency int
95-
clusterClassConcurrency int
96-
clusterConcurrency int
97-
extensionConfigConcurrency int
98-
machineConcurrency int
99-
machineSetConcurrency int
100-
machineDeploymentConcurrency int
101-
machinePoolConcurrency int
102-
clusterResourceSetConcurrency int
103-
machineHealthCheckConcurrency int
104-
syncPeriod time.Duration
105-
restConfigQPS float32
106-
restConfigBurst int
107-
nodeDrainClientTimeout time.Duration
108-
webhookPort int
109-
webhookCertDir string
110-
healthAddr string
111-
tlsOptions = flags.TLSOptions{}
112-
logOptions = logs.NewOptions()
85+
metricsBindAddr string
86+
enableLeaderElection bool
87+
leaderElectionLeaseDuration time.Duration
88+
leaderElectionRenewDeadline time.Duration
89+
leaderElectionRetryPeriod time.Duration
90+
watchNamespace string
91+
watchFilterValue string
92+
profilerAddress string
93+
enableContentionProfiling bool
94+
clusterTopologyConcurrency int
95+
clusterCacheTrackerConcurrency int
96+
clusterClassConcurrency int
97+
clusterConcurrency int
98+
extensionConfigConcurrency int
99+
machineConcurrency int
100+
machineSetConcurrency int
101+
machineDeploymentConcurrency int
102+
machinePoolConcurrency int
103+
clusterResourceSetConcurrency int
104+
machineHealthCheckConcurrency int
105+
syncPeriod time.Duration
106+
restConfigQPS float32
107+
restConfigBurst int
108+
nodeDrainClientTimeout time.Duration
109+
webhookPort int
110+
webhookCertDir string
111+
healthAddr string
112+
tlsOptions = flags.TLSOptions{}
113+
logOptions = logs.NewOptions()
113114
)
114115

115116
func init() {
@@ -177,6 +178,9 @@ func InitFlags(fs *pflag.FlagSet) {
177178
fs.IntVar(&clusterConcurrency, "cluster-concurrency", 10,
178179
"Number of clusters to process simultaneously")
179180

181+
fs.IntVar(&clusterCacheTrackerConcurrency, "clustercachetracker-concurrency", 10,
182+
"Number of clusters to process simultaneously")
183+
180184
fs.IntVar(&extensionConfigConcurrency, "extensionconfig-concurrency", 10,
181185
"Number of extension configs to process simultaneously")
182186

@@ -394,7 +398,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
394398
Client: mgr.GetClient(),
395399
Tracker: tracker,
396400
WatchFilterValue: watchFilterValue,
397-
}).SetupWithManager(ctx, mgr, concurrency(clusterConcurrency)); err != nil {
401+
}).SetupWithManager(ctx, mgr, concurrency(clusterCacheTrackerConcurrency)); err != nil {
398402
setupLog.Error(err, "unable to create controller", "controller", "ClusterCacheReconciler")
399403
os.Exit(1)
400404
}

test/infrastructure/docker/main.go

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,25 @@ var (
6868
controllerName = "cluster-api-docker-controller-manager"
6969

7070
// flags.
71-
metricsBindAddr string
72-
enableLeaderElection bool
73-
leaderElectionLeaseDuration time.Duration
74-
leaderElectionRenewDeadline time.Duration
75-
leaderElectionRetryPeriod time.Duration
76-
watchNamespace string
77-
watchFilterValue string
78-
profilerAddress string
79-
enableContentionProfiling bool
80-
concurrency int
81-
syncPeriod time.Duration
82-
restConfigQPS float32
83-
restConfigBurst int
84-
webhookPort int
85-
webhookCertDir string
86-
healthAddr string
87-
tlsOptions = flags.TLSOptions{}
88-
logOptions = logs.NewOptions()
71+
metricsBindAddr string
72+
enableLeaderElection bool
73+
leaderElectionLeaseDuration time.Duration
74+
leaderElectionRenewDeadline time.Duration
75+
leaderElectionRetryPeriod time.Duration
76+
watchNamespace string
77+
watchFilterValue string
78+
profilerAddress string
79+
enableContentionProfiling bool
80+
concurrency int
81+
clusterCacheTrackerConcurrency int
82+
syncPeriod time.Duration
83+
restConfigQPS float32
84+
restConfigBurst int
85+
webhookPort int
86+
webhookCertDir string
87+
healthAddr string
88+
tlsOptions = flags.TLSOptions{}
89+
logOptions = logs.NewOptions()
8990
)
9091

9192
func init() {
@@ -135,6 +136,9 @@ func initFlags(fs *pflag.FlagSet) {
135136
fs.IntVar(&concurrency, "concurrency", 10,
136137
"The number of docker machines to process simultaneously")
137138

139+
fs.IntVar(&clusterCacheTrackerConcurrency, "clustercachetracker-concurrency", 10,
140+
"Number of clusters to process simultaneously")
141+
138142
fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute,
139143
"The minimum interval at which watched resources are reconciled (e.g. 15m)")
140144

@@ -316,7 +320,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
316320
Tracker: tracker,
317321
WatchFilterValue: watchFilterValue,
318322
}).SetupWithManager(ctx, mgr, controller.Options{
319-
MaxConcurrentReconciles: concurrency,
323+
MaxConcurrentReconciles: clusterCacheTrackerConcurrency,
320324
}); err != nil {
321325
setupLog.Error(err, "unable to create controller", "controller", "ClusterCacheReconciler")
322326
os.Exit(1)

0 commit comments

Comments
 (0)