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: Ivan Sokoryan <i.sokoryan@robo.cash> Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
This commit is contained in:
		
							parent
							
								
									470a1eab89
								
							
						
					
					
						commit
						d97c271b84
					
				|  | @ -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() { | ||||||
| 		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 { | ||||||
| 	IgnoredAnnotations   []string | 	IgnoredAnnotations   []string | ||||||
| 
 | 
 | ||||||
| 	EnableJsonLogging bool | 	EnableJsonLogging bool | ||||||
|  | 
 | ||||||
|  | 	KubeQPS   int | ||||||
|  | 	KubeBurst int | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // cached value for the GetOperatorNamespace
 | // cached value for the GetOperatorNamespace
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue