feat(slopshack): per-session ephemeral build/test pods for claude #10

Open
claude wants to merge 1 commit from arrdem/slopshack into trunk
Contributor

Adds slopshack: an ephemeral-pod wrapper for claude that solves workstation CPU starvation when several Claude agents run cargo build/cargo test in parallel. Heavy work runs on cluster cores; the interactive loop and the editor stay local.

slopshack-claude finds the git root, parses .devcontainer/devcontainer.json (if any) for the dev image, provisions a Pod (sshd + nfs-ganesha sidecars wrapping the dev container), tar-pipes the working tree in, NFS-mounts the pod's /workspace over the local repo, and execs claude with CLAUDE_CODE_SHELL routed through slopshack-cli. On exit (clean, INT, TERM, HUP) the wrapper umounts and detaches; a 15-min slopshack-gc CronJob sweeps orphans whose pod has been gone >2h, in case the trap doesn't fire.

See projects/slopshack/SPEC.md for design rationale, prior art, and explicit non-goals.

Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes

  • Breaking change: no

  • Suggested release notes appear below: yes

    slopshackclaude wrapper that off-loads cargo build/cargo test and similar to ephemeral cluster pods. bazel run //projects/slopshack:deploy to bootstrap; slopshack-claude from any git repo to use.

Test plan

Manual end-to-end during development:

  • Provisioned a 3/3 Ready session pod on a worker node, NodePorts assigned for ssh + nfs.
  • cargo new + cargo build --release ran in-pod on 16 cluster cores; cwd persisted across separate wrapper invocations; zero local target/.
  • slopshack-claude against a tiny test repo with stubbed claude/sudo: full chain (provision -> ssh-wait -> tar-push -> mount-call -> claude-launch -> umount -> detach) executed; no residue.
  • SSH-readiness retry caught a real race between pod-Ready and kube-proxy NodePort wiring during testing; fixed.

Follow-ups (deferred, in SPEC.md)

  • MODULE.bazel registration of the two Rust crate sets.
  • image-shell/ and image-fs/ BUILD.bazel are stubs — bootstrap images were built with direct docker build for the demo; pick rules_buildx vs declarative oci_image next.
  • Optional setcap'd slopshack-mount helper to remove the per-host sudoers entry.
Adds **slopshack**: an ephemeral-pod wrapper for `claude` that solves workstation CPU starvation when several Claude agents run `cargo build`/`cargo test` in parallel. Heavy work runs on cluster cores; the interactive loop and the editor stay local. `slopshack-claude` finds the git root, parses `.devcontainer/devcontainer.json` (if any) for the dev image, provisions a Pod (sshd + nfs-ganesha sidecars wrapping the dev container), tar-pipes the working tree in, NFS-mounts the pod's `/workspace` over the local repo, and execs `claude` with `CLAUDE_CODE_SHELL` routed through `slopshack-cli`. On exit (clean, INT, TERM, HUP) the wrapper umounts and detaches; a 15-min `slopshack-gc` CronJob sweeps orphans whose pod has been gone >2h, in case the trap doesn't fire. See `projects/slopshack/SPEC.md` for design rationale, prior art, and explicit non-goals. ### Changes are visible to end-users: yes - Searched for relevant documentation and updated as needed: yes - Breaking change: no - Suggested release notes appear below: yes > **slopshack** — `claude` wrapper that off-loads `cargo build`/`cargo test` and similar to ephemeral cluster pods. `bazel run //projects/slopshack:deploy` to bootstrap; `slopshack-claude` from any git repo to use. ### Test plan Manual end-to-end during development: - Provisioned a 3/3 Ready session pod on a worker node, NodePorts assigned for ssh + nfs. - `cargo new + cargo build --release` ran in-pod on 16 cluster cores; cwd persisted across separate wrapper invocations; zero local `target/`. - `slopshack-claude` against a tiny test repo with stubbed `claude`/`sudo`: full chain (provision -> ssh-wait -> tar-push -> mount-call -> claude-launch -> umount -> detach) executed; no residue. - SSH-readiness retry caught a real race between pod-Ready and kube-proxy NodePort wiring during testing; fixed. ### Follow-ups (deferred, in `SPEC.md`) - `MODULE.bazel` registration of the two Rust crate sets. - `image-shell/` and `image-fs/` `BUILD.bazel` are stubs — bootstrap images were built with direct `docker build` for the demo; pick `rules_buildx` vs declarative `oci_image` next. - Optional setcap'd `slopshack-mount` helper to remove the per-host sudoers entry.
Wrapper for `claude` that provisions an ephemeral k8s pod (sshd +
nfs-ganesha sidecars around a bring-your-own dev container), pushes
the local working tree into it, NFS-mounts the pod's /workspace over
the local repo, and routes Bash tool calls there via
CLAUDE_CODE_SHELL. Solves workstation CPU starvation when several
agents want to `cargo build` simultaneously: heavy work runs on
cluster cores, the interactive loop stays local, the editor sees
the same filesystem.

Components:
  wrapper/slopshack-claude  end-user entrypoint
  sessiond/                 pod lifecycle CLI (kube-rs)
  cli/                      the CLAUDE_CODE_SHELL adapter
  image-shell/, image-fs/   sidecar images (alpine+sshd, debian+ganesha)
  Tillerfile                namespace + StorageClass + GC CronJob

Per-session resources are wiped on detach (PVC reclaimPolicy=Delete).
A 15-minute GC CronJob sweeps orphans whose owning pod has been gone
>2h, in case the wrapper trap doesn't fire (SIGKILL, host crash).

See projects/slopshack/SPEC.md for the design.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin arrdem/slopshack:arrdem/slopshack
git switch arrdem/slopshack

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch trunk
git merge --no-ff arrdem/slopshack
git switch arrdem/slopshack
git rebase trunk
git switch trunk
git merge --ff-only arrdem/slopshack
git switch arrdem/slopshack
git rebase trunk
git switch trunk
git merge --no-ff arrdem/slopshack
git switch trunk
git merge --squash arrdem/slopshack
git switch trunk
git merge --ff-only arrdem/slopshack
git switch trunk
git merge arrdem/slopshack
git push origin trunk
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
arrdem/source!10
No description provided.