Documentation
¶
Index ¶
- func BuildOpenclawConfig(proxyBaseURL, proxyToken, gatewayToken string, weixinEnabled bool) string
- func BuildOpencodeConfig(baseConfig, proxyToken string) string
- func ExtractProxyBaseURL(configJSON string) string
- type Config
- type Manager
- func (m *Manager) CleanOrphans(knownSandboxNames []string, namespaces []string)
- func (m *Manager) Close() error
- func (m *Manager) Get(id string) (process.Process, bool)
- func (m *Manager) Pause(id string) error
- func (m *Manager) Resume(id, sandboxName, command string, args []string) (process.Process, error)
- func (m *Manager) ResumeContainer(id string) error
- func (m *Manager) ResumeContainerWithIP(id string) (string, error)
- func (m *Manager) Start(id, command string, args, env []string, opts process.StartOptions) (process.Process, error)
- func (m *Manager) StartContainer(id string, opts process.StartOptions) error
- func (m *Manager) StartContainerWithIP(id string, opts process.StartOptions) (string, error)
- func (m *Manager) Stop(id string) error
- func (m *Manager) StopBySandboxName(namespace, sandboxName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildOpenclawConfig ¶
BuildOpenclawConfig returns the openclaw.json content with gateway settings and optional Anthropic proxy credentials. The gatewayToken is written into gateway.auth.token so that the gateway and Control UI share the same secret; without this, OpenClaw v2026.3.12+ auto-generates a random token on startup that won't match the token our proxy injects.
func BuildOpencodeConfig ¶ added in v0.13.0
BuildOpencodeConfig merges the per-sandbox proxy token into the base opencode config JSON. The proxyBaseURL is already expected to be in the base config (provider.anthropic.options.baseURL). This function only injects the per-sandbox apiKey.
func ExtractProxyBaseURL ¶ added in v0.13.0
ExtractProxyBaseURL extracts provider.anthropic.options.baseURL from the opencode config JSON. Used by sandbox managers that need the proxy URL (e.g. for openclaw config).
Types ¶
type Config ¶
type Config struct {
AgentserverNamespace string
Image string
SessionStorageSize string
StorageClassName string
RuntimeClassName string
OpencodePort int
OpencodeConfigContent string // JSON config injected via OPENCODE_CONFIG_CONTENT
OpenclawImage string
OpenclawPort int
OpenclawRuntimeClassName string
OpenclawWeixinEnabled bool
}
Config holds configuration for the K8s sandbox backend.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config populated from environment variables with sensible defaults.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages Sandbox CRs and remotecommand exec sessions.
func NewManager ¶
NewManager creates a sandbox Manager using in-cluster or KUBECONFIG config.
func (*Manager) CleanOrphans ¶
CleanOrphans deletes Sandbox CRs labelled managed-by=agentserver that are NOT in the known set. It iterates all provided workspace namespaces.
func (*Manager) Resume ¶
Resume scales the sandbox back to 1, waits for ready, and starts a new exec.
func (*Manager) ResumeContainer ¶
ResumeContainer scales a paused sandbox back to 1 replica and waits for it to be ready, without starting an exec session (the sidecar handles exec). Returns the pod IP.
func (*Manager) ResumeContainerWithIP ¶
ResumeContainerWithIP scales a paused sandbox back to 1 replica and returns the pod IP.
func (*Manager) StartContainer ¶
func (m *Manager) StartContainer(id string, opts process.StartOptions) error
StartContainer for K8s sandbox creates the Sandbox CR and waits for it to be ready. Returns the pod IP for agent server communication.
func (*Manager) StartContainerWithIP ¶
StartContainerWithIP creates/starts the sandbox and returns the pod IP.
func (*Manager) StopBySandboxName ¶
StopBySandboxName deletes a Sandbox CR by its name in the given namespace.