Skip to content
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

podman wait: support healthy/unhealthy #18974

Merged
merged 3 commits into from
Jun 23, 2023

Conversation

vrothberg
Copy link
Member

Broken into 3 commits as it required some massaging in the backend.

Does this PR introduce a user-facing change?

Support `--condition={healthy,unhealthy}` in `podman wait` allowing to wait to wait for successful health checks.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vrothberg

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 22, 2023
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Jun 22, 2023
@vrothberg
Copy link
Member Author

@mheon @Luap99 PTAL

Copy link
Member Author

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed too early. Will still fail on remote but reviews are appreciated nonetheless.

switch condition {
case define.ContainerStateExited, define.ContainerStateStopped:
waitForExit = true
for _, rawCondition := range conditions {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to sanitize these (lowercase them) before this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a change in behavior. Podman errors on --condition=Exited for instance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like fixing that would be more of a bugfix than anything, but I won't hold up this PR over it.

While reading the code I found the man page to be lacking some
information that I found worth mentioning and clarifying.
In particular, how the command behaves with respect to exit codes and
when more than one condition is specified.

Signed-off-by: Valentin Rothberg <[email protected]>
Massage the internal APIs to use a string slice instead of a state slice
for passing wait conditions.  This paves the way for waiting on
non-state conditions such as "healthy".

Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member Author

Good to merge from my end

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update AutocompleteWaitCondition to make sure the shell autocompletion shows the new values.

Support two new wait conditions, "healthy" and "unhealthy".  This
further paves the way for integrating sdnotify with health checks which
is currently being tracked in containers#6160.

Fixes: containers#13627
Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member Author

please update AutocompleteWaitCondition to make sure the shell autocompletion shows the new values.

✔️

@mheon
Copy link
Member

mheon commented Jun 23, 2023

LGTM

@rhatdan
Copy link
Member

rhatdan commented Jun 23, 2023

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 23, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 23, 2023
@vrothberg
Copy link
Member Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 23, 2023
@openshift-merge-robot openshift-merge-robot merged commit 8445498 into containers:main Jun 23, 2023
@vrothberg vrothberg deleted the fix-13627 branch June 26, 2023 06:02
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/api-change Change to remote API; merits scrutiny lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants