diff --git a/pkg/cert/legobridge/certificate.go b/pkg/cert/legobridge/certificate.go index 0c105156..00442d8c 100644 --- a/pkg/cert/legobridge/certificate.go +++ b/pkg/cert/legobridge/certificate.go @@ -162,6 +162,7 @@ func obtainForDomains(client *lego.Client, domains []string, input ObtainInput) AlwaysDeactivateAuthorizations: input.AlwaysDeactivateAuthorizations, PreferredChain: input.PreferredChain, PrivateKey: privateKey, + NotAfter: time.Now().Add(input.Duration), } return client.Certificate.Obtain(request) } @@ -278,6 +279,7 @@ func obtainForCSR(client *lego.Client, csr []byte, input ObtainInput) (*certific Bundle: true, AlwaysDeactivateAuthorizations: input.AlwaysDeactivateAuthorizations, PreferredChain: input.PreferredChain, + NotAfter: time.Now().Add(input.Duration), }) } diff --git a/pkg/controller/issuer/certificate/reconciler.go b/pkg/controller/issuer/certificate/reconciler.go index 4b1e9e0e..a76b4861 100644 --- a/pkg/controller/issuer/certificate/reconciler.go +++ b/pkg/controller/issuer/certificate/reconciler.go @@ -403,7 +403,10 @@ func (r *certReconciler) obtainCertificateAndPendingACME(logctx logger.LogContex if err != nil { return r.failed(logctx, obj, api.StateError, err) } - + duration, err := r.getDuration(cert) + if err != nil { + return r.failedStop(logctx, obj, api.StateError, err) + } err = r.validateDomainsAndCsr(&cert.Spec, issuer.Spec.ACME.Domains, issuerKey) if err != nil { return r.failedStop(logctx, obj, api.StateError, err) @@ -502,6 +505,7 @@ func (r *certReconciler) obtainCertificateAndPendingACME(logctx logger.LogContex AlwaysDeactivateAuthorizations: r.alwaysDeactivateAuthorizations, PreferredChain: preferredChain, KeyType: keyType, + Duration: duration, } err = r.obtainer.Obtain(input)