Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add abitility to set QPS and Burst limits for api client #2667

Merged
merged 14 commits into from
Dec 23, 2024
7 changes: 7 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ var (
outOfCluster bool
version string
config spec.ControllerConfig
kubeQPS int
kubeBurst int
Demch1k marked this conversation as resolved.
Show resolved Hide resolved
)

func mustParseDuration(d string) time.Duration {
Expand All @@ -35,6 +37,8 @@ func init() {
flag.BoolVar(&outOfCluster, "outofcluster", false, "Whether the operator runs in- our outside of the Kubernetes cluster.")
flag.BoolVar(&config.NoDatabaseAccess, "nodatabaseaccess", false, "Disable all access to the database from the operator side.")
flag.BoolVar(&config.NoTeamsAPI, "noteamsapi", false, "Disable all access to the teams API")
flag.IntVar(&kubeQPS, "kubeqps", 5, "Kubernetes api requests per second.")
flag.IntVar(&kubeBurst, "kubeburst", 10, "Kubernetes api requests burst limit.")
flag.Parse()

config.EnableJsonLogging = os.Getenv("ENABLE_JSON_LOGGING") == "true"
Expand Down Expand Up @@ -83,6 +87,9 @@ func main() {
log.Fatalf("couldn't get REST config: %v", err)
}

config.RestConfig.QPS = float32(kubeQPS)
config.RestConfig.Burst = kubeBurst

c := controller.NewController(&config, "")

c.Run(stop, wg)
Expand Down