Add explicit check for certificate.spec.acme when issuing acme certificates

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2018-11-28 19:18:09 +00:00
parent 32c230656f
commit 87f91a6e8e

View File

@ -115,6 +115,13 @@ func (c *Controller) Sync(ctx context.Context, crt *v1alpha1.Certificate) (reque
return false, nil
}
// If this is an ACME certificate, ensure the certificate.spec.acme field is
// non-nil
if issuerObj.GetSpec().ACME != nil && crtCopy.Spec.ACME == nil {
c.Recorder.Eventf(crtCopy, corev1.EventTypeWarning, "BadConfig", "spec.acme field must be set")
return false, nil
}
issuerReady := issuerObj.HasCondition(v1alpha1.IssuerCondition{
Type: v1alpha1.IssuerConditionReady,
Status: v1alpha1.ConditionTrue,