Fire Events when challenges succeed or fail

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2018-11-07 20:38:22 +00:00
parent c3b4f2b84e
commit 5cc3240145

View File

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