Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ The driver's `OPENSHELL_VM_DEFAULT_WORKDIR` (default `/sandbox`) sets the workin
sandboxes whose image has none ([Image ENV and WORKDIR](#image-env-and-workdir)).
The driver's `OPENSHELL_VM_SUPERVISOR_IDENTITY*` options (optional, off by default) are in
[Supervisor identity](#supervisor-identity).
The driver's `OPENSHELL_VM_SHARED_SUPERVISOR` (default `false`) runs one host supervisor for
every sandbox; see [Shared supervisor](#shared-supervisor).
The driver's `OPENSHELL_VM_MAX_VCPUS` and `OPENSHELL_VM_MAX_MEM_MIB` limit what a sandbox can request
with `--cpu` and `--memory`, and `OPENSHELL_VM_MAX_OVERLAY_DISK_MIB`, `OPENSHELL_VM_FILES_ROOT` and
`OPENSHELL_VM_FILES_MAX_BYTES` what it can request in its `driver_config`; see
Expand Down Expand Up @@ -733,13 +735,56 @@ Limits:
- This is not SPIRE. There is one trust domain, no federation, no X.509 SVIDs, and the
attestation knows only the supervisor processes this driver started.

## Shared supervisor

By default every sandbox gets its own host supervisor process, as upstream. Set
`OPENSHELL_VM_SHARED_SUPERVISOR=true` in the driver's environment to run one supervisor for
every sandbox on the host instead. This saves one supervisor's memory per sandbox. It is
experimental and off by default.

The gateway needs no change: it sees the same per-sandbox supervisor sessions as with dedicated
supervisors. OpenShell's own shared supervisor topology is Kubernetes-only, because the gateway
hands out sandboxes only to an in-process driver. So here the driver does that part itself:

- On the first launch, the driver starts `openshell-supervisor --mode=shared` and serves the
supervisor's private assignment stream on a Unix socket in its private socket directory. It
accepts only its own uid and a token it mints and renews in a file. The supervisor dials the
gateway itself for every sandbox session, with the gateway's CA (`guest_tls_ca`) when the
gateway uses TLS.
- Each launch hands the supervisor that generation's launch credentials (the ones a dedicated
supervisor receives). The supervisor listens on the VM's control socket while it hosts the
sandbox, as a dedicated supervisor does, so the guest side is unchanged.
- Stopping a sandbox asks the supervisor to stop it and waits until the supervisor lets go of
it, which removes the control socket, or until the usual shutdown grace runs out. Then it
stops the VM.

This needs a supervisor that can dial a `unix:` assignment endpoint and serve a sandbox on its
own socket. Those changes are not upstream yet (fork branch
`feat/shared-host-unix/mr-miles`). Without them every launch with the shared supervisor
fails, so leave it off unless the pinned OpenShell revision includes them.

Limits:

- **No failover.** Moving a running sandbox to another supervisor needs a takeover grant signed
by the gateway. If the shared supervisor exits, every VM it supervised fails with
`ProcessExited`, as one would whose dedicated supervisor exited. The driver starts a new
supervisor for later launches.
- At most 256 sandboxes per driver.
- It cannot be combined with supervisor identity (`OPENSHELL_VM_SUPERVISOR_IDENTITY`), the
network supervisor additional CA, or an upstream proxy. The driver refuses to start with
any of them.
- Agent traces are not relayed: the upstream shared supervisor has no per-sandbox collector yet.
- Its logs and token are under `<state dir>/shared-supervisor/`: `supervisor.log`,
`supervisor.err.log` and `token`.

## What does not work

- No virtiofs bind mounts and no GPU passthrough on Firecracker. A sandbox that asks for
either is rejected at validation, not ignored. To get host files into a guest, use
[`driver_config.files`](#per-sandbox-cpu-memory-disk-size-and-files), which copies them in.
- `[openshell.supervisor.network].additional_ca_bundle` and the shared supervisor pool
are rejected by the gateway for any external driver.
- `[openshell.supervisor.network].additional_ca_bundle` and the gateway's shared supervisor
pool are rejected by the gateway for any external driver. The driver has its own
[shared supervisor](#shared-supervisor).
- Rootfs tar uploads need the driver and gateway on the same filesystem and UID.
- `openshell-gateway config preflight` skips host-tool checks for an external driver;
`openshell-firecracker-launcher check` covers the Firecracker ones.
Expand Down
31 changes: 25 additions & 6 deletions vendor/openshell/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/openshell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ repository = "https://github.com/NVIDIA/OpenShell"
openshell-core = { git = "https://github.com/NVIDIA/OpenShell", rev = "f16795bc76b13fcc35d8b0d2b49cfc788c701ef9", default-features = false }
openshell-isolation-interface = { git = "https://github.com/NVIDIA/OpenShell", rev = "f16795bc76b13fcc35d8b0d2b49cfc788c701ef9" }
openshell-sandbox-backend = { git = "https://github.com/NVIDIA/OpenShell", rev = "f16795bc76b13fcc35d8b0d2b49cfc788c701ef9" }
openshell-supervisor-control = { git = "https://github.com/NVIDIA/OpenShell", rev = "f16795bc76b13fcc35d8b0d2b49cfc788c701ef9" }
openshell-otel = { git = "https://github.com/NVIDIA/OpenShell", rev = "f16795bc76b13fcc35d8b0d2b49cfc788c701ef9" }
openshell-otel-test-support = { git = "https://github.com/NVIDIA/OpenShell", rev = "f16795bc76b13fcc35d8b0d2b49cfc788c701ef9" }
openshell-spiffe = { git = "https://github.com/NVIDIA/OpenShell", rev = "f16795bc76b13fcc35d8b0d2b49cfc788c701ef9" }
Expand Down
5 changes: 5 additions & 0 deletions vendor/openshell/crates/openshell-driver-vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ openshell-core = { workspace = true, features = ["clap"] }
openshell-isolation-interface = { workspace = true }
openshell-sandbox-backend = { workspace = true }
openshell-otel = { workspace = true, optional = true }
openshell-supervisor-control = { workspace = true, optional = true }

base64 = { workspace = true, optional = true }
bollard = { version = "0.20", features = ["ssh"], optional = true }
Expand Down Expand Up @@ -62,6 +63,8 @@ zstd = { version = "0.14", optional = true }
aws-lc-rs = { workspace = true, optional = true }
axum = { version = "0.8", default-features = false, features = ["http1", "tokio"], optional = true }
tonic-prost = { workspace = true, optional = true }
# Shared host supervisor (not in upstream): per-sandbox proxy CA material.
rcgen = { workspace = true, optional = true }

[features]
# Portable test instrumentation, independent of the compute runtime.
Expand Down Expand Up @@ -100,6 +103,8 @@ compute-driver = [
"dep:axum",
"dep:tonic-prost",
"dep:tonic-build",
"dep:openshell-supervisor-control",
"dep:rcgen",
]
## Compile in telemetry support (forwards to openshell-core/telemetry). On by
## default; build with `--no-default-features` for a telemetry-free VM driver
Expand Down
9 changes: 9 additions & 0 deletions vendor/openshell/crates/openshell-driver-vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ Changes from upstream:
that attested process. It serves OIDC discovery and JWKS endpoints over HTTP. The server
stub is generated in `build.rs` without `protoc`. See `src/supervisor_identity/` and
"Supervisor identity" in the repository README.
- **Shared supervisor** (off by default, `OPENSHELL_VM_SHARED_SUPERVISOR`). One
`openshell-supervisor --mode=shared` process for every sandbox instead of one each. The
driver serves the supervisor's private `openshell.supervisor.host.v1` assignment stream
itself, on a private Unix socket with a driver-minted token, using
`openshell-supervisor-control`'s controller as a one-member pool. Each generation keeps the
dedicated runtime-initiated Unix control socket, which the shared supervisor listens on
while it hosts the sandbox, so the guest side is unchanged. Needs the fork's supervisor
changes (`feat/shared-host-unix/mr-miles`). See `src/shared_supervisor.rs` and "Shared
supervisor" in the repository README.
- **CPU and memory limits.** Upstream ignores a template's `cpu_limit` and `memory_limit`
(`sandbox create --cpu / --memory`) and reports both limits unsupported. Here they set the
VM's vCPUs (whole CPUs only, up to `OPENSHELL_VM_MAX_VCPUS`, at most 32) and memory (256 MiB
Expand Down
Loading