Repository navigation
feat(registry/coder-labs/templates): add the Plain Sandbox (Kubernetes) template - #1232
Merged
Merged
Conversation
… Pod template with a host name firewall
…tes) and agent-sandbox (Kubernetes)
bpmct
marked this pull request as ready for review
November 3, 2026 20:14
bpmct
force-pushed
the
kubernetes-sandboxed
branch
from
November 3, 2026 20:15
c2b398e to
eecaeba
Compare
… Plain Sandbox (Kubernetes)
4 of 9 tasks
bpmct
added a commit
that referenced
this pull request
Nov 5, 2026
## Description Adds a `coder-labs` template that runs each workspace in an [NVIDIA OpenShell](https://docs.nvidia.com/openshell/latest/about/overview) sandbox on Kubernetes. It is the third sibling of agent-sandbox (Kubernetes) (#1230) and Plain Sandbox (Kubernetes) (#1232). - **Firewall:** the OpenShell proxy, by host name and program. Profiles: Fully isolated (default), GitHub only, GitHub and package registries, and Custom (host names and ports 443, 80, 22 typed in the form). There is no Public internet, because OpenShell 0.1.5 has no rule for any public host. - **File limits:** Landlock keeps `/usr` and `/etc` read-only and denies paths outside the policy. - **Kernel isolation:** the node's container runtime with Landlock and seccomp by default, the fastest. List `kata-qemu` or `kata-clh` in `runtimes` to offer a microVM. gVisor does not work, because it has no Landlock. - **Launcher:** Terraform cannot call the gateway, so a small launcher Pod (`build/launcher/Dockerfile`, Alpine and the `openshell` CLI, 35 MB) creates the sandbox on start and deletes it on stop. Coder owns the home disk, mounted at `/sandbox/home`. - **Cluster setup:** `cluster/` installs the gateway with the Helm provider and creates the namespaces, the gateway credentials, the RuntimeClass labels, and the RBAC. Its `coder_variables` output is the `--variables-file`. - **Shared with the siblings:** `build/Dockerfile`, the scoped AI Gateway token, the code-server, git-clone, and Claude Code setup, the presets, and the README layout. - **Icon:** `.icons/openshell.svg`, the OpenShell mark from `NVIDIA/OpenShell` (Apache-2.0). Startup on EKS, create to connected agent: about 2 s from a prebuild, 14 s cold, 17 s cold on Kata. ## Type of Change - [ ] New module - [x] New template - [ ] Bug fix - [ ] Feature/enhancement - [ ] Documentation - [ ] Other ## Template Information **Path:** `registry/coder-labs/templates/kubernetes-openshell` ## Testing & Validation - [x] Tests pass locally (`terraform test`: 24 template runs and 5 `cluster/` runs, with mock providers). CI runs `.tftest.hcl` only for modules, so these do not run in CI. - [x] Code formatted (`prettier --check`, `terraform fmt`), README validator and shellcheck pass - [x] Changes tested locally (EKS, VPC CNI, OpenShell 0.1.5, Kata Cloud Hypervisor) <details> <summary>Live test results</summary> | Case | Result | |---|---| | `cluster/` apply (a second gateway release) | 8 resources, gateway ready in 19 s | | Claim from a prebuild | build 1.6 s, agent ready 2.0 s | | No prebuild (Custom) | ready 14.4 s | | Kata Cloud Hypervisor, no prebuild | ready 16.8 s, VM kernel `6.18.35` | | Stop, then start | stop 37 s, ready 24 s | | Fully isolated | GitHub blocked, Coder 200 | | GitHub and package registries | GitHub, npm, PyPI 200; example.com blocked; prebuilt clone present | | Custom (`example.com`, `*.wikipedia.org`, 443) | example.com and en.wikipedia.org reachable; port 80, GitHub, npm, metadata blocked; `wikipedia.org` itself blocked | | Landlock | writing `/usr` and reading `/etc/shadow` denied | | AI Gateway | scoped token set, `claude -p` answers | | Delete | sandbox and home disk removed | </details> <details> <summary>Decisions</summary> - **Two namespaces:** the gateway in its own namespace, sandboxes and launchers in the workspace namespace. The provisioner gets Secrets access only in the workspace namespace, not next to the gateway's server key and JWT keys. `cluster/` copies the CA (for supervisors) and the client bundle (for launchers) across. - **Agent token from a Secret** in the launcher Pod. OpenShell still puts it in plain text in the sandbox Pod and the Sandbox, which the README lists under Limits. - **The launcher runs `create` in the background,** so SIGTERM deletes the sandbox at once, even while a create waits for compute. The old prototype ran it in the foreground, and a stop or a delete during a Pending create left a suspended Sandbox behind. - **`restart_policy = "Always"` on the launcher:** a restarted launcher replaces the sandbox. A crash costs the running session but not the home, instead of a workspace whose agent never comes back. - **`cpu` and `memory` are template variables** (1 and 2Gi), because OpenShell sets them as both the request and the limit, and 2 CPU left new sandboxes Pending on a busy cluster. - **Presets set `runtime = "none"`** when `runtimes` is set, like #1232, so a claim never changes an immutable parameter. </details> <details> <summary>Review</summary> A Claude (Fable) review found no blockers. Fixed: the Helm provider constraint (`>= 3.0` for the attribute syntax), the TERM trap during a create, the `openshell policy update` example (prettier's sh plugin had mangled it), the Landlock and wildcard wording, the agent token note, a removed redundant `curl` rule, and more tests. Not changed: polling for a sandbox that the gateway removes, because a gateway blip would then restart a healthy sandbox. </details> ## Related Issues None --- 🤖 This PR was generated by Coder Agents on behalf of @bpmct. Co-authored-by: DevCats <[email protected]>
4 of 9 tasks
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.
Description
Adds a
coder-labstemplate that runs each workspace in a plain Kubernetes Pod, with a host name firewall. It needs no controller and no CRDs. It is the plain-Pods sibling of agent-sandbox (Kubernetes) (#1230).gvisor,kata-qemu, orkata-clhinruntimesto offer them in a "Kernel isolation" dropdown.build/Dockerfile, the policy gate instart-agent.sh, the scoped AI Gateway token, and the code-server, git-clone, and Claude Code setup.cluster/is a small Terraform configuration for the namespace and the RBAC.build/egress-proxy/Dockerfile, Squid 7 on Alpine, from the egress firewall in coder/dogfood. Users build it themselves.Startup on EKS, create to connected agent: 3 to 7 s from a prebuild, about 15 s cold or start after stop.
Type of Change
Template Information
Path:
registry/coder-labs/templates/kubernetes-sandboxedTesting & Validation
terraform test: 35 template runs and 3cluster/runs, with mock providers). CI runs.tftest.hclonly for modules, so these do not run in CI.prettier --check,terraform fmt), README validator passesrelease-20261102.0)Live test results
4.19.0-gvisor, GitHub 200, npm blocked, PTY worksexample.com,*.wikipedia.org, 443 and 80)Kata is not tested: the Kata nodes had no free CPU, so the Pod stayed Pending.
Decisions
hashicorp/kubernetes, notMastercard/restapi: the devrel prototype used restapi because it starts faster (claim build about 0.8 s). This uses the same provider as feat: add kubernetes-agent-sandbox template to coder-labs #1230, supportsuse_kubeconfig, and is easy to mock in tests. A claim build takes about 1.6 s.kubernetes_pod_v1waits until the Pod runs.127.0.0.1, so a lookup fails at once instead of timing out against a blocked server.runtime = "none"whenruntimesis set. Without it, picking gVisor with a preset claims a prebuild and fails with "Immutable parameter changed".coder_egress_portdefaults to 0, not null, socoder templates pushdoes not ask for it.-podafter an id that is new on each start, for the VPC CNI rule grouping issue (same as feat: add kubernetes-agent-sandbox template to coder-labs #1230).Review
A Claude (Fable) review found no blockers. Fixed: DNS lookups that hung, Squid
deny managerand IPv6 literals, a proxy Pod restart on a config change,distinct()on custom ports, README accuracy (the ConfigMap, "no Pod" changes on claim, Kata numbers, a DNS limit), a stale Dockerfile comment, and more tests. Not changed: thecustom_problemsform helper, and the explicit Pod timeouts (the provider default is 5 min).Related Issues
None
🤖 This PR was generated by Coder Agents on behalf of @bpmct.