-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 kube play --replace should force removal of pods and containers #20457
Conversation
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.
Please split the doc changes into a separate commit.
Looking purely at the changes, I don't think it's sufficient to fix #20025? Please add a regression test to make sure it does. The problem in #20025 is that "external" containers are not being removed/replaced, so we could probably do a buildah from --name=$expected-name
and use that name in a kube YAML to cause a name collision.
@@ -42,6 +42,8 @@ type PlayOptions struct { | |||
LogDriver *string | |||
// LogOptions for the container. For example: journald | |||
LogOptions *[]string | |||
// Replace - replace existing pods and containers | |||
Replace *bool |
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.
That screams for tests. It seems kube play --replace
is not tested on the remote clients or the tests are incomplete.
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.
It was being ignored on remote, since it was never setup to be passed in to remote side.
d152b6e
to
83a097c
Compare
StaticIPs: staticIPs, | ||
StaticMACs: staticMACs, | ||
IsRemote: true, | ||
UseLongAnnotations: query.NoTrunc, | ||
Username: username, | ||
Userns: query.Userns, |
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 like the alpha ordering, but man, GitHub doesn't make it easy to review.
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.
IMO such changes should be part of a separate commit. That'll reduce the noise.
LGTM |
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.
Code LGTM
I'd prefer @edsantiago's blessing on the test.
StaticIPs: staticIPs, | ||
StaticMACs: staticMACs, | ||
IsRemote: true, | ||
UseLongAnnotations: query.NoTrunc, | ||
Username: username, | ||
Userns: query.Userns, |
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.
IMO such changes should be part of a separate commit. That'll reduce the noise.
# Force removal of container | ||
run_podman rm --force -t0 test_pod-test | ||
# Create container external using buildah with same name | ||
buildah from --name test_pod-test $IMAGE |
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 probably needs a run buildah
and status checks.
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.
Not really. buildah
here is much better than run buildah
.
Reason: run
is tricky. It hides exit status and output. In this case here, if plain buildah
fails, BATS will immediately fail and will show all stdout/stderr. If you run buildah
, though, you then need to add cumbersome if $status blah
checks, and then will miss stdout/stderr if you check in the wrong order.
test/system/700-play.bats
Outdated
run_podman play kube $PODMAN_TMPDIR/test.yaml | ||
# Force removal of container | ||
run_podman rm --force -t0 test_pod-test | ||
# Create container external using buildah with same name |
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.
However, I do find container external
confusing. Should that be external container
?
@@ -411,6 +411,23 @@ _EOF | |||
run_podman rmi -f userimage:latest | |||
} | |||
|
|||
@test "podman kube play --replace external storage" { |
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.
Also, as a general rule, when a test is super-confusing (like this one, WTF is it supposed to test) I like to add header comments like "Regression test for #12345; an external container, such as from buildah, caused a "container name is already in use" failure.
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.
Fixed.
Signed-off-by: Daniel J Walsh <[email protected]>
Fixes: containers#20025 Signed-off-by: Daniel J Walsh <[email protected]>
# Ocassionaly a remnant storage container is left behind which causes | ||
# podman play kube --replace to fail. This tests created a conflicting | ||
# storage container name using buildah to make sure --replace, still | ||
# functions proplery by removing the storage container. |
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.
Typos (Occasionally, properly) and unclear wording ("tests created"), but the former will be fixed some day on the next spellcheck PR, and the latter is not worth a repush. (But if you have to repush for other reasons, please fix).
LGTM
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, 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 |
Seems to work.
|
Fixes: #20025
Does this PR introduce a user-facing change?
[NO NEW TESTS NEEDED]