Skip to content

Commit

Permalink
Add default ratelimiter (#269)
Browse files Browse the repository at this point in the history
Co-authored-by: Darren Deng <darrendeng@microsfot.com>
DarrenDeng137 and Darren Deng authored Apr 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 7b492c0 commit 7145951
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ import (
ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager"

"github.com/microsoft/cluster-api-provider-azurestackhci/controllers"
"k8s.io/client-go/util/workqueue"
)

var (
@@ -198,23 +199,32 @@ func main() {
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("AzureStackHCIMachine"),
Recorder: mgr.GetEventRecorderFor("azurestackhcimachine-reconciler"),
}).SetupWithManager(mgr, controller.Options{MaxConcurrentReconciles: azureStackHCIMachineConcurrency}); err != nil {
}).SetupWithManager(mgr, controller.Options{
MaxConcurrentReconciles: azureStackHCIMachineConcurrency,
RateLimiter: workqueue.DefaultControllerRateLimiter(),
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "AzureStackHCIMachine")
os.Exit(1)
}
if err = (&controllers.AzureStackHCIClusterReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("AzureStackHCICluster"),
Recorder: mgr.GetEventRecorderFor("azurestackhcicluster-reconciler"),
}).SetupWithManager(mgr, controller.Options{MaxConcurrentReconciles: azureStackHCIClusterConcurrency}); err != nil {
}).SetupWithManager(mgr, controller.Options{
MaxConcurrentReconciles: azureStackHCIClusterConcurrency,
RateLimiter: workqueue.DefaultControllerRateLimiter(),
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "AzureStackHCICluster")
os.Exit(1)
}
if err = (&controllers.AzureStackHCILoadBalancerReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("AzureStackHCILoadBalancer"),
Recorder: mgr.GetEventRecorderFor("azurestackhciloadbalancer-reconciler"),
}).SetupWithManager(mgr, controller.Options{MaxConcurrentReconciles: azureStackHCIloadBalancerConcurrency}); err != nil {
}).SetupWithManager(mgr, controller.Options{
MaxConcurrentReconciles: azureStackHCIloadBalancerConcurrency,
RateLimiter: workqueue.DefaultControllerRateLimiter(),
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "AzureStackHCILoadBalancer")
os.Exit(1)
}
@@ -223,7 +233,10 @@ func main() {
Log: ctrl.Log.WithName("controllers").WithName("AzureStackHCIVirtualMachine"),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("azurestackhcivirtualmachine-reconciler"),
}).SetupWithManager(mgr, controller.Options{MaxConcurrentReconciles: azureStackHCIVirtualMachineConcurrency}); err != nil {
}).SetupWithManager(mgr, controller.Options{
MaxConcurrentReconciles: azureStackHCIVirtualMachineConcurrency,
RateLimiter: workqueue.DefaultControllerRateLimiter(),
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "AzureStackHCIVirtualMachine")
os.Exit(1)
}

0 comments on commit 7145951

Please sign in to comment.