play kube: Add --wait option

Add a way to keep play kube running in the foreground and terminating all pods
after receiving a a SIGINT or SIGTERM signal. The pods will also be
cleaned up after the containers in it have exited.
If an error occurrs during kube play, any resources created till the
error point will be cleane up also.

Add tests for the various scenarios.

Fixes #14522

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
Urvashi Mohnani
2023-01-11 10:08:06 +05:30
parent db53f38711
commit 20a42d0e4f
13 changed files with 244 additions and 62 deletions

View File

@ -205,6 +205,18 @@ Start the pod after creating it, set to false to only create it.
@@option userns.container
#### **--wait**, **-w**
Run pods and containers in the foreground. Default is false.
At any time you can run `podman pod ps` in the other shell to view a list of
the running pods and containers.
When attached in the tty mode, you can kill the pods and containers by pressing
Ctrl-C or receiving any other interrupt signals.
Volumes created with `podman kube play` will be removed when `--wait=true`.
## EXAMPLES
Recreate the pod and containers as described in a file called `demo.yml`