-
Notifications
You must be signed in to change notification settings - Fork 82
✨ Workload conditions #362
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
✨ Workload conditions #362
Conversation
ad6c241
to
970c248
Compare
UpdateStrategy *UpdateStrategy `json:"updateStrategy,omitempty"` | ||
|
||
// ConditionRules defines how to set manifestwork conditions for a specific manifest. | ||
// +optional |
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.
you might want to add a marker listMapKey: condition
and set strategy to merge.
|
||
// CelExpressions defines the CEL expressions to be evaluated for the condition. | ||
// Final result is the logical AND of all expressions. | ||
// +optional |
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 am wondering whether with type WellKnownCompletions, we do not need to set any other field in this struct.
If so, we might have a nested struct and put all field not needed for WellKnownCompletions to it, e.g.
type ConditionRule struct {
Condition string `json:"condition"`
Type ConditionRuleType `json:"type"`
// this could be a pointer, so when type is WellKnownCompletions, this is nil
CEL *CELRule `json:"cel"`
}
type CELRule struct {
Expressions []string `json:"expressions"`
Message string `json:"message"`
....
}
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.
My original idea was that the standard message and condition for WellKnownCompletions could be overridden by the user, such that they could use the well known rules but set them to a custom condition/message.
But I do see the benefit to simplifying and using nesting for the CELRule. I am open to switching to this approach if that is what you prefer.
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 prefer a simplified way, and if there is use case later that we need message override for WellKnownCompletions, we could add another field solely for WellKnownCompletions type to set them.
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.
And it might be more consistent if the type is WellKnownCondition? so for completed condition, user should set
condition: Completed
type: WellKownCondition
It would be easier for us to extend later for other condition.
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.
And it might be more consistent if the type is WellKnownCondition? so for completed condition, user should set
condition: Completed type: WellKownCondition
It would be easier for us to extend later for other condition.
This is interesting. My thinking with WellKnownCompletions
was that since Completed is a specialized case, users would want to be able to set that separately from other future well known conditions.
Are you suggesting that a rule like this would select just a single rule that matches the given condition
- condition: Completed
type: WellKnownCondition
and then a rule like this would select all well knowns?
- type: WellKnownCondition
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.
Options:
- Reject in webhook validation
- The last occurrence of a condition overrides all previous
- The full rule for the condition becomes the logical AND of all expressions across the rules
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.
might work if add
// +listType=map
// +listMapKey=type
// +listMapKey=condition
such that there is no duplicate setting. but need take a try,
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.
@bhperry would you like to add // +listMapKey=type
and we are good to merge this.
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 don't think type should be a map key. Condition is required now, so using just that as map key ensures each condition only has one rule. If we add type then OCM has to handle the case where a condition has a WellKnown and custom CEL rule.
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.
got it, it is fine if condition is required.
Signed-off-by: Ben Perry <[email protected]>
Signed-off-by: Ben Perry <[email protected]>
Signed-off-by: Ben Perry <[email protected]>
Signed-off-by: Ben Perry <[email protected]>
Signed-off-by: Ben Perry <[email protected]>
Signed-off-by: Ben Perry <[email protected]>
Signed-off-by: Ben Perry <[email protected]>
970c248
to
456e139
Compare
Signed-off-by: Ben Perry <[email protected]>
d0c6c2d
to
fc00e48
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bhperry, qiujian16 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 |
/lgtm |
5880b0c
into
open-cluster-management-io:main
Summary
Adding the necessary type changes to ManifestWork to support the workload conditions and completion feature.
Related issue(s)
open-cluster-management-io/enhancements#138