Skip to content

feat: add workspace-mount-sub-path-expr config option#871

Merged
DrJosh9000 merged 1 commit into
buildkite:mainfrom
csweeney-plaid:feat/workspace-mount-sub-path-expr
May 5, 2026
Merged

feat: add workspace-mount-sub-path-expr config option#871
DrJosh9000 merged 1 commit into
buildkite:mainfrom
csweeney-plaid:feat/workspace-mount-sub-path-expr

Conversation

@csweeney-plaid
Copy link
Copy Markdown
Contributor

@csweeney-plaid csweeney-plaid commented Apr 29, 2026

What it is

When set, applies a subPathExpr to every /workspace VolumeMount the controller creates (workspace setup init container, image check init containers, agent + checkout system containers, and command containers).

This allows a shared workspace volume — e.g. a hostPath rooted at the node's /var/lib/buildkite-workspaces — to be sliced into per-pod subdirectories so concurrent jobs on the same node don't collide on /workspace/build, /workspace/sockets, etc.

Why

this enables a per-node shared-cache pattern for docker run workloads that Plaid is using — a single dockerd DaemonSet on each node bind-mounts the shared workspace hostPath, and per-pod subdirectories prevent concurrent jobs from clobbering each other's workspace state.
Without this option, per-pod isolation is impossible because the workspace mount is hardcoded with no SubPath.

Usage

The canonical setup Plaid is using this in is workspace-mount-sub-path-expr: $(POD_NAME) paired with a downward-API POD_NAME env var on the relevant containers (via pod-spec-patch or the chart's checkout-params / command-params).

Default ("") preserves the previous behavior.

Tests cover both the configured-value-propagates-everywhere case and the default-no-subPath case.

When set, applies a `subPathExpr` to every /workspace VolumeMount the
controller creates (workspace setup init container, image check init
containers, agent + checkout system containers, and command containers).
This allows a shared workspace volume — e.g. a hostPath rooted at the
node's /var/lib/buildkite-workspaces — to be sliced into per-pod
subdirectories so concurrent jobs on the same node don't collide on
/workspace/build, /workspace/sockets, etc.

The canonical setup is `workspace-mount-sub-path-expr: $(POD_NAME)`
paired with a downward-API POD_NAME env var on the relevant containers
(via pod-spec-patch or the chart's checkout-params / command-params).

Default ("") preserves the previous behavior.

Tests cover both the configured-value-propagates-everywhere case and
the default-no-subPath case.

Use case: enables a per-node shared-cache pattern for `docker run`
workloads — a single dockerd DaemonSet on each node bind-mounts the
shared workspace hostPath, and per-pod subdirectories prevent
concurrent jobs from clobbering each other's workspace state. Without
this option, per-pod isolation is impossible because the workspace
mount is hardcoded with no SubPath.
@csweeney-plaid csweeney-plaid force-pushed the feat/workspace-mount-sub-path-expr branch from 1158cc0 to ef8686f Compare April 29, 2026 18:40
@csweeney-plaid csweeney-plaid changed the title Add workspace-mount-sub-path-expr config option feat: add workspace-mount-sub-path-expr config option Apr 29, 2026
@csweeney-plaid csweeney-plaid marked this pull request as ready for review April 29, 2026 19:41
@csweeney-plaid csweeney-plaid requested a review from a team as a code owner April 29, 2026 19:41
@quinn-diesel quinn-diesel requested a review from a team May 3, 2026 23:22
@DrJosh9000 DrJosh9000 self-requested a review May 5, 2026 03:06
Copy link
Copy Markdown
Contributor

@DrJosh9000 DrJosh9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @csweeney-plaid! The idea is sound, and the code LGTM. ✅

@DrJosh9000 DrJosh9000 merged commit 62fcc65 into buildkite:main May 5, 2026
3 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