Skip to content

Commit 074f94f

Browse files
committed
make k8s restclient cfg configurable
1 parent 9631566 commit 074f94f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cmd/controller-manager/app/controller-manager.go

+10
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ const (
6464

6565
var (
6666
kubeconfig, kubeFedConfig, masterURL, metricsAddr, healthzAddr string
67+
restConfigQPS float32
68+
restConfigBurst int
6769
)
6870

6971
// NewControllerManagerCommand creates a *cobra.Command object with default parameters
@@ -98,6 +100,8 @@ member clusters and do the necessary reconciliation`,
98100
flags.StringVar(&kubeFedConfig, "kubefed-config", "", "Path to a KubeFedConfig yaml file. Test only.")
99101
flags.StringVar(&kubeconfig, "kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.")
100102
flags.StringVar(&masterURL, "master", "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.")
103+
flags.Float32Var(&restConfigQPS, "rest-config-qps", 5.0, "Maximum QPS to the api-server from this client.")
104+
flags.IntVar(&restConfigBurst, "rest-config-burst", 10, "Maximum burst for throttle to the api-server from this client.")
101105

102106
local := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
103107
klog.InitFlags(local)
@@ -121,6 +125,12 @@ func Run(opts *options.Options, stopChan <-chan struct{}) error {
121125
if err != nil {
122126
panic(err)
123127
}
128+
if restConfigQPS > 0 {
129+
opts.Config.KubeConfig.QPS = restConfigQPS
130+
}
131+
if restConfigBurst > 0 {
132+
opts.Config.KubeConfig.Burst = restConfigBurst
133+
}
124134

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

scripts/pre-commit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PLATFORM="${OS}-${ARCH}"
3131
NUM_CLUSTERS="${NUM_CLUSTERS:-2}"
3232
JOIN_CLUSTERS="${JOIN_CLUSTERS:-}"
3333
DOWNLOAD_BINARIES="${DOWNLOAD_BINARIES:-}"
34-
COMMON_TEST_ARGS="-kubeconfig=${HOME}/.kube/config -ginkgo.v -single-call-timeout=1m -ginkgo.trace -ginkgo.randomizeAllSpecs"
34+
COMMON_TEST_ARGS="-kubeconfig=${HOME}/.kube/config -ginkgo.v -single-call-timeout=2m -ginkgo.trace -ginkgo.randomizeAllSpecs"
3535
E2E_TEST_CMD="${TEMP_DIR}/e2e-${PLATFORM} ${COMMON_TEST_ARGS}"
3636
# Disable limited scope in-memory controllers to ensure the controllers in the
3737
# race detection test behave consistently with deployed controllers for a

0 commit comments

Comments
 (0)