Skip to content

Commit

Permalink
Add abitility to set QPS and Burst limits for api client (#2667)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent 470a1ea commit d97c271
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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(&config.KubeQPS, "kubeqps", 10, "Kubernetes api requests per second.")
flag.IntVar(&config.KubeBurst, "kubeburst", 20, "Kubernetes api requests burst limit.")
flag.Parse()

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

config.RestConfig.QPS = float32(config.KubeQPS)
config.RestConfig.Burst = config.KubeBurst

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

c.Run(stop, wg)
Expand Down
3 changes: 3 additions & 0 deletions pkg/spec/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ type ControllerConfig struct {
IgnoredAnnotations []string

EnableJsonLogging bool

KubeQPS int
KubeBurst int
}

// cached value for the GetOperatorNamespace
Expand Down

0 comments on commit d97c271

Please sign in to comment.