Skip to content

Commit 40f8229

Browse files
drewelezar
andauthored
feat(compute): add standalone first-party drivers (#2822)
* feat(compute): add standalone first-party drivers Build Docker, Podman, Kubernetes, and VM drivers as external binaries and exercise each through the public compute-driver API. Keep the external E2E setup complete at introduction, including VM image selection, Kubernetes post-renderer isolation, supervisor reuse, and scoped Podman coverage. External Kubernetes endpoints support shared and managed workspace modes. Operator mode remains restricted to the in-process driver because gateway authentication and the driver must share a dynamic namespace allowlist. Signed-off-by: Drew Newberry <anewberry@nvidia.com> * ci(e2e): run managed and external drivers independently Signed-off-by: Drew Newberry <anewberry@nvidia.com> * test(compute): cover external driver socket contract Signed-off-by: Evan Lezar <elezar@nvidia.com> * ci(e2e): install bundled Z3 build dependency Signed-off-by: Drew Newberry <anewberry@nvidia.com> * fix(server): gate in-tree driver tracing Signed-off-by: Drew Newberry <anewberry@nvidia.com> --------- Signed-off-by: Drew Newberry <anewberry@nvidia.com> Signed-off-by: Evan Lezar <elezar@nvidia.com> Co-authored-by: Evan Lezar <elezar@nvidia.com>
1 parent dfb06e6 commit 40f8229

37 files changed

Lines changed: 1271 additions & 259 deletions

File tree

‎.agents/skills/debug-openshell-cluster/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ journalctl -u <driver-service> --no-pager --lines=200
8787
journalctl -u openshell-gateway --no-pager --lines=200
8888
```
8989

90-
Custom names use `[openshell.drivers.<name>].socket_path`. A launch-time `--compute-driver-socket` override may also use `docker`, `podman`, `kubernetes`, or `vm`; the endpoint then takes precedence over built-in construction. The socket must be accessible only to the intended gateway identity. Check gateway logs for connection errors, `GetCapabilities` failures, or an unexpected advertised driver name. The advertised name is diagnostic metadata; negotiated features control optional behavior. The gateway does not create or supervise operator-supplied driver processes or sockets.
90+
Custom names use `[openshell.drivers.<name>].socket_path`. A launch-time `--compute-driver-socket` override may also use `docker`, `podman`, `kubernetes`, or `vm`; the endpoint then takes precedence over built-in construction. First-party standalone drivers require the socket parent directory to be owned by the driver's effective UID, force its mode to `0700`, create the socket with mode `0600`, and accept only peers with that same UID. Check the parent and socket separately with `stat`; a gateway running under a different UID cannot connect even when filesystem permissions or group membership would otherwise allow it. Operator-supplied drivers must provide equivalent access control appropriate to their implementation. Check gateway logs for connection errors, `GetCapabilities` failures, or an unexpected advertised driver name. The advertised name is diagnostic metadata; negotiated features control optional behavior. The gateway does not create or supervise operator-supplied driver processes or sockets.
9191

9292
For configured gateway interceptors, inspect `[[openshell.gateway.interceptors]]`, their Unix or network endpoints, and gateway startup logs:
9393

‎.github/workflows/branch-e2e.yml‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,20 @@ jobs:
196196
e2e-task: e2e:kubernetes:workspace-managed
197197
cli-artifact-prefix: rust-binary-cli
198198

199+
kubernetes-external-driver-e2e:
200+
needs: [pr_metadata, build-gateway, build-supervisor, build-cli]
201+
if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true'
202+
permissions:
203+
actions: read
204+
contents: read
205+
packages: read
206+
uses: ./.github/workflows/e2e-kubernetes-test.yml
207+
with:
208+
image-tag: ${{ github.sha }}
209+
job-name: Kubernetes E2E (external compute driver)
210+
e2e-task: e2e:kubernetes:external-driver
211+
cli-artifact-prefix: rust-binary-cli
212+
199213
kubernetes-workspace-operator-e2e:
200214
needs: [pr_metadata, build-gateway, build-supervisor, build-cli]
201215
if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true'
@@ -240,7 +254,7 @@ jobs:
240254

241255
core-e2e-result:
242256
name: Core E2E result
243-
needs: [pr_metadata, build-gateway, build-supervisor, build-cli, build-driver-vm-linux, e2e, kubernetes-e2e, kubernetes-workspace-managed-e2e, kubernetes-workspace-operator-e2e]
257+
needs: [pr_metadata, build-gateway, build-supervisor, build-cli, build-driver-vm-linux, e2e, kubernetes-e2e, kubernetes-external-driver-e2e, kubernetes-workspace-managed-e2e, kubernetes-workspace-operator-e2e]
244258
if: always() && needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true'
245259
runs-on: ubuntu-latest
246260
steps:
@@ -252,6 +266,7 @@ jobs:
252266
BUILD_DRIVER_VM_RESULT: ${{ needs.build-driver-vm-linux.result }}
253267
E2E_RESULT: ${{ needs.e2e.result }}
254268
KUBERNETES_E2E_RESULT: ${{ needs.kubernetes-e2e.result }}
269+
KUBERNETES_EXTERNAL_DRIVER_E2E_RESULT: ${{ needs.kubernetes-external-driver-e2e.result }}
255270
KUBERNETES_WORKSPACE_MANAGED_E2E_RESULT: ${{ needs.kubernetes-workspace-managed-e2e.result }}
256271
KUBERNETES_WORKSPACE_OPERATOR_E2E_RESULT: ${{ needs.kubernetes-workspace-operator-e2e.result }}
257272
run: |
@@ -264,6 +279,7 @@ jobs:
264279
"build-driver-vm-linux:$BUILD_DRIVER_VM_RESULT" \
265280
"e2e:$E2E_RESULT" \
266281
"kubernetes-e2e:$KUBERNETES_E2E_RESULT" \
282+
"kubernetes-external-driver-e2e:$KUBERNETES_EXTERNAL_DRIVER_E2E_RESULT" \
267283
"kubernetes-workspace-managed-e2e:$KUBERNETES_WORKSPACE_MANAGED_E2E_RESULT" \
268284
"kubernetes-workspace-operator-e2e:$KUBERNETES_WORKSPACE_OPERATOR_E2E_RESULT"; do
269285
name="${item%%:*}"

‎.github/workflows/e2e-kubernetes-test.yml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,17 @@ jobs:
9696
run: mise install --locked
9797

9898
# The openshell-policy crate transitively pulls in z3-sys, whose
99-
# build script needs the z3 C/C++ headers and clang/bindgen to
100-
# compile. The bare runner doesn't ship them; the CI container
99+
# build script needs the z3 C/C++ headers, clang/bindgen, and CMake to
100+
# compile both system-linked and bundled-Z3 builds. The bare runner
101+
# doesn't ship them; the CI container
101102
# image used by other Rust e2e jobs does, but we can't run this job
102103
# there (the runner's container handler injects its own --network
103104
# bridge, which conflicts with the --network host we need so kind's
104105
# API server is reachable from the test process).
105106
- name: Install z3 build deps
106-
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libz3-dev clang
107+
run: |
108+
sudo apt-get update
109+
sudo apt-get install -y --no-install-recommends libz3-dev clang cmake
107110
108111
- name: Log in to GHCR
109112
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

‎.github/workflows/e2e-test.yml‎

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959
- suite: rust-docker
6060
cmd: "mise run --no-deps --skip-deps e2e:rust"
6161
apt_packages: "openssh-client"
62+
- suite: rust-docker-external-driver
63+
cmd: "env -u OPENSHELL_GATEWAY_BIN mise run --no-deps --skip-deps e2e:docker:external-driver"
64+
apt_packages: "openssh-client"
6265
- suite: mcp
6366
cmd: "mise run --no-deps --skip-deps e2e:mcp"
6467
apt_packages: ""
@@ -127,7 +130,7 @@ jobs:
127130
run: ${{ matrix.cmd }}
128131

129132
e2e-podman-rootless:
130-
name: E2E (rust-podman-rootless, ${{ matrix.runner }})
133+
name: E2E (rust-podman-${{ matrix.suite }}, ${{ matrix.runner }})
131134
# Run directly on the Ubuntu host so the test observes the host's AppArmor
132135
# and unprivileged-user-namespace policy. A privileged job container masks
133136
# the restrictions that production rootless Podman installations enforce.
@@ -142,10 +145,18 @@ jobs:
142145
include:
143146
# Keep package versions explicit so hosted-runner tool overrides
144147
# cannot silently change the supported test environment.
145-
- runner: ubuntu-26.04
148+
- suite: rootless
149+
runner: ubuntu-26.04
146150
podman_major: "5"
147151
podman_package_version: "5.7.0+ds2-3build1"
148152
conmon_package_version: "2.1.13+ds1-2"
153+
cmd: "mise run --no-deps --skip-deps e2e:podman:rootless"
154+
- suite: external-driver
155+
runner: ubuntu-26.04
156+
podman_major: "5"
157+
podman_package_version: "5.7.0+ds2-3build1"
158+
conmon_package_version: "2.1.13+ds1-2"
159+
cmd: "env -u OPENSHELL_GATEWAY_BIN mise run --no-deps --skip-deps e2e:podman:external-driver"
149160
env:
150161
IMAGE_TAG: ${{ inputs.image-tag }}
151162
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -261,20 +272,28 @@ jobs:
261272
- name: Log in to GHCR with Podman
262273
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io -u "${{ github.actor }}" --password-stdin
263274

264-
- name: Run rootless Podman E2E
265-
run: mise run --no-deps --skip-deps e2e:podman:rootless
275+
- name: Run Podman E2E
276+
run: ${{ matrix.cmd }}
266277

267278
- name: Print AppArmor denials
268279
if: always()
269280
run: sudo dmesg | grep -E 'apparmor=.*DENIED|profile="unprivileged_userns"' | tail -100 || true
270281

271282
e2e-vm:
272-
name: E2E (rust-vm)
283+
name: E2E (rust-vm-${{ matrix.suite }})
273284
# libkrun needs KVM, so this job must run directly on a GitHub-hosted
274285
# Linux VM. GitHub-hosted macOS runners do not support nested
275286
# virtualization, and a job container would hide the host KVM device.
276287
runs-on: ubuntu-24.04
277288
timeout-minutes: 90
289+
strategy:
290+
fail-fast: false
291+
matrix:
292+
include:
293+
- suite: managed
294+
cmd: "mise run --no-deps --skip-deps e2e:vm"
295+
- suite: external-driver
296+
cmd: "env -u OPENSHELL_GATEWAY_BIN mise run --no-deps --skip-deps e2e:vm:external-driver"
278297
env:
279298
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280299
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -362,4 +381,4 @@ jobs:
362381
cache-on-failure: "true"
363382

364383
- name: Run VM E2E
365-
run: mise run --no-deps --skip-deps e2e:vm
384+
run: ${{ matrix.cmd }}

‎Cargo.lock‎

Lines changed: 5 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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ to `run_cli_with_compute_drivers`; factories receive merged driver config and
120120
finish through the same in-process runtime adapter. A configured UDS endpoint
121121
still takes precedence over a compiled registration with the same name.
122122

123+
The standard server crate groups first-party registrations behind the
124+
`in-tree-compute-drivers` feature. Protocol-only gateway builds disable that
125+
feature and link no compute-driver crates. E2E lanes compose that gateway with
126+
Docker, Podman, Kubernetes, and VM driver executables over the public UDS gRPC
127+
contract so an in-tree driver cannot silently depend on a server-only API.
128+
External Kubernetes drivers support shared and managed workspace modes.
129+
Operator mode requires an in-process dynamic namespace allowlist and is
130+
rejected when Kubernetes is configured through an external endpoint.
131+
123132
## Stop and Start Lifecycle
124133

125134
The gateway persists lifecycle intent before mutating compute:

‎crates/openshell-core/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ tempfile = { version = "3", optional = true }
3535

3636
[target.'cfg(unix)'.dependencies]
3737
nix = { workspace = true }
38+
rustix = { workspace = true }
3839

3940
[features]
4041
default = ["telemetry"]

0 commit comments

Comments
 (0)