Skip to content

Commit

Permalink
Merge pull request #1268 from Nordix/lentzi90/rate-limit-flags
Browse files Browse the repository at this point in the history
✨ Add flags for configuring rate limits
  • Loading branch information
metal3-io-bot committed May 5, 2023
2 parents b76dde2 + 2ac1d99 commit 1c13ff2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ ironic-inspector-auth-config
ironic-rpc-auth-config
HTTP_BASIC_HTPASSWD
ironic-deployment/overlays/temp

# Development containers (https://containers.dev/)
.devcontainer
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ func main() {
var runInTestMode bool
var runInDemoMode bool
var webhookPort int
var restConfigQPS float64
var restConfigBurst int

// From CAPI point of view, BMO should be able to watch all namespaces
// in case of a deployment that is not multi-tenant. If the deployment
Expand All @@ -116,6 +118,10 @@ func main() {
"The address the health endpoint binds to.")
flag.IntVar(&webhookPort, "webhook-port", 9443,
"Webhook Server port (set to 0 to disable)")
flag.Float64Var(&restConfigQPS, "kube-api-qps", 20,
"Maximum queries per second from the controller client to the Kubernetes API server. Default 20")
flag.IntVar(&restConfigBurst, "kube-api-burst", 30,
"Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30")
flag.Parse()

logOpts := zap.Options{}
Expand All @@ -134,7 +140,10 @@ func main() {
leaderElectionNamespace = watchNamespace
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
restConfig := ctrl.GetConfigOrDie()
restConfig.QPS = float32(restConfigQPS)
restConfig.Burst = restConfigBurst
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsBindAddr,
Port: webhookPort,
Expand Down

0 comments on commit 1c13ff2

Please sign in to comment.