Uh oh!
There was an error while loading. Please reload this page.
fix(scripts): pre-create per-release hostPath dirs as host user - #67
Merged
Conversation
The chart's hostPath PVs bind to /tracebloc/<release>/{data,logs,mysql},
but the installer only chmodded /tracebloc/{data,logs,mysql} (no release
name). Result: kubelet's DirectoryOrCreate created the per-release subdirs
as root:root 0755 and the host user (e.g. ubuntu on EC2) could not drop
files into /data/shared via ~/.tracebloc/<release>/data.
Add _ensure_release_dirs(<release>) and call it just before
helm upgrade --install, so the dirs exist with permissive mode owned by
the host user before kubelet sees them.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>divyasinghds
approved these changes
Apr 27, 2026
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 freeto 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.
Summary
_ensure_release_dirs <release>inscripts/lib/cluster.shto pre-create$HOST_DATA_DIR/<release>/{data,logs,mysql}with mode 0777 owned by the host user.scripts/lib/install-client-helm.shjust beforehelm upgrade --install, whereTB_NAMESPACE(= release name) is known in both the prompt andTRACEBLOC_VALUES_FILEdev-mode flows.Why
The chart's hostPath PVs bind to
/tracebloc/{{ .Release.Name }}/{data,logs,mysql}(seeclient/templates/shared-images-pvc.yaml,logs-pvc.yaml,mysql-storage-pvc.yaml), which maps back to$HOST_DATA_DIR/<release>/{data,logs,mysql}on the host through the k3d-v "${HOST_DATA_DIR}:/tracebloc@all"mount.The existing
_ensure_tracebloc_dirsonly chmods$HOST_DATA_DIR/{data,logs,mysql}— a path the chart never touches. When the pod schedules, kubelet'sDirectoryOrCreatecreates the per-release subdirs asroot:rootmode0755, leaving the host user (e.g.ubuntuon a typical EC2 box) unable to write there.Repro (before this fix), with release
ml-mrdan:After this fix, fresh installs pre-create the per-release dirs as the host user with
0777, so files dropped there appear at/data/sharedinside thejobs-managerpod'sapicontainer as expected.Notes
root:root 0755will need a one-time manualsudo chmod -R 777 ~/.tracebloc/<release>/{data,logs,mysql}. Thechmodin the new function is best-effort (2>/dev/null || true) so re-running the installer won't error out, but it can't relax permissions on dirs the user doesn't own._ensure_tracebloc_dirsis left untouched. Its chmod on$HOST_DATA_DIR/{data,logs,mysql}is a no-op for the chart but harmless and removing it is out of scope for this fix.Test plan
bash -nsyntax check on both modified files.cluster.shand ran_ensure_release_dirs ml-mrdanagainst a tempHOST_DATA_DIR— confirmed dirs created with mode0777owned by current user.helm template ml-mrdan ./client --set hostPath.enabled=true ...confirms PVpath:values are/tracebloc/ml-mrdan/{data,logs,mysql}— matches what the function pre-creates.scripts/install.shon a clean EC2 box, verify~/.tracebloc/<release>/data/test.txtwritten by host user appears in/data/shared/of thejobs-managerpod.🤖 Generated with Claude Code
Note
Low Risk
Low risk shell-script change limited to installer/cluster setup; main impact is filesystem permissions (creates/chmods release-specific dirs).
Overview
Fixes fresh installs where hostPath-backed volumes end up owned by
rootby pre-creating release-scoped directories on the host.Adds
_ensure_release_dirs <release>to create/chmod$HOST_DATA_DIR/<release>/{data,logs,mysql}, and calls it ininstall-client-helm.shimmediately beforehelm upgrade --installusingTB_NAMESPACEas the release name.Reviewed by Cursor Bugbot for commit b123cff. Bugbot is set up for automated code reviews on this repo. Configure here.