Skip to content

Commit 2de7d99

Browse files
committed
docs: describe launched compute drivers
Document how the gateway finds, trusts, starts, and validates the VM and Podman driver binaries, including probe and preflight, and note that guest_tls_ca belongs at gateway scope. Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 49b7d37 commit 2de7d99

5 files changed

Lines changed: 62 additions & 5 deletions

File tree

‎crates/openshell-driver-podman/README.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,24 @@ When `[openshell.gateway.otlp.agent]` is enabled, the driver sets
164164
`OPENSHELL_OTLP_AGENT_PROTOCOL` for a non-gRPC collector, which starts the
165165
agent trace relay. On Podman Machine it rewrites a loopback agent endpoint to
166166
the desktop host, as it does for the supervisor's trace endpoint.
167+
168+
## Launch by the gateway
169+
170+
The gateway runs this driver as a separate process and does not link it. It
171+
starts `openshell-driver-podman --config <startup.toml>`; the document carries
172+
the gateway's resolved values and the operator's `[openshell.drivers.podman]`
173+
table, which the driver deserializes and validates before it binds its socket.
174+
With `--config`, any other flag is an error. The driver ignores
175+
`expected_peer_pid` and accepts any connection from its own user, on a socket
176+
in a private directory.
177+
178+
Two subcommands take part in gateway decisions and start nothing:
179+
180+
- `openshell-driver-podman probe` prints `{"available": bool, "reason": "..."}`.
181+
Gateway auto-detection runs it.
182+
- `openshell-driver-podman preflight --config <path>` validates a startup
183+
document and prints `{"ok": bool, "error": "..."}`. `openshell-gateway config
184+
preflight` runs it.
185+
186+
The binary must be installed beside the gateway or in a libexec directory. See
187+
[Launched Compute Drivers](../../docs/how-it-works/gateways/configuration.mdx#launched-compute-drivers).

‎crates/openshell-driver-sdk/README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,13 @@ populated in it. Machine-checked breaking-change detection is not in place yet.
3838
- `gateway_port` lets a driver derive the endpoint sandboxes use to reach the
3939
gateway.
4040
- Proxy credentials are referenced by file path, not included.
41+
42+
## Subcommands
43+
44+
`probe` and `preflight` print one bounded JSON object on stdout; the result
45+
types are in `probe` and `preflight`. `probe` reports whether the driver is
46+
usable on this host, takes no startup document, and the gateway gives it five
47+
seconds and 4 KiB. `preflight --config <path>` validates a startup document
48+
without starting the driver and gets ten seconds and 16 KiB. The gateway treats
49+
a failure, a timeout, or oversized output as "not available" or a failed
50+
preflight.

‎crates/openshell-driver-vm/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Select the VM driver with `--compute-driver vm`, `OPENSHELL_COMPUTE_DRIVER=vm`,
174174
| `mem_mib` | `2048` | Memory per sandbox, in MiB. |
175175
| `overlay_disk_mib` | `4096` | Sparse writable overlay disk size per sandbox, in MiB. |
176176
| `krun_log_level` | `1` | libkrun verbosity (0-5). |
177-
| `guest_tls_ca` | unset | Historical key name for the host supervisor's gateway CA certificate. Required when `grpc_endpoint` uses `https://`; never copied into the guest. |
177+
| `guest_tls_ca` | rejected | Not accepted in this table. Set `guest_tls_ca` under `[openshell.gateway]`; the gateway passes it to the driver, which uses it as the host supervisor's gateway CA certificate when the endpoint is `https://`. It is never copied into the guest. |
178178
| `https_proxy` | unset | Corporate forward proxy (`http://host:port` or `https://host:port`) that host control chains policy-approved TLS CONNECT egress through. Host-loopback proxy URLs work because control runs on the gateway host. |
179179
| `no_proxy` | unset | Comma-separated bypass list for the corporate proxy only. OpenShell policy evaluation still applies. |
180180
| `proxy_auth_file` | unset | Gateway-host path to a validated `user:pass` credential file. Staged root-only into the per-sandbox overlay and removed with the sandbox; credentials never enter logs or process arguments. |
@@ -339,5 +339,5 @@ so driver choice remains automatic unless the user explicitly overrides it.
339339
340340
## TODOs
341341
342-
- The gateway still configures the driver via CLI args; this will move to a gRPC bootstrap call so the driver interface is uniform across backends. See the `TODO(driver-abstraction)` note in `crates/openshell-gateway/src/vm.rs`.
342+
- The gateway configures the driver with a startup document passed as `--config <path>`; see `crates/openshell-driver-sdk`. The driver validates its own `[openshell.drivers.vm]` table. `openshell-driver-vm preflight --config <path>` validates a document without starting the driver.
343343
- macOS local builds are codesigned by `tasks/scripts/gateway-vm.sh`; the generated Homebrew formula signs the release tarball driver for local installs.

‎docs/extensibility/drivers.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ external compute driver communicates with the gateway over a Unix domain
1919
socket and negotiates its protocol version and capabilities before serving
2020
requests.
2121

22+
The gateway launches the VM and Podman drivers as separate processes. Refer to
23+
[Launched Compute Drivers](/how-it-works/gateways/configuration#launched-compute-drivers)
24+
for how it finds, starts, and validates them.
25+
2226
For built-in driver configuration and behavior, refer to
2327
[Runtimes](/how-it-works/sandboxes/runtimes). For implementation details, refer
2428
to each driver crate:

‎docs/how-it-works/gateways/configuration.mdx‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ Each enabled signal needs an endpoint, either in its own table or from `endpoint
961961

962962
`protocol` selects the transport to a collector: `grpc`, the default, or `http/protobuf`. With `http/protobuf`, the endpoint is a base URL and each signal is posted to its path under it, `/v1/traces`, `/v1/logs`, or `/v1/metrics`, as with `OTEL_EXPORTER_OTLP_ENDPOINT`. HTTP/JSON is not supported. Point a `grpc` endpoint at a collector's gRPC receiver, conventionally port `4317`, and an `http/protobuf` endpoint at its HTTP receiver, conventionally port `4318`. A URI alone cannot distinguish the two, so a mismatched endpoint is accepted at startup and then fails on export. Sandbox supervisors and standalone compute drivers must come from the same release as the gateway to use `http/protobuf`: an older supervisor exports over gRPC, and an older driver rejects the protocol setting.
963963

964-
`headers` sets request headers sent with every export to a collector, as gRPC metadata or HTTP headers, such as an authorization token or a backend's routing header. Each name must be a valid HTTP header name set once, ignoring case; names the exporters set themselves, such as `content-type`, `host`, and `grpc-*`, and binary gRPC names ending in `-bin` are rejected. Each value must be non-empty printable ASCII; spaces are allowed. The gateway's exporters also read their signal's `OTEL_EXPORTER_OTLP_TRACES_HEADERS`, `OTEL_EXPORTER_OTLP_LOGS_HEADERS`, or `OTEL_EXPORTER_OTLP_METRICS_HEADERS`, or else `OTEL_EXPORTER_OTLP_HEADERS`, and a header set there replaces a configured header of the same name. In-process compute drivers and the VM driver send the gateway's trace headers, including those from the environment, with their own spans. A standalone compute driver sends only the headers in its own `OTEL_EXPORTER_OTLP_*HEADERS` variables. Supervisors send their trace collector's `headers` with their own spans, and the gateway's OCSF headers, including those from the environment, with their OCSF records. Trace headers from the gateway's environment do not reach supervisors, so set `headers` or `headers_file` on the trace collector when supervisor spans need them. The agent trace relay sends only its collector's `headers`, never ones from the environment, so its credentials can only be set with `headers` or `headers_file`. A changed header takes effect when the gateway restarts, and reaches a running sandbox only after that sandbox restarts.
964+
`headers` sets request headers sent with every export to a collector, as gRPC metadata or HTTP headers, such as an authorization token or a backend's routing header. Each name must be a valid HTTP header name set once, ignoring case; names the exporters set themselves, such as `content-type`, `host`, and `grpc-*`, and binary gRPC names ending in `-bin` are rejected. Each value must be non-empty printable ASCII; spaces are allowed. The gateway's exporters also read their signal's `OTEL_EXPORTER_OTLP_TRACES_HEADERS`, `OTEL_EXPORTER_OTLP_LOGS_HEADERS`, or `OTEL_EXPORTER_OTLP_METRICS_HEADERS`, or else `OTEL_EXPORTER_OTLP_HEADERS`, and a header set there replaces a configured header of the same name. In-process compute drivers and launched compute drivers (VM and Podman) send the gateway's trace headers, including those from the environment, with their own spans. A standalone compute driver sends only the headers in its own `OTEL_EXPORTER_OTLP_*HEADERS` variables. Supervisors send their trace collector's `headers` with their own spans, and the gateway's OCSF headers, including those from the environment, with their OCSF records. Trace headers from the gateway's environment do not reach supervisors, so set `headers` or `headers_file` on the trace collector when supervisor spans need them. The agent trace relay sends only its collector's `headers`, never ones from the environment, so its credentials can only be set with `headers` or `headers_file`. A changed header takes effect when the gateway restarts, and reaches a running sandbox only after that sandbox restarts.
965965

966966
Put credentials in `headers_file` rather than `headers`. It reads a collector's headers from a file instead, such as a mounted Kubernetes Secret, so credentials stay out of the configuration file. The file holds one `name=value` header per line. Blank lines are skipped, and whitespace around each name and value is trimmed. The headers are validated like `headers`, the file must be UTF-8 and at most 64 KiB, and setting both `headers` and `headers_file` in one table is a configuration error. A relative path uses the gateway's working directory. The gateway reads the file at startup and fails to start if it is missing or invalid, so a changed file takes effect as a changed header does.
967967

@@ -1066,7 +1066,7 @@ gateway under the worktree-specific k3d cluster name; select it with
10661066
tasks export spans and OCSF log records to the forwarded receiver
10671067
automatically.
10681068

1069-
In-process compute drivers read their backend-specific settings from `[openshell.drivers.<name>]`. An external driver's gateway table supplies only its `socket_path`; configure the external driver process itself through that binary's flags or environment variables. A driver that advertises `supports_sandbox_authentication` may authenticate an opaque bootstrap credential through the compute-driver protocol. It must return the same non-empty runtime identity from sandbox creation and credential authentication. Start requests include the previously recorded opaque identity so the driver can preserve the stable resource while rotating generation-specific compute. For `IssueSandboxToken`, the gateway verifies the sandbox exists and the driver/runtime identity matches the durable provisioning record before returning a generation-bound session JWT. The in-process Kubernetes driver reads `service_account_name`, `workspace_mode`, and namespace discovery from `[openshell.drivers.kubernetes]`; an external Kubernetes driver receives the equivalent values through its own CLI or environment contract.
1069+
Built-in compute drivers read their backend-specific settings from `[openshell.drivers.<name>]`. The gateway passes the table of a launched driver (VM or Podman) through unchanged, and the driver validates it. An external driver's gateway table supplies only its `socket_path`; configure the external driver process itself through that binary's flags or environment variables. A driver that advertises `supports_sandbox_authentication` may authenticate an opaque bootstrap credential through the compute-driver protocol. It must return the same non-empty runtime identity from sandbox creation and credential authentication. Start requests include the previously recorded opaque identity so the driver can preserve the stable resource while rotating generation-specific compute. For `IssueSandboxToken`, the gateway verifies the sandbox exists and the driver/runtime identity matches the durable provisioning record before returning a generation-bound session JWT. The in-process Kubernetes driver reads `service_account_name`, `workspace_mode`, and namespace discovery from `[openshell.drivers.kubernetes]`; an external Kubernetes driver receives the equivalent values through its own CLI or environment contract.
10701070

10711071
### OTLP Metrics
10721072

@@ -1405,6 +1405,26 @@ The gateway refuses to start when a peer endpoint is configured on a multi-repli
14051405

14061406
## Driver References
14071407

1408+
### Launched Compute Drivers
1409+
1410+
The VM and Podman drivers run as separate binaries that the gateway launches: `openshell-driver-vm` and `openshell-driver-podman`. Docker and Kubernetes still run inside the gateway process.
1411+
1412+
When `driver_dir` is set in `[openshell.drivers.vm]`, the gateway searches only that directory for the VM driver, then the directory that holds the gateway binary. Otherwise it searches these locations in order:
1413+
1414+
1. `libexec` and `libexec/openshell` under the gateway's install prefix.
1415+
2. `~/.local/libexec/openshell`, `/usr/libexec/openshell`, `/usr/local/libexec/openshell`, and `/usr/local/libexec`.
1416+
3. The directory that holds the gateway binary.
1417+
1418+
The Podman driver has no `driver_dir` setting.
1419+
1420+
The gateway refuses a driver binary, or the directory that holds it, that is not owned by the gateway's user or root, or that is writable by its group or by other users. It fails with an error naming the driver when no binary is found.
1421+
1422+
The gateway writes a startup document to a private `run/` directory under the driver's state directory and starts the driver with `--config <path>`. The document holds the gateway's resolved values, such as its name, port, TLS CA, telemetry settings, and the staged network trust artifact. It also holds the driver's `[openshell.drivers.<name>]` table, which the gateway does not interpret. The gateway removes the file once the driver is ready or has failed. OTLP headers stay in the driver's environment and never enter the document.
1423+
1424+
The driver validates its own table at startup and exits when it is invalid. The gateway then reports that the driver exited before it was ready. If a driver exits after it was ready, the gateway logs an error naming the driver and exits with a nonzero status so a service manager can restart it. A driver that ends during a gateway shutdown is not reported.
1425+
1426+
Podman auto-detection runs `openshell-driver-podman probe` with a five-second limit. A missing, untrusted, failing, slow, or malformed probe counts as Podman not being available. `openshell-gateway config preflight` runs the driver's `preflight` command for the selected driver, and for each auto-detectable driver that has a table in the configuration, so the binary must be installed on the host where you run it. Each driver gets ten seconds. Preflight does not see the gateway's TLS CA or the network trust bundle, because the gateway has not created them yet.
1427+
14081428
### External Resource Admission
14091429

14101430
Every compute driver disables caller-supplied `template.driver_config` by
@@ -2112,7 +2132,7 @@ gateway_id = "openshell"
21122132

21132133
[openshell.drivers.vm]
21142134
state_dir = "/var/lib/openshell/vm"
2115-
# Where the gateway looks for the openshell-driver-vm subprocess binary.
2135+
# Where the gateway looks for the openshell-driver-vm binary it launches.
21162136
driver_dir = "/usr/local/libexec/openshell"
21172137
default_image = "nvcr.io/nvidia/base/ubuntu:24.04"
21182138
# Optional override. When omitted, the gateway derives
@@ -2191,6 +2211,8 @@ openshell-gateway generate-certs --output-dir "$OPENSHELL_LOCAL_TLS_DIR"
21912211

21922212
The command also installs local CLI mTLS credentials. For explicit signing configuration, set the example's signing paths to `jwt/signing.pem`, `jwt/public.pem`, and `jwt/kid` under that directory. The gateway loads those paths in preference to local discovery.
21932213

2214+
Configure the guest TLS CA only under `[openshell.gateway]`. The VM driver rejects a `guest_tls_ca` key in `[openshell.drivers.vm]`.
2215+
21942216
Rootfs tar staging requires the gateway and the VM driver to share a filesystem
21952217
and run as the same user. That holds for the managed VM driver, which the
21962218
gateway starts as a subprocess. If you point `compute_driver_endpoints` at an

0 commit comments

Comments
 (0)