Repository navigation
Commit 5fa410c
committed
feat(driver-native): add containerd-backed native compute driver
Adds openshell-driver-native, a fifth compute driver that constructs
sandboxes from Linux kernel primitives (namespaces, cgroups v2) on top
of a system-provided containerd, without a container engine daemon, a
hypervisor, or a bundled low-level runtime.
This implements two amendments to the originally filed issue NVIDIA#2255
proposal, agreed with the issue author outside the issue thread:
- The low-level OCI runtime is never bundled. It is configurable
(default `runc`, override to `crun` or any other OCI-runtime-spec
binary already installed on the host).
- **This driver -- not containerd -- spawns the low-level runtime.**
containerd is used only for image pull/unpack and snapshot
management (Transfer/Images/Content/Snapshots services); it never
creates a containerd Container or Task object, and its
io.containerd.runc.v2 shim is never involved. The driver builds a
standard OCI bundle (config.json + a mounted rootfs/) from the
snapshot containerd prepared and drives the configured runtime
directly through its own create/start/state/kill/delete CLI
contract -- the same integration pattern containerd's shim, CRI-O,
and Podman use, just invoked by this driver's process instead of
containerd's.
Key pieces:
- openshell-driver-native: image pull + chain-ID resolution + snapshot
management against containerd, protected from containerd's
background GC via a lease per sandbox since no Container/Task
references it (image.rs); OCI runtime-spec generation from OpenShell
policy (spec.rs); direct create/start/state/kill/delete invocation
of the configured low-level runtime as a child process, with its own
bundle-directory bookkeeping used to track which sandboxes exist
instead of querying containerd (runtime.rs); per-sandbox network
namespace + veth + nftables networking (network.rs); GPU kernel
device-node passthrough (gpu.rs); and the ComputeDriver gRPC service
(driver.rs/grpc.rs), running in-process in the gateway like the
Docker/Podman/Kubernetes drivers.
- openshell-nft-ruleset: the VM driver's nftables ruleset generator
extracted into a shared crate (table-prefix-parameterized) so the
native driver reuses the same NAT + default-deny shape without a
behavior change to the VM driver's existing tables.
- ComputeDriverKind::Native wired through openshell-core config,
telemetry, and every openshell-server compute-driver selection path
(driver_config.rs, compute/mod.rs, lib.rs, cli.rs, config_file.rs).
Verified end to end against a real containerd 2.x + runc/crun install
during development: pull -> chain-ID resolve -> lease-protected
snapshot prepare -> bundle mount -> create/start/state/delete directly
against both runc and crun -> stop -> delete (see
tests/containerd_integration.rs, #[ignore]d by default since CI has no
containerd), plus confirming a snapshot without a lease is reaped by
containerd's GC while one with a lease survives, and that the full
openshell-gateway binary connects and selects this driver correctly.
Known gaps, documented in the driver README and user-facing docs:
rootless mode (Linux user namespace) is implemented but not yet
functional (containerd's prepared snapshot isn't remapped to match, so
it defaults off); the supervisor binary is bind-mounted from a host
path rather than sourced from an image like the other drivers; GPU
support is kernel-device-node passthrough only, not full CDI
injection; WatchSandboxes polls rather than subscribing to
containerd's event stream.
Related: NVIDIA#2255
Signed-off-by: Eric Curtin <[email protected]>1 parent 8029321 commit 5fa410c
30 files changed
Lines changed: 4104 additions & 65 deletions
File tree
- architecture
- crates
- openshell-core/src
- openshell-driver-native
- src
- tests
- openshell-driver-vm
- src
- openshell-nft-ruleset
- src
- openshell-server
- src
- compute
- docs/reference
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| 143 | + | |
141 | 144 | | |
142 | | - | |
| 145 | + | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
| |||
990 | 993 | | |
991 | 994 | | |
992 | 995 | | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
993 | 1000 | | |
994 | 1001 | | |
995 | 1002 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| |||
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
| 188 | + | |
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
| |||
194 | 197 | | |
195 | 198 | | |
196 | 199 | | |
| 200 | + | |
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments