-
Notifications
You must be signed in to change notification settings - Fork 551
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
feat(resolver): support generic constraint using CEL #2506
feat(resolver): support generic constraint using CEL #2506
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dinhxuanvu 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 |
efce4b9
to
f379574
Compare
8f90b14
to
07fd34e
Compare
Due to the automatic approved label added by the bot, I place a hold on here to avoid accident merging. |
b798482
to
574293b
Compare
evaluator constraints.Evaluator | ||
rule string | ||
message string |
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.
Maybe I'm being naive, but I'm a little surprised to see constraint-specific logic on the OLM side of this. I was imagining that we'd define a generic Constraint
interface in o-f/api
that Cel
, All
, Any
, None
, etc. would all implement.
That way, all OLM would need to do would be unmarshal the constraints and then use that generic interface to evaluate them. What am I missing?
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 is predicate information. The rule
and message
are there to surface those information to the resolver during failure with .String()
function. It is not the same as Constraint
struct in api
repo.
9c5730a
to
1c0510a
Compare
1c0510a
to
63f39d2
Compare
63f39d2
to
a311f52
Compare
It would be nice to refactor some of this into a more generic setup like in #2418 but I can always rebase my PR if it goes in after this one, or do a follow-up if this goes in last. /lgtm |
Introduce the new type of constraint that uses CEL (Common Expression Language) as an expression language to define the constraint in a generic way. This type of constraint will allow operator authors to specify a dependency on any arbitrary properties in the bundle. This constraint also supports logical operator such as AND and OR in the CEL expression. Signed-off-by: Vu Dinh <[email protected]>
Add unit test cases for generic constraint using CEL to ensure it works properly in the resolver. Add some context for the custom library for semver comparison in CEL. Signed-off-by: Vu Dinh <[email protected]>
Signed-off-by: Vu Dinh <[email protected]>
Signed-off-by: Vu Dinh <[email protected]>
a311f52
to
2b5313b
Compare
/hold cancel |
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.
Nice work @dinhxuanvu
/lgtm
Signed-off-by: Vu Dinh [email protected]
Description of the change:
Introduce the new type of constraint that uses CEL (Common Expression Language)
as an expression language to define the constraint in a generic way.
This type of constraint will allow operator authors to specify a dependency
on any arbitrary properties in the bundle. This constraint also supports
logical operator such as AND and OR in the CEL expression.
Motivation for the change:
https://github.com/operator-framework/enhancements/blob/master/enhancements/generic-constraints.md
Reviewer Checklist
/doc