-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add attribute support for certificate subject #129
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cornfeedhobo The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @cornfeedhobo. Thanks for your PR. I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Fixes cert-manager#128 Signed-off-by: cornfeedhobo <[email protected]>
0af5dbe
to
a6bb5a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
As mentioned on slack, I don't have a tonne of time at the moment but I've added a couple of comments which I hope are useful!
if err != nil { | ||
return nil, fmt.Errorf("%q: %w", v, err) | ||
} | ||
*k = strings.Split(e, ",") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: strings.Split
might not be suitable here, since several of these fields can reasonably contain commas.
I remember that you commented on a PR implementing a similar feature in cert-manager: cert-manager/cert-manager#4502 (comment)
I think we're likely to need a similar approach here as I suggested in there. CSV parsing seems like a good solution.
Example test string:
`"1725 Slough Avenue, Suite 200, Scranton Business Park","10 Downing Street, Westminster",Something Else`
Should produce exactly 3 street address entries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@inteon Hey, I unfortunately don't have the time to revisit this and my team ended up scraping the associated project. Anyone is welcome to pick up where I left off, otherwise it will probably be a few months until I can carve out time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for letting us know!
"correct literal-subject should not error": { | ||
attr: map[string]string{ | ||
csiapi.IssuerNameKey: "test-issuer", | ||
csiapi.LiteralSubjectKey: literalSubject, | ||
csiapi.CAFileKey: "ca.crt", | ||
csiapi.CertFileKey: "crt.tls", | ||
csiapi.KeyFileKey: "key.tls", | ||
csiapi.DNSNamesKey: "foo.bar.com", | ||
csiapi.KeyEncodingKey: "PKCS8", | ||
}, | ||
expErr: nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: this will need many more test cases IMO, to ensure that the splitting functionality works as expected!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SgtCoDFish If I may push back, I felt like if I added too many permutations, I'd essentially be testing github.com/cert-manager/cert-manager/pkg/util/pki.ParseSubjectStringToRawDerBytes
, because that's doing the heavy lifting in this specific case. That said, if you think there is a branch of this logic that could use a better test, I'm open to anything.
/ok-to-test |
Small update. I'll be out for a few weeks but am still tracking this. Looking forward to having more time in a few weeks. |
This PR is ready, but I'm waiting for cert-manager to cut a new release so I don't have to duplicate the CVS functions that are available in |
Update: #129 (comment) |
@cornfeedhobo: 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. 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. I understand the commands that are listed here. |
PR needs rebase. 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. |
Fixes #128
Related cert-manager/cert-manager#4502