controller

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ArmingStartupGuardWindow = 30 * time.Second

ArmingStartupGuardWindow (design 0061 §3): the bounded startup window within which enabled=true must reach armed state — the startup guard's existing 30s budget, named here as the design's constant (no new timer machinery; the guard's context construction reads THIS). A const (r3): the window is a design-fixed budget, not a tunable.

View Source
const RelayStagingNotArmedExitCode = 85

RelayStagingNotArmedExitCode (design 0061 §3, M1 — crash-loud arming): the controller's distinct exit code for "deployed relay-only but not armed" — the fifth rung of the fail-closed doctrine's ladder (81/82: agentd verify; 83/84: opencode verify; 85: relay staging not armed). A CrashLoop with this code is one describe-pod away from its reason; the enable line ("relay-only key delivery enabled") is the armed contract its absence betrays. The #1548 split-brain (an inert staging binary booted green while workspaces starved) is the class this code makes undeployable.

Variables

This section is empty.

Functions

func RegisterAgentRuntime added in v0.14.2

func RegisterAgentRuntime()

RegisterAgentRuntime is called from controller main to register the opencode agent runtime. The actual opencode.Register() call happens in the controller main package (the allowed construction layer).

func RelayStagingExitCodeFor added in v0.34.8

func RelayStagingExitCodeFor(err error) int

RelayStagingExitCodeFor maps a SetupRelayStaging outcome to the controller's exit code — the decision seam the 81–84 ladder's opencodeOverlayDecision precedent sets (a RETURNED code, unit-asserted, not an inlined os.Exit in an untestable main). One code, one meaning: ANY error while enabled is "deployed relay-only but not armed" → 85 (the design §3 armed conjunction: flags valid → constructed → guard green — a failure at any rung is not-armed).

func SetupControllers

func SetupControllers(mgr ctrl.Manager, inferenceRelayURL, apiServiceURL, apiPublicURL, apiInternalToken, defaultRuntimeClass, previewOriginBaseDomain string, uploadStaging workspace.UploadStagingConfig, agentdDelivery AgentdDelivery, opencodeDelivery OpencodeDelivery, agentdSidecarEnabled bool, maxConcurrentReconciles int, relayStaging *workspace.RelayStagingConfig, workspaceTerminationGrace int64) error

func SetupRelayController

func SetupRelayController(mgr ctrl.Manager, namespace, routerURL string, enableRelay bool, artifact RelayArtifactConfig) error

SetupRelayController registers the InferenceRelay reconciler and the orphan detector (the periodic safety net that catches cloud VMs whose owner CR has gone away). It is feature-gated and only activated when enableRelay is true.

func SetupRelayStaging added in v0.34.4

func SetupRelayStaging(mgr ctrl.Manager, enabled bool, routerURL, namespace string, tokenTTL time.Duration, apiServiceURL, apiInternalToken string) (*workspace.RelayStagingConfig, error)

SetupRelayStaging constructs the US-72.3 relay staging config from the deployment flags and runs the FAIL-LOUD startup guard (the rbac.scope=cluster gate precedent): enabled without a reachable, bootstrapped router is a deployment misconfiguration that must surface at boot. Returns (nil, nil) when the flag is off — zero behavior change. The direct (non-cached) client is used because the manager's cache is not started this early, and the llm-relay namespace may sit outside the controller's watch scope.

Types

type AgentdDelivery added in v0.15.8

type AgentdDelivery = workspace.AgentdDeliveryConfig

AgentdDelivery is the #863 image-volume agentd delivery configuration. Zero value (empty Image) = legacy baked-in mode. When set, every workspace pod gets a digest-pinned image volume + RO mount + sha256 verify pins; validateAgentdDeliveryConfig enforces the all-or-nothing contract at startup.

type OpencodeDelivery added in v0.25.5

type OpencodeDelivery = workspace.OpencodeDeliveryConfig

OpencodeDelivery is the design 0053 §4.2 image-volume opencode delivery configuration. Zero value (empty Image) = baked-in mode (S1 default, opt-in). When set, every workspace pod gets a digest-pinned image volume + RO mount (workspace container only) + sha256 verify pins; validateOpencodeDeliveryConfig enforces the all-or-nothing contract at startup.

type RelayArtifactConfig

type RelayArtifactConfig struct {
	// URLs are the base mirror URLs (cloud-init appends "/<binary>"). At least
	// one is required; multiple provide cross-cloud resilience.
	URLs []string
	// SHA256Arm64 is the hex SHA-256 of the arm64 relay-proxy binary.
	SHA256Arm64 string
	// SHA256Amd64 is the hex SHA-256 of the amd64 relay-proxy binary.
	SHA256Amd64 string
}

RelayArtifactConfig holds the relay-proxy binary distribution settings the controller embeds into each relay VM's cloud-init. All fields are required when the relay controller is enabled: a VM without a download path produces a structurally provisioned but non-functional relay (systemd unit references a binary that never arrives).

Jump to

Keyboard shortcuts

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