-
Notifications
You must be signed in to change notification settings - Fork 1k
Add nested condition block to wait block #1595
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
Conversation
a44df61
to
b05a178
Compare
b7eb915
to
7a12b04
Compare
7a12b04
to
485edea
Compare
485edea
to
0fce92e
Compare
cd19559
to
b7d163e
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.
Nice addition! 🚀 Just one minor comment in the documentations section.
@@ -200,6 +200,7 @@ The following arguments are supported: | |||
#### Arguments | |||
|
|||
- **rollout** (Optional) When set to `true` will wait for the resource to roll out, equivalent to `kubectl rollout status`. | |||
- **conditions** (Optional) A set of conditions to wait for. |
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.
The conditions
block has two nested attributes status
and type
. Could you please mention them in the documentation too?
One small comment regarding style here. Could you please make all argument names formatted as code
instead of bold text?
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.
Looks good!
Small observation where we could simplify logic a bit, otherwise all good stuff!
manifest/provider/waiter.go
Outdated
var conditionType, conditionStatus string | ||
condition["type"].As(&conditionType) | ||
condition["status"].As(&conditionStatus) | ||
conditionsMet[conditionType] = false |
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 could actually just be a boolean that is progressively AND-ed to the current condition status in the loop. This way, it only becomes true when no condition is false. Seems a bit simpler, since we're not reporting the individual conditions status up to the user.
manifest/provider/waiter.go
Outdated
if ccc["type"].(string) != conditionType { | ||
continue | ||
} | ||
conditionsMet[conditionType] = ccc["status"].(string) == conditionStatus |
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 updating of boolean conditionsMet
could happen here.
manifest/provider/waiter.go
Outdated
done := true | ||
for _, v := range conditionsMet { | ||
if !v { | ||
done = false | ||
} | ||
} |
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 wouldn't be needed when using accumulator boolean. Instead of "done", the check would be on directly "conditionsMet".
b7d163e
to
5b2ffdb
Compare
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
This PR adds a nested
condition
block to thewait
block to configure sets of conditions to wait to be met.Acceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
Community Note