From d66283cd9479657c8135ee18b99a9eea9f57594b Mon Sep 17 00:00:00 2001 From: Ingo Gottwald Date: Mon, 2 Oct 2023 19:37:45 +0200 Subject: [PATCH 1/2] Allow customization of client-go throttling This allows customization of the client-side throttling in client-go and sets a higher initial default. It is necessary for bigger setups with many domachines. The approach and naming of the flags are taken 1:1 from cluster API to keep things consistent. --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 004855e5d..dc5019738 100644 --- a/main.go +++ b/main.go @@ -80,6 +80,8 @@ var ( profilerAddress string webhookPort int enableLeaderElection bool + restConfigQPS float32 + restConfigBurst int ) func initFlags(fs *pflag.FlagSet) { @@ -95,6 +97,8 @@ func initFlags(fs *pflag.FlagSet) { fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute, "The minimum interval at which watched resources are reconciled (e.g. 10m)") fs.IntVar(&webhookPort, "webhook-port", 9443, "Webhook Server port, disabled by default. When enabled, the manager will only work as webhook server, no reconcilers are installed.") fs.DurationVar(&reconcileTimeout, "reconcile-timeout", reconciler.DefaultLoopTimeout, "The maximum duration a reconcile loop can run (e.g. 90m)") + fs.Float32Var(&restConfigQPS, "kube-api-qps", 20, "Maximum queries per second from the controller client to the Kubernetes API server. Defaults to 20") + fs.IntVar(&restConfigBurst, "kube-api-burst", 30, "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30") } func main() { @@ -134,7 +138,11 @@ func main() { BurstSize: 100, }) - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ + restConfig := ctrl.GetConfigOrDie() + restConfig.QPS = restConfigQPS + restConfig.Burst = restConfigBurst + + mgr, err := ctrl.NewManager(restConfig, ctrl.Options{ Scheme: scheme, MetricsBindAddress: metricsAddr, LeaderElection: enableLeaderElection, From 3e2bcc70846d0b5b6122869daee6db4ea8bb8f28 Mon Sep 17 00:00:00 2001 From: Ingo Gottwald Date: Tue, 3 Oct 2023 09:21:23 +0200 Subject: [PATCH 2/2] Remove default values form flag help This is already done automatically by the flags package. --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index dc5019738..6d9059c5e 100644 --- a/main.go +++ b/main.go @@ -97,8 +97,8 @@ func initFlags(fs *pflag.FlagSet) { fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute, "The minimum interval at which watched resources are reconciled (e.g. 10m)") fs.IntVar(&webhookPort, "webhook-port", 9443, "Webhook Server port, disabled by default. When enabled, the manager will only work as webhook server, no reconcilers are installed.") fs.DurationVar(&reconcileTimeout, "reconcile-timeout", reconciler.DefaultLoopTimeout, "The maximum duration a reconcile loop can run (e.g. 90m)") - fs.Float32Var(&restConfigQPS, "kube-api-qps", 20, "Maximum queries per second from the controller client to the Kubernetes API server. Defaults to 20") - fs.IntVar(&restConfigBurst, "kube-api-burst", 30, "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30") + fs.Float32Var(&restConfigQPS, "kube-api-qps", 20, "Maximum queries per second from the controller client to the Kubernetes API server.") + fs.IntVar(&restConfigBurst, "kube-api-burst", 30, "Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server.") } func main() {