From 1e839f26ed877340ee559b5d0158ad41a206783b Mon Sep 17 00:00:00 2001 From: Yang Le Date: Fri, 11 Jun 2021 16:23:52 +0800 Subject: [PATCH] increase qps & burst Signed-off-by: Yang Le --- go.sum | 1 - pkg/spoke/spokeagent.go | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/go.sum b/go.sum index e36648880..743978938 100644 --- a/go.sum +++ b/go.sum @@ -555,7 +555,6 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= diff --git a/pkg/spoke/spokeagent.go b/pkg/spoke/spokeagent.go index 7a488e873..483246430 100644 --- a/pkg/spoke/spokeagent.go +++ b/pkg/spoke/spokeagent.go @@ -26,11 +26,16 @@ import ( type WorkloadAgentOptions struct { HubKubeconfigFile string SpokeClusterName string + QPS float32 + Burst int } // NewWorkloadAgentOptions returns the flags with default value set func NewWorkloadAgentOptions() *WorkloadAgentOptions { - return &WorkloadAgentOptions{} + return &WorkloadAgentOptions{ + QPS: 50, + Burst: 100, + } } // AddFlags register and binds the default flags @@ -39,6 +44,8 @@ func (o *WorkloadAgentOptions) AddFlags(cmd *cobra.Command) { // This command only supports reading from config flags.StringVar(&o.HubKubeconfigFile, "hub-kubeconfig", o.HubKubeconfigFile, "Location of kubeconfig file to connect to hub cluster.") flags.StringVar(&o.SpokeClusterName, "spoke-cluster-name", o.SpokeClusterName, "Name of spoke cluster.") + flags.Float32Var(&o.QPS, "spoke-kube-api-qps", o.QPS, "QPS to use while talking with apiserver on spoke cluster.") + flags.IntVar(&o.Burst, "spoke-kube-api-burst", o.Burst, "Burst to use while talking with apiserver on spoke cluster.") } // RunWorkloadAgent starts the controllers on agent to process work from hub. @@ -59,6 +66,8 @@ func (o *WorkloadAgentOptions) RunWorkloadAgent(ctx context.Context, controllerC // Build dynamic client and informer for spoke cluster spokeRestConfig := controllerContext.KubeConfig + spokeRestConfig.QPS = o.QPS + spokeRestConfig.Burst = o.Burst spokeDynamicClient, err := dynamic.NewForConfig(spokeRestConfig) if err != nil { return err