-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Running a pod on OSX leaves infra container running forever #13464
Comments
OSX has nothing to do with it. And fwiw, this is normal pod behavior. I don't recall offhand that it is possible to do what you are asking; though it is getting late in the day and maybe someone will remember something. |
We have talked a while about instrumenting what should happen in a Pod when containers exit. 1 Pod exits I think we should add a feature to Pod/Containers for them to specify this. |
captured in RUN-1458 |
We need such kind of behavior to make It's probably also a better experience using a single pod in a systemd unit (from podman-generate-systemd). |
yeah I can easily add a flag that changes this behavior |
I would like a default for pod creation, how to handle containers. I don't know what the option shouldbe called. --cfinish=[exit | ignore| restart] |
I don't understand why we would keep a Pod running when all containers exited. If users make heavy use of pods, they will have a lot of processes running that don't do much more than creating (a small amount of) heat. I see an argument for keeping it running if no containers have been added yet though. But if we added a flag, I'd prefer calling it |
Let's discuss at Cabal. |
@rhatdan what was our decision on this one? I can implement this. |
The decision was to do the following. When a container exits, podman container cleanup is executed. This program needs to be changed to check if the container is running within a Pod, if so, and the pod has no other containers running, it should stop the pod. If there are other containers running, then it should just exit. A Pod with no containers should continue to run, which it will. We need to make sure that a container start with a restart policy works correctly when run within a Pod. @cdoern and @dav009 you are both welcome to work on this. (I was planning on looking at it next, but I don't have the time now.) |
I need this behavior for enabling |
@vrothberg I am working on it but hit a snag so feel free to open a PR. I will follow up with a comment containing the code I have so far |
Apologies, Charlie! I didn't know you were already on it. |
No worries, do you want to continue with it? I haven't gotten too far. |
If you're cool, I can continue. I think I am close to completion but it is tricky ... dead locks lie behind each and every corner. |
Sounds good @vrothberg I was running into a bunch of deadlocks too! |
Add the notion of an "exit policy" to a pod. This policy controls the behaviour when the last container of pod exits. Initially, there are two policies: - "continue" : the pod continues running. This is the default policy when creating a pod. - "stop" : stop the pod when the last container exits. This is the default behaviour for `play kube`. In order to implement the deferred stop of a pod, add a worker queue to the libpod runtime. The queue will pick up work items and in this case helps resolve dead locks that would otherwise occur if we attempted to stop a pod during container cleanup. Note that the default restart policy of `play kube` is "Always". Hence, in order to really solve containers#13464, the YAML files must set a custom restart policy; the tests use "OnFailure". Fixes: containers#13464 Signed-off-by: Valentin Rothberg <[email protected]>
I am running a pod via play kube. My container exits, but the companion infra container keeps running forever, meaning that the whole pod keeps running forever
Is there a way to make infra container exit once pod's containers exit?
I am running on OSX
The text was updated successfully, but these errors were encountered: