From b1df71dd666c64887d812610d086fd0988cc5ce0 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Fri, 11 Jan 2019 14:04:23 +0000 Subject: [PATCH] Retain Challenge resources for debugging if an Order enters an invalid state Signed-off-by: James Munnelly --- pkg/controller/acmeorders/sync.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/controller/acmeorders/sync.go b/pkg/controller/acmeorders/sync.go index 3b09f5fe3..f1270f168 100644 --- a/pkg/controller/acmeorders/sync.go +++ b/pkg/controller/acmeorders/sync.go @@ -109,6 +109,13 @@ func (c *Controller) Sync(ctx context.Context, o *cmapi.Order) (err error) { return err } + // Don't cleanup challenge resources if the order has failed. + // This will make it easier for users to debug failing challenges. + // The challenge resources will be cleaned up when the Order is deleted. + if acme.IsFailureState(o.Status.State) { + return nil + } + // Cleanup challenge resources once a final state has been reached for _, ch := range existingChallenges { err := c.CMClient.CertmanagerV1alpha1().Challenges(ch.Namespace).Delete(ch.Name, nil)