backend

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package backend selects a sandbox provider by name, so the executor and the BYOC worker construct Docker or Kubernetes "hands" from the same config point instead of hard-coding one. Both binaries are thin glue around this: they map their environment to a Config and call New.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (sandbox.Provider, error)

New builds the named sandbox provider, or an error naming the accepted set.

Types

type Config

type Config struct {
	Backend string // "docker" (default) or "k8s"

	// GateTokenRevoker is handed to whichever backend is selected: Reap revokes
	// a session's gate token before removing its containers (#197). The
	// executor supplies a pool-backed implementation; the BYOC worker, which
	// has no database, leaves it nil and Reap skips revocation.
	GateTokenRevoker sandbox.GateTokenRevoker

	// docker: empty Host falls back to DOCKER_HOST and then the well-known socket.
	DockerHost string
	// docker: the network a session's egress-gate container joins (the deploy
	// network reaching the control plane and the outside). Empty defaults to
	// "bridge". Unused for ungated sessions.
	DockerGateNetwork string

	// k8s: empty Kubeconfig and Context use in-cluster config (the executor
	// running as a Deployment), then the standard kubeconfig loading rules.
	K8sKubeconfig    string
	K8sContext       string
	K8sNamespace     string
	K8sNetSetupImage string
	// k8s: the RuntimeClass sandbox pods run under (a hardened runtime such as
	// gVisor's runsc). Empty uses the cluster default. Docker has no analogue —
	// a runtime there is a daemon-level choice, not a per-container one.
	K8sRuntimeClass string
	// k8s: where sandbox pods may run — a comma-separated key=value node
	// selector and a JSON array of tolerations. Both are raw here and parsed by
	// the k8s provider, which rejects a malformed value at startup; a dedicated,
	// tainted sandbox node pool needs both halves. Docker has no analogue.
	K8sNodeSelector string
	K8sTolerations  string
	// k8s: the Secrets sandbox pods pull images with, comma-separated — raw here
	// and parsed by the k8s provider like placement. No Docker counterpart is
	// wired: the engine takes per-request client auth (X-Registry-Auth), which
	// the platform's anonymous pull does not send, so a private image there must
	// already be on the host.
	K8sImagePullSecrets string
}

Config names the backend and carries each one's settings; only the selected backend's fields are read. An empty Backend defaults to docker — the v1 backend — so a deployment that predates this selection keeps working with no new configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL