feat: add workspace-mount-sub-path-expr config option#871
Merged
DrJosh9000 merged 1 commit intoMay 5, 2026
Merged
Conversation
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.
1158cc0 to
ef8686f
Compare
DrJosh9000
approved these changes
May 5, 2026
Contributor
DrJosh9000
left a comment
There was a problem hiding this comment.
Thanks @csweeney-plaid! The idea is sound, and the code LGTM. ✅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it is
When set, applies a
subPathExprto 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 runworkloads 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.