-
Notifications
You must be signed in to change notification settings - Fork 69
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
Improve certificate deduplication operation #303
Conversation
Hi @arsenalzp. 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. |
/ok-to-test |
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, @arsenalzp! I've added some comments/questions, but I consider this to be a good change.
/approve
/ok-to-test |
/lgtm |
I found the issue, deduplication doesn't work for certificates which are joined into one source, for example: a.crt:
b.crt:
However it works for a single certificate per one source, like this:
b.crt:
So, I made some improvements for my code, as well as for test. |
/retest |
@erikgb |
Yes, that was what I was also thinking in my review comment. But I suggest to do it in a separate PR, as this PR is almost GTM IMO. /lgtm |
Thank you for your reviews, hints and work! |
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.
This looks like it could maybe use more refactoring to use CertPool or something, but I'm OK with merging if it improves things.
Just one comment from me!
I created #305 as a placeholder issue. I suspect it to affect multiple areas of the code, especially unit tests, so I think it makes sense to do it in a separate PR. @arsenalzp has gracefully volunteered to look into it. |
|
It seems, I did something wrong during rebase... |
Yeah the rebase looks wrong for sure. It looks like the commit hash we want is |
It's done. |
/retest |
Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com> improvement for TestBundlesDeduplication and name convention Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com> improve deduplication process by using pem features Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com> add more test of deduplication process Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com> remove unnecessary calls in sync.go Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com> add error parameter in deduplicateBundles() Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
/retest |
/test pull-trust-manager-smoke |
I think the point is it would be great if it can generate determinstic
trust bundle. Regardless of ca order in the source.
…On Tue, Feb 27, 2024, 14:41 Oleksandr Krutko ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/bundle/sync.go
<#303 (comment)>
:
> @@ -130,7 +131,12 @@ func (b *bundle) buildSourceBundle(ctx context.Context, bundle *trustapi.Bundle)
return bundleData{}, fmt.Errorf("couldn't find any valid certificates in bundle")
}
- if err := resolvedBundle.populateData(bundles, bundle.Spec.Target); err != nil {
+ deduplicatedBundles, err := deduplicateBundles(bundles)
Which key should be used for sort?
—
Reply to this email directly, view it on GitHub
<#303 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACZKDPBDIDE4QQBWMSHY7HDYVZOKRAVCNFSM6AAAAABDVO3DACVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSMBUHE2TIMJWG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I agree, but would put it even stronger: "We MUST.." 😉 |
I guess it should be done in separate PR. |
I consider this to be deterministic enough. |
Moreover, dedup function doesn't shuffle certs, and only a user knows the right certs order, if we would do a sort of its certs - it might cause a bother... |
I'd be interested to explore fully deterministic ordering further in a separate issue & PR. I'd do it alphanumerically based on the hex-encoded sha256 certificate fingerprint personally! |
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.
/lgtm
/approve
Thank you for this, I think it's good to merge personally. Really appreciate it!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: SgtCoDFish The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/unhold |
This PR fixes issue #299