diff --git a/docs/generated/reference/output/reference/api-docs/index.html b/docs/generated/reference/output/reference/api-docs/index.html
index 08ac8dd85..672445e9b 100755
--- a/docs/generated/reference/output/reference/api-docs/index.html
+++ b/docs/generated/reference/output/reference/api-docs/index.html
@@ -154,6 +154,10 @@ Appears In:
lastFailureTime Time |
|
+
+notAfter Time |
+The expiration time of the certificate stored in the secret named by this resource in spec.secretName. |
+
diff --git a/pkg/apis/certmanager/v1alpha1/types_certificate.go b/pkg/apis/certmanager/v1alpha1/types_certificate.go
index f096f3928..1b67f0e44 100644
--- a/pkg/apis/certmanager/v1alpha1/types_certificate.go
+++ b/pkg/apis/certmanager/v1alpha1/types_certificate.go
@@ -109,6 +109,10 @@ type ACMECertificateConfig struct {
type CertificateStatus struct {
Conditions []CertificateCondition `json:"conditions,omitempty"`
LastFailureTime *metav1.Time `json:"lastFailureTime,omitempty"`
+
+ // The expiration time of the certificate stored in the secret named
+ // by this resource in spec.secretName.
+ NotAfter *metav1.Time `json:"notAfter,omitempty"`
}
// CertificateCondition contains condition information for an Certificate.
diff --git a/pkg/apis/certmanager/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/certmanager/v1alpha1/zz_generated.deepcopy.go
index 919af8134..36b7bdb5d 100644
--- a/pkg/apis/certmanager/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/certmanager/v1alpha1/zz_generated.deepcopy.go
@@ -533,6 +533,15 @@ func (in *CertificateStatus) DeepCopyInto(out *CertificateStatus) {
(*in).DeepCopyInto(*out)
}
}
+ if in.NotAfter != nil {
+ in, out := &in.NotAfter, &out.NotAfter
+ if *in == nil {
+ *out = nil
+ } else {
+ *out = new(v1.Time)
+ (*in).DeepCopyInto(*out)
+ }
+ }
return
}
diff --git a/pkg/controller/certificates/sync.go b/pkg/controller/certificates/sync.go
index 26857aca9..54d1b4873 100644
--- a/pkg/controller/certificates/sync.go
+++ b/pkg/controller/certificates/sync.go
@@ -160,6 +160,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
diff --git a/test/util/util.go b/test/util/util.go
index acfb5d950..2cc72bc97 100644
--- a/test/util/util.go
+++ b/test/util/util.go
@@ -283,6 +283,15 @@ func WaitCertificateIssuedValid(certClient clientset.CertificateInterface, secre
return false, nil
}
+ if certificate.Status.NotAfter == nil {
+ glog.Infof("No certificate expiration found for Certificate %q", name)
+ return false, nil
+ }
+ if !cert.NotAfter.Equal(certificate.Status.NotAfter.Time) {
+ glog.Info("Expected certificate expire date to be %v, but got %v", certificate.Status.NotAfter, cert.NotAfter)
+ return false, nil
+ }
+
label, ok := secret.Labels[v1alpha1.CertificateNameKey]
if !ok {
return false, fmt.Errorf("Expected secret to have certificate-name label, but had none")