-
Notifications
You must be signed in to change notification settings - Fork 76
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
fix: don't error if source selector selects no sources #432
fix: don't error if source selector selects no sources #432
Conversation
/cc @SgtCoDFish |
59c12c5
to
3ec505e
Compare
@SgtCoDFish I think this PR is ready for another review now! |
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.
One suggestion from me; what do you think?
Signed-off-by: Erik Godding Boye <egboye@gmail.com>
3ec505e
to
e7049f0
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.
I'm not sure if I missed something but wasn't there a new check to ensure the bundle wasn't empty, so we still required a bundle to resolve to at least one cert?
Is that missing here? Was it added elsewhere? I might be missing it but it looks like this would permit an empty target?
The check is already there: https://github.com/cert-manager/trust-manager/blob/main/pkg/bundle/source.go#L90-L92, and it is now not changed in this PR. 😉 Tested by an existing test, but also with one of the additional tests introduced in this PR (selects nothing). |
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
Sorry for the delay, something came up!
I totally missed that check. Thanks very much for this 🙌
[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 |
Fixes #426?
We have a test that asserts an error when the bundle is empty. I doubt if this is correct, and to fix #426 properly, I think this behavior must go. We could eventually assert that a Bundle is invalid if it doesn't contain at least one source spec. But that is better done with the webhook (or API CEL expression) IMO.UPDATE: After discussing this PR in today's stand-up, we decided to keep the existing (and tested) behavior where a target bundle needs to contain at least one certificate, at least for now. This means that this PR only fixes a minor bug: before this PR it would error if any source selector selects no sources. Now this is ok, but the resulting bundle must contain at least one certificate.