Configurable issuer duration and renewBefore#520
Configurable issuer duration and renewBefore#520vdesjardins wants to merge 2 commits intocert-manager:masterfrom
Conversation
|
/ok-to-test
…On Sat, 28 Apr 2018 at 05:46, jetstack-bot ***@***.***> wrote:
[APPROVALNOTIFIER] This PR is *NOT APPROVED*
This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: *kragniz*
Assign the PR to them by writing /assign @kragniz in a comment when ready.
The full list of commands accepted by this bot can be found here
<https://go.k8s.io/bot-commands>.
The pull request process is described here
<https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process>
Needs approval from an approver in each of these files:
- *OWNERS
<https://github.com/jetstack/cert-manager/blob/master/OWNERS>*
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#520 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMbP-ob4cwRGtV_tFIw2Nn9UB0cyiWmks5ts_Q5gaJpZM4TrPmN>
.
|
de26bbc to
178e943
Compare
pkg/controller/certificates/sync.go
Outdated
| messageCertificateRenewed = "Certificate renewed successfully" | ||
|
|
||
| messageWarningCertificateDuration = "Certificate duration received from issuer is %s which is lower than the issuer configured duration of %s" | ||
| messageWarningScheduleModified = "Certificate renewal requested schedule cannot be honored. Specified renewBefore of %s is greater than certificate total duration of %s" |
There was a problem hiding this comment.
This sounds like a hard error to me - perhaps rephrase to explain that we've instead changed the renewal date?
I'd also make this a non-warning (i.e. EventTypeNormal), as some users will take a warning to be an error and starting opening issues 😬
pkg/issuer/acme/setup.go
Outdated
| const ( | ||
| errorAccountRegistrationFailed = "ErrRegisterACMEAccount" | ||
| errorAccountVerificationFailed = "ErrVerifyACMEAccount" | ||
| errorDurationInvalid = "ErrACMEDurationInvalid" |
There was a problem hiding this comment.
Needn't be an ACME specific error. ErrDurationInvalid should suffice, and can be reused across issuers.
pkg/issuer/acme/setup.go
Outdated
| messageAccountVerificationFailed = "Failed to verify ACME account: " | ||
| messageAccountRegistered = "The ACME account was registered with the ACME server" | ||
| messageAccountVerified = "The ACME account was verified with the ACME server" | ||
| messageDurationInvalid = "ACME " |
There was a problem hiding this comment.
Remove this var - it doesn't really add any context for the user. They are already aware that it is an ACME certificate. We can instead just set the conditions message to err.Error()
pkg/issuer/acme/setup.go
Outdated
| if err != nil { | ||
| s := messageDurationInvalid + err.Error() | ||
| a.issuer.UpdateStatusCondition(v1alpha1.IssuerConditionReady, v1alpha1.ConditionFalse, errorDurationInvalid, s) | ||
| return fmt.Errorf(s) |
There was a problem hiding this comment.
Can get rid of s and just return err here instead.
pkg/issuer/ca/setup.go
Outdated
| messageKeyPairVerified = "Signing CA verified" | ||
|
|
||
| messageDurationInvalid = "CA " | ||
| errorDurationInvalid = "ErrCADurationInvalid" |
There was a problem hiding this comment.
Can get rid of both of these vars
pkg/issuer/ca/setup.go
Outdated
| s := messageDurationInvalid + err.Error() | ||
| glog.Info(s) | ||
| c.issuer.UpdateStatusCondition(v1alpha1.IssuerConditionReady, v1alpha1.ConditionFalse, errorDurationInvalid, s) | ||
| return fmt.Errorf(s) |
This addresses comments in PR cert-manager#520. To make the Duration check more generic it was moved into the Issuer factory, allowing all Issuers to benifit.
|
Hi, this is a feature that I am interested in using. Is there anything that I can do to help shepherd this along it's path? |
|
I just pushed an update to the pull request with fixes for the code review and support for the Vault issuer. The main remaining issue that I can think of right now is what we should do with the ACMEv2 issuer. The ACMEv2 issuer receives a validation error from Let's Encrypt (Boulder) when a custom notBefore and notAfter is specified in the order request. The reason is that the Boulder server do not implement that particular feature of the spec. Since Boulder (and Pebble) are the only servers implementing the ACMEv2 protocol that I'm aware of maybe we could do one of these:
|
|
It's an optional field in the acme spec. I would just put it in as a warning that it's not supported by the ACME server. |
d57696b to
0058f94
Compare
|
/cc @vdesjardins |
|
@munnerz: GitHub didn't allow me to request PR reviews from the following users: vdesjardins. Note that only jetstack members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
9b8e239 to
ee86bb6
Compare
|
/retest |
ee86bb6 to
191ce58
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
191ce58 to
9e1951f
Compare
9e1951f to
516be06
Compare
|
@vdesjardins: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
| // Clearing the specified validity period in the request and try again | ||
| order.NotBefore = time.Time{} | ||
| order.NotAfter = time.Time{} | ||
| createdOrder, err = cl.CreateOrder(ctx, order) |
There was a problem hiding this comment.
I think we need some way to mark a certification configuration as invalid in order to prevent re-processing of a Certificate in this case, instead of re-attempting to create ourselves.
This will require us somehow hashing the 'input values' (i.e. the Duration field right now) and recording on the Certificate resource that the particular configuration is invalid. When a re-sync happens (i.e. when the resource changes), we will have to compare that hash to the hash of the new resource in order to determine if a user has updated their configuration, in which case we retry CreateOrder with the new configuration.
I think there are a number of places where this could be useful, at least for ACME. Perhaps for other Issuers (or other parts of the ACME issuer) in future too. It's sort of 'runtime validation' against the actual Issuer, and not just validating the resources are valid 😄
There was a problem hiding this comment.
Yes I agree. Perhaps we can store it in a label like the hash computed by the deployment resource? In the pod resource this field is called pod-template-hash.
There was a problem hiding this comment.
#761 will allow us to skip processing Certificate resources with particular fields set if they reference ACME issuers.
This should allow us to just blanket not support setting these fields with all ACME issuers. We can then explore at a later time an implementation that's more complex without making a breaking change 😄
There was a problem hiding this comment.
#761 has now merged, so we should be able to add in this check now 😄
@vdesjardins are you still in a position to rebase and get this PR up to date? There's been a few changes that may effect your implementation slightly!
There was a problem hiding this comment.
I should have some time hopefully to start looking at it the coming days!
|
@vdesjardins: PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Closing this in favour of #893 😄 |
What this PR does / why we need it:
This pull request makes possible to configure the certificate validity duration and the renewal before duration per issuer.
Which issue this PR fixes:
#437
Special notes for your reviewer:
Split from Vault issuer pull request #292
Release note: