Skip to content

Commit 93bc484

Browse files
committed
feat(rootfs): add rootfs provider boundary with containerd-backed provider
Adds openshell-rootfs, the rootfs provider boundary for compute drivers: a provider resolves an OCI image reference into provider-neutral PreparedRootfs mounts keyed by a per-sandbox key, and owns image resolution, acquisition, unpacking, and the lifetime of the backend resources realizing the root filesystem. ContainerdRootfsProvider is the first implementation, backed by a system-provided containerd used only for image pull/unpack and snapshot management via its Transfer/Images/Content/Snapshots/Leases services. containerd concepts (snapshots, chain IDs, leases) are fully encapsulated: prepare() pulls, resolves the OCI chain ID, prepares a per-sandbox writable snapshot protected from containerd's GC by a lease, and cleans up after itself on failure; release() removes the snapshot and lease at teardown. Keeping the containerd daemon behind this boundary (rather than in a compute driver's own contract) leaves room to swap in a daemonless provider, or converge the VM driver's image acquisition pipeline onto the same types, without redesigning the sandbox provisioner on top. Related: #2255 Signed-off-by: Eric Curtin <eric.curtin@docker.com>
1 parent 8262e7b commit 93bc484

6 files changed

Lines changed: 751 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ These pipelines connect skills into end-to-end workflows. Individual skill files
4545
| `crates/openshell-driver-podman/` | Podman compute driver | In-process `ComputeDriver` backend for local Podman sandbox containers |
4646
| `crates/openshell-driver-vm/` | VM compute driver | Standalone libkrun-backed `ComputeDriver` subprocess (embeds its own rootfs + runtime) |
4747
| `crates/openshell-nft-ruleset/` | nftables rulesets | Shared per-sandbox NAT + default-deny nftables ruleset generation used by compute drivers |
48+
| `crates/openshell-rootfs/` | Rootfs providers | Rootfs provider boundary for compute drivers; containerd-backed provider for image pull/unpack and snapshots |
4849
| `crates/openshell-prover/` | Policy prover | Policy verification and proof generation |
4950
| `crates/openshell-server-macros/` | Server macros | Compile-time helpers for gateway RPC authorization |
5051
| `crates/openshell-supervisor-middleware/` | Middleware runtime | Generic middleware registry, remote service integration, and chain execution |

Cargo.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

architecture/compute-runtimes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,25 @@ The gateway records driver identity and version from the startup capability
3030
response. Elevated gateway info reports that initialized driver snapshot instead
3131
of re-querying drivers on each request.
3232

33+
## Rootfs Provisioning Boundary
34+
35+
Rootfs provisioning — resolving an OCI image reference into a root filesystem
36+
a sandbox can be launched from — is a provider concern, separate from sandbox
37+
provisioning (namespaces, cgroups, VM boot). `openshell-rootfs` defines that
38+
boundary: a provider produces provider-neutral `PreparedRootfs` mounts keyed
39+
by a per-sandbox key, and owns image resolution, acquisition, unpacking, and
40+
the lifetime of whatever backend resources realize the root filesystem.
41+
Backend concepts (containerd snapshots, leases, chain IDs) must stay behind
42+
the provider and out of the compute-driver contract, so a daemon-backed
43+
provider can be replaced by a daemonless one without redesigning the
44+
provisioner on top of it.
45+
46+
`ContainerdRootfsProvider` is the first implementation, backed by a
47+
system-provided containerd used only for image pull/unpack and snapshot
48+
management. The VM driver's image acquisition and ext4 materialization
49+
pipeline is the same boundary shape; converging it onto the shared types is
50+
tracked follow-up work.
51+
3352
## Runtime Summary
3453

3554
| Runtime | Best fit | Sandbox boundary | Notes |

crates/openshell-rootfs/Cargo.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
[package]
5+
name = "openshell-rootfs"
6+
description = "Rootfs provider boundary for OpenShell compute drivers, with a containerd-backed provider"
7+
version.workspace = true
8+
edition.workspace = true
9+
rust-version.workspace = true
10+
license.workspace = true
11+
repository.workspace = true
12+
13+
[lib]
14+
name = "openshell_rootfs"
15+
path = "src/lib.rs"
16+
17+
[dependencies]
18+
# containerd's own generated gRPC client. This is the "system-provided
19+
# containerd" integration point behind `ContainerdRootfsProvider`, used
20+
# only for image pull/unpack and snapshot management -- never bundled,
21+
# installed, or managed by OpenShell. containerd's container/task
22+
# services and shim are never used; consumers of a prepared rootfs (the
23+
# OCI compute driver) spawn the low-level OCI runtime themselves.
24+
containerd-client = "0.9"
25+
26+
futures = { workspace = true }
27+
serde_json = { workspace = true }
28+
sha2 = "0.10"
29+
thiserror = { workspace = true }
30+
tonic = { workspace = true, features = ["transport"] }
31+
32+
[lints]
33+
workspace = true

0 commit comments

Comments
 (0)