fix: mount shared PVC into write-prompt init container #12
Reference in New Issue
Block a user
Delete Branch "kkroo/fix/init-container-data-mount"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The `write-prompt` init container runs `mkdir -p /paperclip/instances/default/run-logs//` before the main `claude` container starts. The init container's `volumeMounts` only includes `prompt` (and `prompt-secret` on the large-prompt path); the shared `data` PVC mounted at `/paperclip` in the main container is missing.
So the mkdir tries to create `/paperclip` in the busybox overlay rootfs, where uid 1000 cannot write at `/`, and the Job fails before the main container ever runs:
```
mkdir: can't create directory '/paperclip/': Permission denied
```
Reproduced on kubeadm v1.35.3 / containerd 2.2.x / cephfs RWX with adapter v0.2.1 against `paperclip-adapter-claude-k8s@0.2.1` from npm.
Fix
Add `{ name: "data", mountPath: "/paperclip" }` to both branches of `initContainer.volumeMounts` (`useLargePromptPath` true and false) in `src/server/job-manifest.ts`. With the data mount in scope, the existing `mkdir -p /paperclip/.../run-logs/...` writes to the same shared PVC the main `claude` container reads from.
Verification
Reproduced the failure, applied the fix, and re-ran an end-to-end heartbeat against a real Paperclip control plane:
The shared PVC is the same one the main container mounts (claim `paperclip-data`, RWX cephfs in our deployment), so no other manifest changes are needed.
Notes
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.