Increase ACME control loop max back-off. Increase create order back-off to 1h. Fire Event when Order fails.

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2019-01-10 22:07:48 +00:00
parent 3b9aae318f
commit 21c7b2e13f
4 changed files with 6 additions and 6 deletions

View File

@ -70,8 +70,7 @@ func New(ctx *controllerpkg.Context) *Controller {
ctrl := &Controller{Context: *ctx}
ctrl.syncHandler = ctrl.processNextWorkItem
// exponentially back-off self checks, with a base of 2s and max wait of 20s
ctrl.queue = workqueue.NewNamedRateLimitingQueue(controllerpkg.DefaultItemBasedRateLimiter(), "challenges")
ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(time.Second*5, time.Minute*30), "challenges")
challengeInformer := ctrl.SharedInformerFactory.Certmanager().V1alpha1().Challenges()
challengeInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: ctrl.queue})

View File

@ -161,8 +161,8 @@ func (c *Controller) Sync(ctx context.Context, ch *cmapi.Challenge) (err error)
return err
}
// retry after 5s
c.queue.AddAfter(key, time.Second*5)
// retry after 10s
c.queue.AddAfter(key, time.Second*10)
return nil
}

View File

@ -65,7 +65,7 @@ func New(ctx *controllerpkg.Context) *Controller {
ctrl := &Controller{Context: *ctx}
ctrl.syncHandler = ctrl.processNextWorkItem
ctrl.queue = workqueue.NewNamedRateLimitingQueue(controllerpkg.DefaultItemBasedRateLimiter(), "orders")
ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(time.Second*5, time.Minute*30), "orders")
orderInformer := ctrl.SharedInformerFactory.Certmanager().V1alpha1().Orders()
orderInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: ctrl.queue})

View File

@ -42,7 +42,7 @@ import (
)
const (
createOrderWaitDuration = time.Minute * 5
createOrderWaitDuration = time.Hour * 1
)
var (
@ -140,6 +140,7 @@ func (a *Acme) Issue(ctx context.Context, crt *v1alpha1.Certificate) (*issuer.Is
if crt.Status.LastFailureTime == nil {
nowTime := metav1.NewTime(a.clock.Now())
crt.Status.LastFailureTime = &nowTime
a.Recorder.Eventf(crt, corev1.EventTypeWarning, "FailedOrder", "Order %q failed. Waiting %s before retrying issuance.", existingOrder.Name, createOrderWaitDuration)
}
if time.Now().Sub(crt.Status.LastFailureTime.Time) < createOrderWaitDuration {