-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
✨ pkg/predicate.go: add And and Or predicates #1043
✨ pkg/predicate.go: add And and Or predicates #1043
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: joelanford 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 |
/hold |
If and is already the default, why add an explicit wrapper to replicate that? |
It would still be needed for arbitrary boolean syntax: e.g. Edit: wondering if there should be a |
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
We should probably add godocs clarifying that predicates are anded by default
/hold cancel This was discussed at the biweekly developer meeting and there was consensus to merge it. |
/retest |
/milestone v0.6.x |
@joelanford: You must be a member of the kubernetes-sigs/controller-runtime-maintainers GitHub team to set the milestone. If you believe you should be able to issue the /milestone command, please contact your Controller Runtime Maintainers and have them propose you as an additional delegate for this responsibility. In 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. |
^^^ @vincepri can we get this into the next v0.6.x release? |
/milestone v0.6.x @joelanford Yes, it'll definitely be 👍 |
This PR adds two new boolean predicate functions (
predicate.And()
andpredicate.Or()
) that take a variadic predicates argument.When creating a watch, multiple predicates can be used, but they are always logically ANDed together. If these boolean predicates existed, it would be easier for users to reuse simple predicates to build complex predicate filters for their watches without having to resort to writing their own monolithic predicate from scratch.