Skip to content

feat(devbox): add plural devbox up/down/status/check and runner commands - #851

Merged
michaeljguarino merged 18 commits into
mainfrom
sebastian/prod-5500-bring-your-own-device-devbox
Dec 2, 2026
Merged

michaeljguarino merged 18 commits into
mainfrom
sebastian/prod-5500-bring-your-own-device-devbox

Conversation

@floreks

@floreks floreks commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds plural devbox (PROD-5500): turns a Linux device (Jetson, WSL, any Linux box) into a devbox runner registered with Console. On macOS, run k3s in a Lima VM and use --existing-cluster.

  • up starts its own k3s (>= 1.37) as plural-devbox-k3s.service from the k3s binary already installed. It never downloads binaries, and root steps are shown before they run. --existing-cluster uses a given kubeconfig instead.
  • Preflight checks (version, pod-certificate APIs, node, and a probe for /dev/kvm, sysctls and disk) pick microVM or gVisor, and warn when another CloudNativePG operator runs.
  • Creates or reuses the device's project, registers the cluster, installs the agent, and sets up the project's agent-substrate global service and a devbox-runner service per runner, sized to the node. The chart repository and versions are recorded, so runner add and later runs reuse them.
  • stop and start stop the k3s cluster to free its CPU and memory, and bring it back.
  • down removes the device from Console (warning to suspend devboxes first). down --purge also deletes the k3s cluster and Agent Substrate's data in /var/lib/ate, never deleting through a mount and leaving another cluster's state alone.
  • Also adds status, check and runner add|list|remove.

Depends on pluralsh/console#4770 for ProjectFragment.allowAgents. go.mod pins the console client to that branch until it's released.

Labels

enhancement

Test Plan

  • Unit tests for every new pkg/devbox package, the commands and the error helpers. golangci-lint is clean. Cross-compiles for linux (amd64, arm64), darwin and windows.
  • End to end on WSL2 (k3s v1.37.2) against plrl-dev-aws, through a 22-case matrix: check, up (and a re-run updating the unit), a microVM devbox with Docker, suspend and resume, status, runner add, stop/start, down on a stopped cluster, down then up again, and down --purge. All pass. The fixes they needed are in this PR, and the follow-ups outside it are in PROD-5514.
  • Not yet run on arm64 (Jetson) or macOS (Lima).

Checklist

  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • I have added relevant labels to this PR to help with categorization for release notes.

`plural devbox up` turns a Linux device into a devbox runner registered with Console
(PROD-5500):

- Starts its own single-node k3s (>= 1.37) as plural-devbox-k3s.service from the
  k3s binary already installed, with a private config and data dir. It never
  downloads binaries; root steps are shown and confirmed, or printed with
  --print-root-steps. --existing-cluster uses a given kubeconfig instead.
- Preflight: Kubernetes version, pod certificate APIs, single node, memory, and a
  read-only probe pod for /dev/kvm, proxy_arp and free disk; picks microvm or gvisor.
- Creates or reuses the device's project (allowAgents), registers the cluster,
  installs the deployment operator, creates or reuses the project's agent-substrate
  global service and one devbox-runner service per runner sized to the node.
- State in ~/.plural/devbox.yml, a lock, a kube-system marker, and a pinned
  single-context kubeconfig verified by the kube-system UID before every write.
- down removes only what devbox created (shared substrate only from the last device);
  --purge also removes the k3s unit and data. runner add/list/remove manage more
  runners on the same cluster. status and check report the setup.
- Host checks for WSL: unparseable mounts (Docker Desktop), shared / mount, and a
  warning that the virtual disk hides the Windows drive's free space.

The console Go client moved to gqlgo/gqlgenc, so the GraphQL error helpers now
handle both gqlgenc forks. This needs the console client release that adds
ProjectFragment.allowAgents before go.mod can be bumped.
@floreks floreks self-assigned this Dec 1, 2026
@floreks floreks added the enhancement New feature or request label Dec 1, 2026
@linear

linear Bot commented Dec 1, 2026

Copy link
Copy Markdown

PROD-5500

@floreks
floreks marked this pull request as draft December 1, 2026 16:26
@socket-security

socket-security Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgithub.com/​pluralsh/​console/​go/​client@​v1.79.1 ⏵ v1.82.1-0.20261201162228-13b0cab1aa8a9910010010070
Addedgithub.com/​gqlgo/​gqlgenc@​v0.38.297100100100100

View full report

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The latest test-only change appears safe to merge.

Summary

Adds commands to set up and manage a devbox device, register it with Console, and create its runners.

  • A device can become a sized devbox runner registered with Console.
  • Users can inspect, pause, resume, and remove a device's devbox setup.
  • Console and Plural API errors share the same readable error helpers.

Previously accepted tradeoffs:

  • floreks accepted recording planned runner sizes after an interrupted setup because reading deployed values would require a Console API change.
  • floreks dismissed support for the removed marker field because it existed only on this unreleased branch.

Reviews (9) · Last reviewed commit: "test(devbox): preallocate the purge test..." · Reviewed by Greptile

Comment thread pkg/devbox/bootstrap/bootstrap.go Resolved
Comment thread pkg/devbox/bootstrap/bootstrap.go Resolved
Comment thread cmd/command/devbox/cluster.go Resolved
Comment thread pkg/devbox/bootstrap/bootstrap.go Resolved
Comment thread cmd/command/devbox/runner.go Resolved
Comment thread pkg/devbox/k3s/k3s.go Resolved
- Record the cluster's kube-system UID in its Console metadata and only adopt a
  registration made for this same cluster (an older one this machine recorded gets
  the UID), so another device can't take over or delete it.
- The kube-system marker also checks the device name.
- Save the state before the k3s root steps, so a failed first run can be purged.
- Keep a recreated runner's recorded sizes instead of this run's plan.
- Track whether KVM was probed, so runners after up --skip-checks aren't refused.
- Shell-quote printed root steps so pasting them runs the same commands.
- Split up and down into stages (gocyclo) and fix lint findings.
Temporary pseudo-version for ProjectFragment.allowAgents and the gqlgo client,
until the console client release replaces it.
@floreks

floreks commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

@greptileai

Comment thread cmd/command/devbox/down.go Resolved
@floreks

floreks commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

@greptileai

@floreks

floreks commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

@greptileai

Comment thread pkg/devbox/state/state.go Resolved
Comment thread cmd/command/devbox/down.go Resolved
@floreks

floreks commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@greptileai review

Comment thread cmd/command/devbox/power.go Resolved
@floreks

floreks commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@greptileai review

@floreks

floreks commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@greptileai review

@floreks

floreks commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@greptileai review

@floreks
floreks marked this pull request as ready for review December 2, 2026 13:39
@michaeljguarino
michaeljguarino merged commit 8cea77c into main Dec 2, 2026
16 checks passed
@michaeljguarino
michaeljguarino deleted the sebastian/prod-5500-bring-your-own-device-devbox branch December 2, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants