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

Remove containers when pod prune & pod rm. #4443

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

QiWang19
Copy link
Contributor

@QiWang19 QiWang19 commented Nov 4, 2019

fix #4346

This path allows pod prune & pod rm to remove stopped containers in the pod before deleting the pod.
PrunePods and RemovePod should be able to remove containers without force removal of stopped pods.

Signed-off-by: Qi Wang [email protected]

@QiWang19 QiWang19 force-pushed the prune_pod branch 3 times, most recently from 5cd2425 to 69c10ab Compare November 6, 2019 19:14
@QiWang19 QiWang19 force-pushed the prune_pod branch 10 times, most recently from baa14cb to b3d8b99 Compare November 8, 2019 19:21
@@ -247,7 +247,7 @@ func (i *LibpodAPI) RemovePod(call iopodman.VarlinkCall, name string, force bool
if err != nil {
return call.ReplyPodNotFound(name, err.Error())
}
if err = i.Runtime.RemovePod(ctx, pod, force, force); err != nil {
if err = i.Runtime.RemovePod(ctx, pod, true, force); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes the issue for podman remote pod prune remove stop containers.
But podman remote pod rm will use the same logic to remove pod and stopped containers from the pod.
Do we allow podman pod rm to remove pod if containers are stopped?
@rhatdan @mheon

Copy link
Member

Choose a reason for hiding this comment

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

We should, that is the change we made to podman pod rm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Then remove this test. Podman pod will always have a container. I don't see a reason to not remove the pod. Too much work on the user to have to remove all containers before removing the pod. Force says remove the pod and containers if they are running.
Containers in Pods do not standalone, so pod includes containers.

Copy link
Member

Choose a reason for hiding this comment

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

We handle the infra container explicitly. I would prefer that we keep the current behavior - --force to remove pods with anything other than an infra container

Copy link
Member

Choose a reason for hiding this comment

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

Why. Containers are part of the Pod and should be treated as such. Similar to built in volumes. I don't want to add yet another option that will confuse the users.

When people think in terms of pods, they do not consider the containers as separate.

Copy link
Member

Choose a reason for hiding this comment

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

And podman rm doesn't remove volumes unless you tell it to - you need --volumes to do that.

Copy link
Member

Choose a reason for hiding this comment

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

Honestly, we should just get a session together about pods at the F2F - it's a good opportunity to revisit these decisions

Copy link
Member

Choose a reason for hiding this comment

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

podman rm removes the builtin volumes, IE Volumes that are not used by other entities, I see Pod containers the same way. But yes we can talk about this at the Face2Face.

@haircommander @mrunalp What does kubernetes do. Does it first remove all of the containers from a pod, before removing the pod, or when you tell CRI-O to remove the pod, then it removes all of the containers and finally the POD?

Copy link
Collaborator

@haircommander haircommander Nov 8, 2019

Choose a reason for hiding this comment

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

if the kubelet asks cri-o to remove a pod, it is removed, regardless of containers that live in it, I am pretty sure. The kubelet making a request of cri-o is a bit different than a user typing cli, though. I think ultimately I'm with @rhatdan here, a pod should be treated as a unit in removal.

@QiWang19
Copy link
Contributor Author

@rhatdan @mheon @haircommander PTAL

@QiWang19 QiWang19 changed the title Remove containers when pruning a stopped pod. Remove containers when pod prune & pod rm. Nov 26, 2019
@haircommander
Copy link
Collaborator

LGTM

@rhatdan
Copy link
Member

rhatdan commented Nov 26, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2019
@mheon
Copy link
Member

mheon commented Nov 26, 2019

Eh. Not the biggest fan of removing containers without --force but I think I'm definitely in the majority here. LGTM

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2019
This path allows pod prune & pod rm to remove stopped containers in the pod before deleting the pod.
PrunePods and RemovePod should be able to remove containers without force removal of stopped pods.

Signed-off-by: Qi Wang <[email protected]>
@QiWang19
Copy link
Contributor Author

update man pages. Needs approved, lgtm labels

@mheon
Copy link
Member

mheon commented Nov 26, 2019

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon, QiWang19

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 26, 2019
@mheon
Copy link
Member

mheon commented Nov 26, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2019
@openshift-merge-robot openshift-merge-robot merged commit 27a09f8 into containers:master Nov 26, 2019
@QiWang19 QiWang19 deleted the prune_pod branch June 26, 2020 15:11
@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. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Containers should be pruned before pods
6 participants