Retain Challenge resources for debugging if an Order enters an invalid state

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2019-01-11 14:04:23 +00:00
parent 1440e9ed57
commit b1df71dd66

View File

@ -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)