Commit 7a55505
committed
fix(driver-native): spawn the low-level runtime directly instead of via containerd
Corrects an architectural mistake from the previous commit: containerd's
Containers/Tasks services (and therefore containerd's own
io.containerd.runc.v2 shim) were spawning runc/crun, not OpenShell. This
put containerd in the process-supervision path for the sandbox's root
process, which is not what "OpenShell drives the runtime, containerd is
just used elsewhere" was supposed to mean.
This driver -- not containerd -- now spawns the configured low-level OCI
runtime (runc by default, crun, or any other OCI-runtime-spec-compatible
binary) directly:
- New runtime.rs builds a standard OCI bundle (config.json + a mounted
rootfs/) from the snapshot containerd prepared, and drives it through
the runtime's own create/start/state/kill/delete CLI contract via
std::process::Command -- the same integration pattern containerd's
shim, CRI-O, and Podman use, just invoked by this driver's process
instead of containerd's.
- Removed runc_options.rs entirely: it existed only to wrap
runtime_binary as a containerd.runc.v1.Options message for containerd's
shim to read. With the shim no longer in the picture, selecting runc vs.
crun is now simply which binary this driver execs.
- containerd is now used only for image pull/unpack (Transfer/Images/
Content) and snapshot management (Snapshots.Prepare) -- image.rs no
longer creates a containerd Container or Task at all.
- Because no containerd Container/Task references the prepared snapshot
anymore, it has nothing protecting it from containerd's background GC.
Verified this is a real problem (an otherwise-identical run without
protection failed at teardown with "snapshot ... does not exist"
because GC had already reaped it) and fixed it with containerd's Leases
service: image.rs now creates a lease per sandbox and attaches the
snapshot to it, deleting the lease at teardown.
- Sandbox tracking (get/list) no longer queries containerd (there is
nothing left to query); it scans this driver's own state directory for
bundle directories, the same pattern the VM driver uses to rediscover
sandboxes on restart, and calls `runtime state` directly for status.
Re-verified end to end against a real containerd 2.x + runc/crun install:
pull -> chain-ID resolve -> lease-protected snapshot prepare -> bundle
mount -> create/start/state/delete directly against both runc and crun
(new second integration test) -> stop -> delete, plus confirming a
snapshot without a lease is reaped by GC while one with a lease survives.
The full openshell-gateway binary was also re-run with --drivers native
against live containerd to confirm the wiring still works.
Docs, the driver README, and inline comments are updated to describe the
corrected division of labor between this driver and containerd.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>1 parent 653842b commit 7a55505
15 files changed
Lines changed: 675 additions & 425 deletions
File tree
- architecture
- crates/openshell-driver-native
- src
- tests
- docs/reference
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
13 | 20 | | |
14 | 21 | | |
15 | 22 | | |
| |||
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
22 | | - | |
23 | | - | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
| |||
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| 44 | + | |
37 | 45 | | |
38 | | - | |
| 46 | + | |
| 47 | + | |
39 | 48 | | |
40 | 49 | | |
| 50 | + | |
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
| |||
94 | 104 | | |
95 | 105 | | |
96 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
97 | 128 | | |
98 | 129 | | |
99 | 130 | | |
100 | 131 | | |
101 | 132 | | |
102 | | - | |
103 | | - | |
| 133 | + | |
| 134 | + | |
104 | 135 | | |
105 | 136 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
88 | | - | |
89 | | - | |
| 90 | + | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
0 commit comments