diff --git a/cmd/controller-manager/app/controller-manager.go b/cmd/controller-manager/app/controller-manager.go index f28c4c3764..d1f1cae858 100644 --- a/cmd/controller-manager/app/controller-manager.go +++ b/cmd/controller-manager/app/controller-manager.go @@ -22,6 +22,7 @@ import ( "flag" "fmt" "io/ioutil" + "k8s.io/klog" "net/http" "os" "strings" @@ -40,7 +41,6 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "k8s.io/component-base/logs" - "k8s.io/klog/v2" "sigs.k8s.io/controller-runtime/pkg/metrics" "sigs.k8s.io/kubefed/cmd/controller-manager/app/leaderelection" @@ -64,6 +64,8 @@ const ( var ( kubeconfig, kubeFedConfig, masterURL, metricsAddr, healthzAddr string + restConfigQPS float32 + restConfigBurst int ) // NewControllerManagerCommand creates a *cobra.Command object with default parameters @@ -98,6 +100,8 @@ member clusters and do the necessary reconciliation`, flags.StringVar(&kubeFedConfig, "kubefed-config", "", "Path to a KubeFedConfig yaml file. Test only.") flags.StringVar(&kubeconfig, "kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.") flags.StringVar(&masterURL, "master", "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.") + flags.Float32Var(&restConfigQPS, "rest-config-qps", 5.0, "Maximum QPS to the api-server from this client.") + flags.IntVar(&restConfigBurst, "rest-config-burst", 10, "Maximum burst for throttle to the api-server from this client.") local := flag.NewFlagSet(os.Args[0], flag.ExitOnError) klog.InitFlags(local) @@ -121,6 +125,12 @@ func Run(opts *options.Options, stopChan <-chan struct{}) error { if err != nil { panic(err) } + if restConfigQPS > 0 { + opts.Config.KubeConfig.QPS = restConfigQPS + } + if restConfigBurst > 0 { + opts.Config.KubeConfig.Burst = restConfigBurst + } runningInCluster := len(masterURL) == 0 && len(kubeconfig) == 0 if runningInCluster && len(opts.Config.KubeFedNamespace) == 0 {