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

Commit

Permalink
make k8s restclient cfg configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyan2016 committed Jun 21, 2021
1 parent 9631566 commit 074f94f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 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,8 @@ const (

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

// NewControllerManagerCommand creates a *cobra.Command object with default parameters
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion scripts/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PLATFORM="${OS}-${ARCH}"
NUM_CLUSTERS="${NUM_CLUSTERS:-2}"
JOIN_CLUSTERS="${JOIN_CLUSTERS:-}"
DOWNLOAD_BINARIES="${DOWNLOAD_BINARIES:-}"
COMMON_TEST_ARGS="-kubeconfig=${HOME}/.kube/config -ginkgo.v -single-call-timeout=1m -ginkgo.trace -ginkgo.randomizeAllSpecs"
COMMON_TEST_ARGS="-kubeconfig=${HOME}/.kube/config -ginkgo.v -single-call-timeout=2m -ginkgo.trace -ginkgo.randomizeAllSpecs"
E2E_TEST_CMD="${TEMP_DIR}/e2e-${PLATFORM} ${COMMON_TEST_ARGS}"
# Disable limited scope in-memory controllers to ensure the controllers in the
# race detection test behave consistently with deployed controllers for a
Expand Down

0 comments on commit 074f94f

Please sign in to comment.