Skip to content

refactor(driver-utils): centralize container mount path constants#1841

Merged
TaylorMutch merged 1 commit into
NVIDIA:mainfrom
ericcurtin:dedup-driver-constants/ec
Jun 9, 2026
Merged

refactor(driver-utils): centralize container mount path constants#1841
TaylorMutch merged 1 commit into
NVIDIA:mainfrom
ericcurtin:dedup-driver-constants/ec

Conversation

@ericcurtin

Copy link
Copy Markdown
Contributor

Summary

Move duplicate in-container path string literals from four driver crates into a single canonical location in `openshell-core::driver_utils`. Eliminates the risk of the drivers silently diverging on paths that the supervisor binary depends on at runtime.

Related Issue

No issue — opportunistic deduplication found during codebase review.

Changes

  • openshell-core: Add six new `pub const` values to `driver_utils`:

    • `TLS_CA_MOUNT_PATH`, `TLS_CERT_MOUNT_PATH`, `TLS_KEY_MOUNT_PATH`, `SANDBOX_TOKEN_MOUNT_PATH` — the four in-container paths for guest mTLS credentials and the sandbox JWT, previously copy-pasted verbatim between the Docker and Podman drivers.
    • `SUPERVISOR_CONTAINER_DIR` — the directory mount-point (`/opt/openshell/bin`) used by Kubernetes and Podman when side-loading the supervisor image volume.
    • `SUPERVISOR_CONTAINER_BINARY` — the full binary path (`/opt/openshell/bin/openshell-sandbox`) used by Docker, Podman entrypoint, and the VM rootfs injector.
  • openshell-driver-docker: Replace five hardcoded `const` literals with references to core (TLS paths + `SUPERVISOR_CONTAINER_BINARY`).

  • openshell-driver-podman: Replace four hardcoded TLS `const` literals + two inline supervisor path strings with core constants.

  • openshell-driver-kubernetes: Replace local `SUPERVISOR_MOUNT_PATH = "/opt/openshell/bin"` with `SUPERVISOR_CONTAINER_DIR` from core.

  • openshell-driver-vm (`rootfs.rs`): Replace local `SANDBOX_SUPERVISOR_PATH = "/opt/openshell/bin/openshell-sandbox"` with `SUPERVISOR_CONTAINER_BINARY` from core.

No call-site changes required in any driver — local constant names are preserved by assigning them from the core values.

Testing

  • `mise run pre-commit` passes
  • Unit tests pass (`mise run test`)
  • E2E tests added/updated (not applicable — constants only)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

Move duplicate in-container path constants from the Docker, Podman,
Kubernetes, and VM driver crates into openshell-core::driver_utils:

- TLS_CA_MOUNT_PATH, TLS_CERT_MOUNT_PATH, TLS_KEY_MOUNT_PATH,
  SANDBOX_TOKEN_MOUNT_PATH — identical string literals that were
  copy-pasted between openshell-driver-docker and
  openshell-driver-podman.

- SUPERVISOR_CONTAINER_DIR (/opt/openshell/bin) and
  SUPERVISOR_CONTAINER_BINARY (/opt/openshell/bin/openshell-sandbox) —
  replaces three diverging local constants across docker, kubernetes,
  podman, and vm-rootfs that referred to the same paths under different
  names with different string values (the k8s constant was the directory;
  the docker/vm constant was the full binary path).

Each driver crate now assigns its local constant from the canonical core
value, keeping existing names visible to tests without any call-site
churn. The openshell-core constants carry doc comments explaining when
to use the dir vs. the full binary path.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
@ericcurtin ericcurtin requested review from a team, derekwaynecarr and mrunalp as code owners June 9, 2026 17:39
@copy-pr-bot

copy-pr-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@TaylorMutch

Copy link
Copy Markdown
Collaborator

/ok to test a372702

@TaylorMutch TaylorMutch merged commit 70acbaf into NVIDIA:main Jun 9, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants