From 5e865a6e706b5dcd9160fb3703401b063691be40 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Thu, 19 Apr 2018 15:07:00 +0100 Subject: [PATCH] Always use AddRateLimited. Adjust exponential backoff base/max. --- pkg/controller/certificates/controller.go | 8 ++++---- pkg/controller/clusterissuers/controller.go | 4 ++-- pkg/controller/issuers/controller.go | 4 ++-- pkg/controller/util.go | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/controller/certificates/controller.go b/pkg/controller/certificates/controller.go index 595db6112..9ef8062b7 100644 --- a/pkg/controller/certificates/controller.go +++ b/pkg/controller/certificates/controller.go @@ -66,11 +66,11 @@ func New( ) *Controller { ctrl := &Controller{client: client, cmClient: cmClient, issuerFactory: issuerFactory, recorder: recorder} ctrl.syncHandler = ctrl.processNextWorkItem - ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "certificates") + ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(time.Second*2, time.Minute*1), "certificates") // Create a scheduled work queue that calls the ctrl.queue.Add method for // each object in the queue. This is used to schedule re-checks of // Certificate resources when they get near to expiry - ctrl.scheduledWorkQueue = scheduler.NewScheduledWorkQueue(ctrl.queue.Add) + ctrl.scheduledWorkQueue = scheduler.NewScheduledWorkQueue(ctrl.queue.AddRateLimited) certificatesInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: ctrl.queue}) ctrl.certificateLister = certificatesInformer.Lister() @@ -117,7 +117,7 @@ func (c *Controller) secretDeleted(obj interface{}) { runtime.HandleError(err) continue } - c.queue.Add(key) + c.queue.AddRateLimited(key) } } @@ -138,7 +138,7 @@ func (c *Controller) ingressDeleted(obj interface{}) { runtime.HandleError(err) continue } - c.queue.Add(key) + c.queue.AddRateLimited(key) } } diff --git a/pkg/controller/clusterissuers/controller.go b/pkg/controller/clusterissuers/controller.go index 3fe07a964..a4bf87dfe 100644 --- a/pkg/controller/clusterissuers/controller.go +++ b/pkg/controller/clusterissuers/controller.go @@ -57,7 +57,7 @@ func New( ) *Controller { ctrl := &Controller{client: cl, cmClient: cmClient, issuerFactory: issuerFactory, recorder: recorder, clusterResourceNamespace: clusterResourceNamespace} ctrl.syncHandler = ctrl.processNextWorkItem - ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "clusterissuers") + ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(time.Second*2, time.Minute*1), "clusterissuers") clusterIssuersInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: ctrl.queue}) ctrl.issuerInformerSynced = clusterIssuersInformer.Informer().HasSynced @@ -90,7 +90,7 @@ func (c *Controller) secretDeleted(obj interface{}) { runtime.HandleError(err) continue } - c.queue.Add(key) + c.queue.AddRateLimited(key) } } diff --git a/pkg/controller/issuers/controller.go b/pkg/controller/issuers/controller.go index 3afcafcc2..0587f4741 100644 --- a/pkg/controller/issuers/controller.go +++ b/pkg/controller/issuers/controller.go @@ -55,7 +55,7 @@ func New( ) *Controller { ctrl := &Controller{client: cl, cmClient: cmClient, issuerFactory: issuerFactory, recorder: recorder} ctrl.syncHandler = ctrl.processNextWorkItem - ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "issuers") + ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(time.Second*2, time.Minute*1), "issuers") issuersInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: ctrl.queue}) ctrl.issuerInformerSynced = issuersInformer.Informer().HasSynced @@ -88,7 +88,7 @@ func (c *Controller) secretDeleted(obj interface{}) { runtime.HandleError(err) continue } - c.queue.Add(key) + c.queue.AddRateLimited(key) } } diff --git a/pkg/controller/util.go b/pkg/controller/util.go index 2f04cbd6e..21636da45 100644 --- a/pkg/controller/util.go +++ b/pkg/controller/util.go @@ -24,7 +24,7 @@ func (q *QueuingEventHandler) Enqueue(obj interface{}) { runtime.HandleError(err) return } - q.Queue.Add(key) + q.Queue.AddRateLimited(key) } func (q *QueuingEventHandler) OnAdd(obj interface{}) {