Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
make restclient config configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyan2016 committed Jun 1, 2021
1 parent 82b2011 commit 3683231
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/controller-manager/app/controller-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const (

var (
kubeconfig, kubeFedConfig, masterURL, metricsAddr, healthzAddr string
restConfigQPS, restConfigBurst int
)

// NewControllerManagerCommand creates a *cobra.Command object with default parameters
Expand Down Expand Up @@ -98,6 +99,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.IntVar(&restConfigQPS, "rest-config-qps", 5, "QPS of rest config.")
flags.IntVar(&restConfigBurst, "rest-config-burst", 10, "Burst of rest config.")

local := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
klog.InitFlags(local)
Expand All @@ -121,6 +124,12 @@ func Run(opts *options.Options, stopChan <-chan struct{}) error {
if err != nil {
panic(err)
}
if restConfigQPS > 0 {
opts.Config.KubeConfig.QPS = float32(restConfigQPS)
}
if restConfigBurst > 0 {
opts.Config.KubeConfig.Burst = restConfigBurst
}

runningInCluster := len(masterURL) == 0 && len(kubeconfig) == 0
if runningInCluster && len(opts.Config.KubeFedNamespace) == 0 {
Expand Down

0 comments on commit 3683231

Please sign in to comment.