Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase ACME control loop & order creation back-off #1195

Merged
merged 1 commit into from Jan 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/controller/acmechallenges/controller.go
Expand Up @@ -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})
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/acmechallenges/sync.go
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/acmeorders/controller.go
Expand Up @@ -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})
Expand Down
3 changes: 2 additions & 1 deletion pkg/issuer/acme/issue.go
Expand Up @@ -42,7 +42,7 @@ import (
)

const (
createOrderWaitDuration = time.Minute * 5
createOrderWaitDuration = time.Hour * 1
)

var (
Expand Down Expand Up @@ -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 {
Expand Down