Skip to content

Commit f380bc7

Browse files
authored
Merge pull request #1707 from tahsinrahman/cabpk-concurrency
✨ Expose concurrency flag for KubeadmConfig (CABPK) controller
2 parents 3ec5e9c + 166b4e4 commit f380bc7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

bootstrap/kubeadm/controllers/kubeadmconfig_controller.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
"sigs.k8s.io/cluster-api/util/secret"
4141
ctrl "sigs.k8s.io/controller-runtime"
4242
"sigs.k8s.io/controller-runtime/pkg/client"
43+
"sigs.k8s.io/controller-runtime/pkg/controller"
4344
"sigs.k8s.io/controller-runtime/pkg/handler"
4445
"sigs.k8s.io/controller-runtime/pkg/source"
4546
)
@@ -65,7 +66,7 @@ type KubeadmConfigReconciler struct {
6566
}
6667

6768
// SetupWithManager sets up the reconciler with the Manager.
68-
func (r *KubeadmConfigReconciler) SetupWithManager(mgr ctrl.Manager) error {
69+
func (r *KubeadmConfigReconciler) SetupWithManager(mgr ctrl.Manager, option controller.Options) error {
6970
if r.KubeadmInitLock == nil {
7071
r.KubeadmInitLock = locking.NewControlPlaneInitMutex(ctrl.Log.WithName("init-locker"), mgr.GetClient())
7172
}
@@ -87,6 +88,7 @@ func (r *KubeadmConfigReconciler) SetupWithManager(mgr ctrl.Manager) error {
8788
ToRequests: handler.ToRequestsFunc(r.ClusterToKubeadmConfigs),
8889
},
8990
).
91+
WithOptions(option).
9092
Complete(r)
9193
}
9294

main.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func main() {
6363
machineConcurrency int
6464
machineSetConcurrency int
6565
machineDeploymentConcurrency int
66+
kubeadmConfigConcurrency int
6667
syncPeriod time.Duration
6768
)
6869

@@ -90,6 +91,9 @@ func main() {
9091
flag.IntVar(&machineDeploymentConcurrency, "machinedeployment-concurrency", 10,
9192
"Number of machine deployments to process simultaneously")
9293

94+
flag.IntVar(&kubeadmConfigConcurrency, "kubeadmconfig-concurrency", 10,
95+
"Number of kubeadm configs to process simultaneously")
96+
9397
flag.DurationVar(&syncPeriod, "sync-period", 10*time.Minute,
9498
"The minimum interval at which watched resources are reconciled (e.g. 15m)")
9599

@@ -156,7 +160,7 @@ func main() {
156160
if err = (&kubeadmcontrollers.KubeadmConfigReconciler{
157161
Client: mgr.GetClient(),
158162
Log: ctrl.Log.WithName("controllers").WithName("KubeadmConfigReconciler"),
159-
}).SetupWithManager(mgr); err != nil {
163+
}).SetupWithManager(mgr, concurrency(kubeadmConfigConcurrency)); err != nil {
160164
setupLog.Error(err, "unable to create controller", "controller", "KubeadmConfig")
161165
os.Exit(1)
162166
}

0 commit comments

Comments
 (0)