Skip to content
Snippets Groups Projects
Unverified Commit d97c271b authored by Demch1k's avatar Demch1k Committed by GitHub
Browse files

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


* Add abitility to set QPS and Burst limits for api client 

---------

Co-authored-by: default avatarIvan Sokoryan <i.sokoryan@robo.cash>
Co-authored-by: default avatarFelix Kunde <felix-kunde@gmx.de>
parent 470a1eab
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,8 @@ func init() { ...@@ -35,6 +35,8 @@ func init() {
flag.BoolVar(&outOfCluster, "outofcluster", false, "Whether the operator runs in- our outside of the Kubernetes cluster.") 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.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.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() flag.Parse()
config.EnableJsonLogging = os.Getenv("ENABLE_JSON_LOGGING") == "true" config.EnableJsonLogging = os.Getenv("ENABLE_JSON_LOGGING") == "true"
...@@ -83,6 +85,9 @@ func main() { ...@@ -83,6 +85,9 @@ func main() {
log.Fatalf("couldn't get REST config: %v", err) 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 := controller.NewController(&config, "")
c.Run(stop, wg) c.Run(stop, wg)
......
...@@ -122,6 +122,9 @@ type ControllerConfig struct { ...@@ -122,6 +122,9 @@ type ControllerConfig struct {
IgnoredAnnotations []string IgnoredAnnotations []string
EnableJsonLogging bool EnableJsonLogging bool
KubeQPS int
KubeBurst int
} }
// cached value for the GetOperatorNamespace // cached value for the GetOperatorNamespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment