Skip to content

Commit d97c271

Browse files
Demch1kIvan SokoryanFxKu
authored
Add abitility to set QPS and Burst limits for api client (zalando#2667)
* Add abitility to set QPS and Burst limits for api client --------- Co-authored-by: Ivan Sokoryan <[email protected]> Co-authored-by: Felix Kunde <[email protected]>
1 parent 470a1ea commit d97c271

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cmd/main.go

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func init() {
3535
flag.BoolVar(&outOfCluster, "outofcluster", false, "Whether the operator runs in- our outside of the Kubernetes cluster.")
3636
flag.BoolVar(&config.NoDatabaseAccess, "nodatabaseaccess", false, "Disable all access to the database from the operator side.")
3737
flag.BoolVar(&config.NoTeamsAPI, "noteamsapi", false, "Disable all access to the teams API")
38+
flag.IntVar(&config.KubeQPS, "kubeqps", 10, "Kubernetes api requests per second.")
39+
flag.IntVar(&config.KubeBurst, "kubeburst", 20, "Kubernetes api requests burst limit.")
3840
flag.Parse()
3941

4042
config.EnableJsonLogging = os.Getenv("ENABLE_JSON_LOGGING") == "true"
@@ -83,6 +85,9 @@ func main() {
8385
log.Fatalf("couldn't get REST config: %v", err)
8486
}
8587

88+
config.RestConfig.QPS = float32(config.KubeQPS)
89+
config.RestConfig.Burst = config.KubeBurst
90+
8691
c := controller.NewController(&config, "")
8792

8893
c.Run(stop, wg)

pkg/spec/types.go

+3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ type ControllerConfig struct {
122122
IgnoredAnnotations []string
123123

124124
EnableJsonLogging bool
125+
126+
KubeQPS int
127+
KubeBurst int
125128
}
126129

127130
// cached value for the GetOperatorNamespace

0 commit comments

Comments
 (0)