Skip to content

Commit 880b999

Browse files
tobiasgieselentzi90
authored 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 95a4004 commit 880b999

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
@@ -68,6 +68,8 @@ var (
6868
openStackClusterConcurrency int
6969
openStackMachineConcurrency int
7070
syncPeriod time.Duration
71+
restConfigQPS float32
72+
restConfigBurst int
7173
webhookPort int
7274
webhookCertDir string
7375
healthAddr string
@@ -126,6 +128,12 @@ func InitFlags(fs *pflag.FlagSet) {
126128
fs.DurationVar(&syncPeriod, "sync-period", 10*time.Minute,
127129
"The minimum interval at which watched resources are reconciled (e.g. 15m)")
128130

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

@@ -179,6 +187,8 @@ func main() {
179187
if err != nil {
180188
setupLog.Error(err, "unable to get kubeconfig")
181189
}
190+
cfg.QPS = restConfigQPS
191+
cfg.Burst = restConfigBurst
182192

183193
var caCerts []byte
184194
if caCertsPath != "" {

0 commit comments

Comments
 (0)