moby/api/types
Cory Snider d222bf097c daemon: reload runtimes w/o breaking containers
The existing runtimes reload logic went to great lengths to replace the
directory containing runtime wrapper scripts as atomically as possible
within the limitations of the Linux filesystem ABI. Trouble is,
atomically swapping the wrapper scripts directory solves the wrong
problem! The runtime configuration is "locked in" when a container is
started, including the path to the runC binary. If a container is
started with a runtime which requires a daemon-managed wrapper script
and then the daemon is reloaded with a config which no longer requires
the wrapper script (i.e. some args -> no args, or the runtime is dropped
from the config), that container would become unmanageable. Any attempts
to stop, exec or otherwise perform lifecycle management operations on
the container are likely to fail due to the wrapper script no longer
existing at its original path.

Atomically swapping the wrapper scripts is also incompatible with the
read-copy-update paradigm for reloading configuration. A handler in the
daemon could retain a reference to the pre-reload configuration for an
indeterminate amount of time after the daemon configuration has been
reloaded and updated. It is possible for the daemon to attempt to start
a container using a deleted wrapper script if a request to run a
container races a reload.

Solve the problem of deleting referenced wrapper scripts by ensuring
that all wrapper scripts are *immutable* for the lifetime of the daemon
process. Any given runtime wrapper script must always exist with the
same contents, no matter how many times the daemon config is reloaded,
or what changes are made to the config. This is accomplished by using
everyone's favourite design pattern: content-addressable storage. Each
wrapper script file name is suffixed with the SHA-256 digest of its
contents to (probabilistically) guarantee immutability without needing
any concurrency control. Stale runtime wrapper scripts are only cleaned
up on the next daemon restart.

Split the derived runtimes configuration from the user-supplied
configuration to have a place to store derived state without mutating
the user-supplied configuration or exposing daemon internals in API
struct types. Hold the derived state and the user-supplied configuration
in a single struct value so that they can be updated as an atomic unit.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-06-01 14:45:25 -04:00
..
backend fixing consistent aliases for OCI spec imports 2023-05-08 15:27:52 +05:30
blkiodev Add canonical import comment 2018-02-05 16:51:57 -05:00
container remove pre-go1.17 build-tags 2023-05-19 20:38:51 +02:00
events api/types/events: add "Type" type for event-type enum 2021-08-23 21:14:55 +02:00
filters api/types/filters: Add GetBoolOrDefault 2023-01-26 16:28:49 +01:00
image fixing consistent aliases for OCI spec imports 2023-05-08 15:27:52 +05:30
mount Support recursively read-only (RRO) mounts 2023-05-26 01:58:24 +09:00
network api/types: remove errdefs dependency 2020-06-04 12:14:16 +02:00
plugins/logdriver update generated files 2023-05-29 03:28:35 +02:00
registry fixing consistent aliases for OCI spec imports 2023-05-08 15:27:52 +05:30
strslice api/types: fix empty-lines (revive) 2022-09-28 01:58:49 +02:00
swarm update generated files 2023-05-29 03:28:35 +02:00
time api/types/time: use strings.Cut() 2022-12-21 11:09:00 +01:00
versions api/types/versions: simplify compare if versions are equal 2021-08-22 11:05:22 +02:00
volume vendor: github.com/moby/swarmkit/v2 v2.0.0-20220721174824-48dd89375d0a 2022-08-09 14:03:50 +02:00
client.go api/types: move AuthConfig to registry types 2022-07-29 23:05:12 +02:00
configs.go fixing consistent aliases for OCI spec imports 2023-05-08 15:27:52 +05:30
error_response.go Update to inline comments. 2016-10-31 11:13:41 -04:00
error_response_ext.go Make ErrorResponse implement Error 2019-07-02 10:17:03 -07:00
graph_driver_data.go api: docs: update docs for /images/{name}/json (current API version) 2022-03-03 22:50:10 +01:00
id_response.go Add an IDResponse type 2016-10-31 11:16:02 -04:00
image_delete_response_item.go Generate ImageDeleteResponse from swagger spec. 2017-01-03 11:47:47 -05:00
image_summary.go API: omit deprecated VirtualSize field for API v1.44 and up 2023-05-06 16:35:00 +02:00
plugin.go Move plugin client creation to the extension point 2018-05-25 15:18:53 -04:00
plugin_device.go Generate plugin types from the swagger spec. 2016-10-20 13:24:23 -07:00
plugin_env.go Generate plugin types from the swagger spec. 2016-10-20 13:24:23 -07:00
plugin_interface_type.go Generate plugin types from the swagger spec. 2016-10-20 13:24:23 -07:00
plugin_mount.go Generate plugin types from the swagger spec. 2016-10-20 13:24:23 -07:00
plugin_responses.go Add canonical import comment 2018-02-05 16:51:57 -05:00
port.go Describe IP field of Port definition 2018-05-15 12:09:42 +02:00
service_update_response.go Return warnings from service create and service update when digest pinning fails 2016-11-18 09:31:31 -08:00
stats.go Fix dont typo 2018-09-08 16:58:03 +08:00
types.go daemon: reload runtimes w/o breaking containers 2023-06-01 14:45:25 -04:00