Certificate Signing Request Issuer CA#4064
Certificate Signing Request Issuer CA#4064jetstack-bot merged 11 commits intocert-manager:masterfrom
Conversation
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
controller Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
CertificateSigningRequersts Issuers Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
|
flake |
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
|
/test pull-cert-manager-e2e-v1-21 |
SgtCoDFish
left a comment
There was a problem hiding this comment.
a few comments from me; a lot of these are small but there are a couple of bigger ones.
as this is quite a big PR[1], I can't be fully confident that I've been over everything - a second set of eyes would be good here I think.
[1] not a criticism; it's hard to imagine how this could have been cut down much.
pkg/apis/experimental/doc.go
Outdated
| // +groupName=experimental.cert-manager.io | ||
| // +groupGoName=Experimental | ||
|
|
||
| // Package certmanager is the internal version of the API. |
There was a problem hiding this comment.
nitpick: this doc comment is incorrect, I think?
| // Package certmanager is the internal version of the API. | |
| // Package experimental ... |
| func BuildKeyUsagesKube(usages []certificatesv1.KeyUsage) (ku x509.KeyUsage, eku []x509.ExtKeyUsage, err error) { | ||
| var unk []certificatesv1.KeyUsage | ||
| if len(usages) == 0 { | ||
| usages = []certificatesv1.KeyUsage{certificatesv1.UsageDigitalSignature, certificatesv1.UsageKeyEncipherment} |
There was a problem hiding this comment.
suggestion: should these default values come from https://github.com/jetstack/cert-manager/blob/a80198c03d108e4ceb7e5aceb0f2fd78be5db39d/pkg/apis/certmanager/v1/types.go#L203?
(I recognise that will require converting a certmangerv1.KeyUsage to a certificatesv1.KeyUsage, but I think it'd be good to re-use that function)
There was a problem hiding this comment.
Not sure I understand the intention with reusing this function. We are using a separate API group and are different types.
There was a problem hiding this comment.
"Default cert-manager key usages for certificates" is a useful concept and if we're going to have it as a concept we might as well have one place to change it rather than multiple places where we can forget one of them. I suppose we'd have, say, in pseudocode:
func DefaultKeyUsages() []x509.KeyUsagein pkg/internal/ somewhere. I don't think it's required for this PR to be merged.
There was a problem hiding this comment.
Let's leave this for now. We can always add the Default to the API at a later date.
irbekrm
left a comment
There was a problem hiding this comment.
Looks good to me- I have read through the code and ran the tests.
I've added a couple nits, but generally happy to approve.
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
|
Thanks @SgtCoDFish @irbekrm I have addressed your comments in the latest commit or responded. Good for another review and (hopefully) merge 🙂 |
|
/assign @irbekrm @SgtCoDFish |
irbekrm
left a comment
There was a problem hiding this comment.
Looks good to me- I could have spent more time actually trying it out, but I guess since it's an experimental controller it'd be easier to change things later.
SgtCoDFish
left a comment
There was a problem hiding this comment.
just one test looks incorrect to me
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
SgtCoDFish
left a comment
There was a problem hiding this comment.
one style suggestion from me, but non-blocking
| switch len(signerNameSplit) { | ||
| case 1: | ||
| return SignerIssuerRef{ | ||
| Namespace: "", | ||
| Name: signerNameSplit[0], | ||
| Type: signerTypeSplit[0], | ||
| Group: signerTypeSplit[1], | ||
| }, true | ||
|
|
||
| default: | ||
| // ClusterIssuers do not have Namespaces | ||
| if signerTypeSplit[0] == "clusterissuers" { | ||
| return SignerIssuerRef{ | ||
| Namespace: "", | ||
| Name: strings.Join(signerNameSplit[0:], "."), | ||
| Type: signerTypeSplit[0], | ||
| Group: signerTypeSplit[1], | ||
| }, true | ||
| } | ||
|
|
||
| // Non Cluster Scoped issuers always have Namespaces | ||
| return SignerIssuerRef{ | ||
| Namespace: signerNameSplit[0], | ||
| Name: strings.Join(signerNameSplit[1:], "."), | ||
| Type: signerTypeSplit[0], | ||
| Group: signerTypeSplit[1], | ||
| }, true | ||
| } |
There was a problem hiding this comment.
good spot on the clusterissuers special case!
suggestion (non-blocking): I know this is splitting hairs a little, but would this be better as an if statement? A switch with a single case and a default doesn't feel right; at the very least, we can save a level of indentation here.
| switch len(signerNameSplit) { | |
| case 1: | |
| return SignerIssuerRef{ | |
| Namespace: "", | |
| Name: signerNameSplit[0], | |
| Type: signerTypeSplit[0], | |
| Group: signerTypeSplit[1], | |
| }, true | |
| default: | |
| // ClusterIssuers do not have Namespaces | |
| if signerTypeSplit[0] == "clusterissuers" { | |
| return SignerIssuerRef{ | |
| Namespace: "", | |
| Name: strings.Join(signerNameSplit[0:], "."), | |
| Type: signerTypeSplit[0], | |
| Group: signerTypeSplit[1], | |
| }, true | |
| } | |
| // Non Cluster Scoped issuers always have Namespaces | |
| return SignerIssuerRef{ | |
| Namespace: signerNameSplit[0], | |
| Name: strings.Join(signerNameSplit[1:], "."), | |
| Type: signerTypeSplit[0], | |
| Group: signerTypeSplit[1], | |
| }, true | |
| } | |
| if len(signerNameSplit) == 1 { | |
| return SignerIssuerRef{ | |
| Namespace: "", | |
| Name: signerNameSplit[0], | |
| Type: signerTypeSplit[0], | |
| Group: signerTypeSplit[1], | |
| }, true | |
| } | |
| // ClusterIssuers do not have Namespaces | |
| if signerTypeSplit[0] == "clusterissuers" { | |
| return SignerIssuerRef{ | |
| Namespace: "", | |
| Name: strings.Join(signerNameSplit[0:], "."), | |
| Type: signerTypeSplit[0], | |
| Group: signerTypeSplit[1], | |
| }, true | |
| } | |
| // Non Cluster Scoped issuers always have Namespaces | |
| return SignerIssuerRef{ | |
| Namespace: signerNameSplit[0], | |
| Name: strings.Join(signerNameSplit[1:], "."), | |
| Type: signerTypeSplit[0], | |
| Group: signerTypeSplit[1], | |
| }, true |
There was a problem hiding this comment.
I'm a big proponent for switch statements personally 🤷
There was a problem hiding this comment.
Happy to change it to an if statement though.
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: irbekrm, JoshVanL, SgtCoDFish 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 |
|
/test pull-cert-manager-e2e-v1-21 |
|
@JoshVanL: 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. |
What this PR does / why we need it:
This PR adds an optional CertificateSigningRequest CA issuer. The controller is only enabled if it is explicitly done so via the
--feature-gatesflag (i.e.--feature-gates=ExperimentalCertificateSigningRequestControllers=true)This begins the work to integrating kubernetes CertificateSigningRequests as part of cert-manager. (ref #3646).
Users who request a certificate referencing a namespaced issuer, must have permissions to do so in the following form:
A SubjectAccessReview is performed during processing to check whether the user has sufficient permissions to reference the Issuer encoded into the signer name.
Special notes for your reviewer:
This work is based on the design in #3646
Release note:
/cc @munnerz