set the NotAfter time as soon as the cert is parsed successfully

Signed-off-by: Gus Parvin <gparvin@us.ibm.com>
This commit is contained in:
Gus Parvin 2018-11-15 14:30:31 +00:00
parent ff3f198eca
commit acc0fa887b

View File

@ -156,6 +156,9 @@ func (c *Controller) Sync(ctx context.Context, crt *v1alpha1.Certificate) (reque
return false, err
}
metaNotAfter := metav1.NewTime(cert.NotAfter)
crtCopy.Status.NotAfter = &metaNotAfter
// begin checking if the TLS certificate is valid/needs a re-issue or renew
// check if the private key is the corresponding pair to the certificate
@ -179,9 +182,6 @@ func (c *Controller) Sync(ctx context.Context, crt *v1alpha1.Certificate) (reque
return c.issue(ctx, i, crtCopy)
}
metaNotAfter := metav1.NewTime(cert.NotAfter)
crtCopy.Status.NotAfter = &metaNotAfter
// check if the certificate needs renewal
needsRenew := c.Context.IssuerOptions.CertificateNeedsRenew(cert)
if needsRenew {