Skip to content

Deploying the Code-node sandbox

The Code node (T30, Code node) runs user Python in Pyodide inside Deno with every permission denied. Pyodide is not a security boundary, so multi-tenant deployments add a second layer.

sandbox.mode Profiles How
deno-in-worker vpc, onprem (default) the worker starts Deno as a subprocess under its guardian (time, CPU, memory, output); Deno and the Pyodide bundle ship in the worker image
ephemeral-pod saas-eu (required) one Kubernetes Job per execution in the namespace dx-sandbox, on the gvisor RuntimeClass

deno-in-worker is less isolated (one tenant per installation): a Deno or V8 escape reaches the worker. Use ephemeral-pod whenever the people writing transforms are not the operators.

ephemeral-pod

For each execution the worker runs python -m extractit.ops.sandbox_job, which creates (with the Kubernetes API, no client library):

  • a Job from the sandbox-runner image (pinned by digest in images.yaml) with runtimeClassName = sandbox.runtimeClassName, automountServiceAccountToken: false, Pod Security restricted, CPU and memory requests and limits (sandbox.limits, capped by a LimitRange), activeDeadlineSeconds = the node's time limit and ttlSecondsAfterFinished: 60;
  • the request Secret, owned by the Job (garbage-collected with it).

It waits for the pod, copies its log (the runner's framed answer) and deletes the Job; the worker's guardian deletes it too when the wall-time limit passes, and Kubernetes kills the pod at activeDeadlineSeconds anyway. The namespace has a deny-all NetworkPolicy (no ingress, no egress) and a ResourceQuota (sandbox.limits.maxConcurrentPods). The worker's Role there allows only Jobs (create, get, list, watch, delete), pods and their logs (read) and Secrets (create, delete, patch); allow the worker to reach the API server with networkPolicy.apiServerCIDRs.

gVisor

The chart can create the RuntimeClass (sandbox.createRuntimeClass: true, handler runsc, scheduled on nodes labelled sandbox.extractit.dev/runsc=true), but installing runsc on the nodes is the cluster operator's job. With sandbox.requireRuntime: true (saas-eu) helm install fails with a clear message when no node carries the label or the RuntimeClass is missing.

Verification: the render with values-saas-eu.yaml declares runtimeClassName: gvisor (tests/ops/test_ops_chart.py); deploy/tests/sandbox_test.sh runs the Jobs in kind on the default runtime (kind has no gVisor) and checks the refusal; the run on runsc itself belongs to a nightly job on a cluster with gVisor nodes (T30's gvisor CI job covers the Docker runsc path).