Skip to content

Commit

Permalink
enable cert duration for acme issuer
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelVogel authored and marc1404 committed Nov 12, 2024
1 parent 5e5be29 commit 31fb12e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/cert/legobridge/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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),
})
}

Expand Down
6 changes: 5 additions & 1 deletion pkg/controller/issuer/certificate/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 31fb12e

Please sign in to comment.