From 5cc324014559a60f488b06d40661b5f6f27fcda7 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Wed, 7 Nov 2018 20:38:22 +0000 Subject: [PATCH] Fire Events when challenges succeed or fail Signed-off-by: James Munnelly --- pkg/controller/acmechallenges/sync.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/controller/acmechallenges/sync.go b/pkg/controller/acmechallenges/sync.go index 46e341b4a..febfda856 100644 --- a/pkg/controller/acmechallenges/sync.go +++ b/pkg/controller/acmechallenges/sync.go @@ -124,6 +124,7 @@ func (c *Controller) Sync(ctx context.Context, ch *cmapi.Challenge) (err error) } ch.Status.Presented = true + c.Recorder.Eventf(ch, corev1.EventTypeNormal, "Presented", "Presented challenge using %s challenge mechanism", ch.Spec.Type) } ok, err := solver.Check(ch) @@ -204,6 +205,8 @@ func (c *Controller) acceptChallenge(ctx context.Context, cl acmecl.Interface, c ch.Status.State = cmapi.State(authErr.Authorization.Status) ch.Status.Reason = fmt.Sprintf("Error accepting authorization: %v", authErr) + c.Recorder.Eventf(ch, corev1.EventTypeWarning, "Failed", "Accepting challenge authorization failed: %v", authErr) + // return nil here, as accepting the challenge did not error, the challenge // simply failed return nil