spiegel_podman/libpod
Matthew Heon 484bd0af1d Ensure pod infra containers have an exit command
Most Libpod containers are made via `pkg/specgen/generate` which
includes code to generate an appropriate exit command which will
handle unmounting the container's storage, cleaning up the
container's network, etc. There is one notable exception: pod
infra containers, which are made entirely within Libpod and do
not touch pkg/specgen. As such, no cleanup process, network never
cleaned up, bad things can happen.

There is good news, though - it's not that difficult to add this,
and it's done in this PR. Generally speaking, we don't allow
passing options directly to the infra container at create time,
but we do (optionally) proxy a pre-approved set of options into
it when we create it. Add ExitCommand to these options, and set
it at time of pod creation using the same code we use to generate
exit commands for normal containers.

Fixes #7103

Signed-off-by: Matthew Heon <mheon@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-08-24 11:31:37 -04:00
..
common Set blob cache directory based on GraphDriver 2019-03-29 08:27:33 -04:00
define error when adding container to pod with network information 2020-08-24 11:31:37 -04:00
driver removMergeDir from inspect result if not mounted 2019-08-13 15:13:20 -04:00
events add event for image build 2020-08-20 12:16:52 -04:00
filters move go module to v2 2020-07-06 15:52:17 +02:00
image image list: speed up 2020-08-11 11:14:24 +02:00
layers Initial checkin from CRI-O repo 2017-11-01 11:24:59 -04:00
linkmode Add podman static build 2020-05-11 13:11:07 +02:00
lock move go module to v2 2020-07-06 15:52:17 +02:00
logs fix podman logs --tail when log is bigger than pagesize 2020-08-11 11:14:56 +02:00
boltdb_state.go Unconditionally retrieve pod names via API 2020-08-20 12:16:53 -04:00
boltdb_state_internal.go move go module to v2 2020-07-06 15:52:17 +02:00
boltdb_state_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
boltdb_state_unsupported.go podman-remote inspect 2019-01-18 15:43:11 -06:00
common_test.go move go module to v2 2020-07-06 15:52:17 +02:00
container.go Ensure WORKDIR from images is created 2020-08-20 12:16:53 -04:00
container_api.go vendor c/image v5.5.2 2020-08-20 10:12:27 +02:00
container_commit.go move go module to v2 2020-07-06 15:52:17 +02:00
container_exec.go Ensure that exec errors write exit codes to the DB 2020-08-11 11:15:38 +02:00
container_graph.go move go module to v2 2020-07-06 15:52:17 +02:00
container_graph_test.go move go module to v2 2020-07-06 15:52:17 +02:00
container_inspect.go Add SystemdMode to inspect for containers 2020-07-22 14:31:26 -04:00
container_internal.go volumes: do not recurse when chowning 2020-07-31 11:45:58 -04:00
container_internal_linux.go Ensure WORKDIR from images is created 2020-08-20 12:16:53 -04:00
container_internal_linux_test.go Add username to /etc/passwd inside of container if --userns keep-id 2020-08-11 14:58:29 +02:00
container_internal_test.go vendor: update seccomp/containers-golang to v0.4.1 2020-05-21 16:16:09 +02:00
container_internal_unsupported.go Remove all instances of named return "err" from Libpod 2020-07-22 14:47:03 -04:00
container_linux.go Do not fetch pod and ctr State on retrieval in Bolt 2018-07-31 14:19:50 +00:00
container_log.go log API: add context to allow for cancelling 2020-07-22 14:50:47 -04:00
container_log_linux.go log API: add context to allow for cancelling 2020-07-22 14:50:47 -04:00
container_log_unsupported.go log API: add context to allow for cancelling 2020-07-22 14:50:47 -04:00
container_top_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
container_top_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
container_unsupported.go Do not fetch pod and ctr State on retrieval in Bolt 2018-07-31 14:19:50 +00:00
container_validate.go move go module to v2 2020-07-06 15:52:17 +02:00
diff.go move go module to v2 2020-07-06 15:52:17 +02:00
events.go fix race condition in libpod.GetEvents(...) 2020-07-07 17:29:14 +02:00
healthcheck.go move go module to v2 2020-07-06 15:52:17 +02:00
healthcheck_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
healthcheck_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
in_memory_state.go Unconditionally retrieve pod names via API 2020-08-20 12:16:53 -04:00
info.go move go module to v2 2020-07-06 15:52:17 +02:00
kube.go move go module to v2 2020-07-06 15:52:17 +02:00
mounts_linux.go set root propagation based on volume properties 2018-11-26 13:55:02 +01:00
networking_linux.go Remove all instances of named return "err" from Libpod 2020-07-22 14:47:03 -04:00
networking_unsupported.go Remove all instances of named return "err" from Libpod 2020-07-22 14:47:03 -04:00
oci.go move go module to v2 2020-07-06 15:52:17 +02:00
oci_attach_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
oci_attach_linux_cgo.go Implement conmon exec 2019-07-22 15:57:23 -04:00
oci_attach_linux_nocgo.go Implement conmon exec 2019-07-22 15:57:23 -04:00
oci_attach_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
oci_conmon_exec_linux.go Fix close fds of exec --preserve-fds 2020-08-11 13:53:23 +02:00
oci_conmon_linux.go Remove all instances of named return "err" from Libpod 2020-07-22 14:47:03 -04:00
oci_conmon_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
oci_missing.go move go module to v2 2020-07-06 15:52:17 +02:00
oci_util.go move go module to v2 2020-07-06 15:52:17 +02:00
options.go Ensure pod infra containers have an exit command 2020-08-24 11:31:37 -04:00
pod.go Ensure pod infra containers have an exit command 2020-08-24 11:31:37 -04:00
pod_api.go Fix lint 2020-07-22 14:20:14 -04:00
pod_internal.go move go module to v2 2020-07-06 15:52:17 +02:00
pod_status.go move go module to v2 2020-07-06 15:52:17 +02:00
pod_top_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
pod_top_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
reset.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime.go Unconditionally retrieve pod names via API 2020-08-20 12:16:53 -04:00
runtime_cstorage.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_ctr.go Remove all instances of named return "err" from Libpod 2020-07-22 14:47:03 -04:00
runtime_img.go Unmount c/storage containers before removing them 2020-08-20 12:18:22 -04:00
runtime_img_test.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_migrate.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_migrate_unsupported.go Add podman system reset command 2019-11-29 05:34:52 -05:00
runtime_pod.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_pod_infra_linux.go Ensure pod infra containers have an exit command 2020-08-24 11:31:37 -04:00
runtime_pod_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_pod_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_renumber.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_volume.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_volume_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
runtime_volume_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
state.go Unconditionally retrieve pod names via API 2020-08-20 12:16:53 -04:00
state_test.go Remove all instances of named return "err" from Libpod 2020-07-22 14:47:03 -04:00
stats.go move go module to v2 2020-07-06 15:52:17 +02:00
stats_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
storage.go Remove all instances of named return "err" from Libpod 2020-07-22 14:47:03 -04:00
util.go Include infra container information in pod inspect 2020-07-22 14:19:50 -04:00
util_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
util_test.go move go module to v2 2020-07-06 15:52:17 +02:00
util_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00
volume.go container: move volume chown after spec generation 2020-07-06 13:31:21 -04:00
volume_inspect.go container: move volume chown after spec generation 2020-07-06 13:31:21 -04:00
volume_internal.go move go module to v2 2020-07-06 15:52:17 +02:00
volume_internal_linux.go move go module to v2 2020-07-06 15:52:17 +02:00
volume_internal_unsupported.go move go module to v2 2020-07-06 15:52:17 +02:00