Skip to content

Commit 415b56a

Browse files
tobiasgieselentzi90
andcommitted
✨ Add flags for configuring rate limits
Our controller have built-in rate limits. It throttles itself if it hits this limit. So far it has not been possible to configure these limits. This commit adds flags to the controller for setting both the QPS and the burst for the rate limits. The default remains the same as before (20 QPS, 30 burst). Signed-off-by: Tobias Giese <[email protected]> Co-Authored-by: Lennart Jern <[email protected]>
1 parent 0a4899a commit 415b56a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ var (
6969
openStackClusterConcurrency int
7070
openStackMachineConcurrency int
7171
syncPeriod time.Duration
72+
restConfigQPS float32
73+
restConfigBurst int
7274
webhookPort int
7375
webhookCertDir string
7476
healthAddr string
@@ -128,6 +130,12 @@ func InitFlags(fs *pflag.FlagSet) {
128130
fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute,
129131
"The minimum interval at which watched resources are reconciled (e.g. 15m)")
130132

133+
fs.Float32Var(&restConfigQPS, "kube-api-qps", 20,
134+
"Maximum queries per second from the controller client to the Kubernetes API server. Defaults to 20")
135+
136+
fs.IntVar(&restConfigBurst, "kube-api-burst", 30,
137+
"Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30")
138+
131139
fs.IntVar(&webhookPort, "webhook-port", 9443,
132140
"Webhook Server port")
133141

@@ -181,6 +189,8 @@ func main() {
181189
if err != nil {
182190
setupLog.Error(err, "unable to get kubeconfig")
183191
}
192+
cfg.QPS = restConfigQPS
193+
cfg.Burst = restConfigBurst
184194

185195
var caCerts []byte
186196
if caCertsPath != "" {

0 commit comments

Comments
 (0)