runctl

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package runctl is the run-controller (adoption 3a): it reconciles maku.ogenki.io AgentRuns into the pod, ServiceAccount, ConfigMaps and CiliumNetworkPolicy that cloud-native-ref's Crossplane composition builds, minus the gateway, octo-sts, traces, Kueue and suspend.

Index

Constants

View Source
const (
	NetworkPolicyCilium = "cilium"
	NetworkPolicyNone   = "none"
)

The values of Config.NetworkPolicy.

View Source
const (
	LabelRunID     = "agents.ogenki.io/run-id"
	LabelRole      = "agents.ogenki.io/role"
	LabelManagedBy = "app.kubernetes.io/managed-by"
	LabelTask      = "agents.ogenki.io/task"
)

Label keys the composition sets; the CNP selects the pod by run-id.

View Source
const (
	BridgeHealthPort = 8085
	HarnessPort      = 8000
)

The composition's constants (crossplane-configuration v0.9.15).

Variables

This section is empty.

Functions

func Branch

func Branch(r *v1alpha1.AgentRun, runID string) string

Branch is spec.branch, else agent/<runId>, as the composition defaults it.

func CAConfigMap

func CAConfigMap(r *v1alpha1.AgentRun, ca []byte) *corev1.ConfigMap

CAConfigMap is <run>-ca: the broker's CA, which the bridge verifies :8443 against.

func Labels

func Labels(r *v1alpha1.AgentRun, runID string) map[string]string

Labels are every owned object's; runID "" (the ServiceAccount, the CA ConfigMap) omits run-id.

func NetworkPolicy

func NetworkPolicy(r *v1alpha1.AgentRun, c Config, m Model, runID string) *unstructured.Unstructured

NetworkPolicy is the run's default-deny CNP: DNS for its names only, the broker on 8443 (and roomToolsURL's port when set), github and its profiles on 443, the model host on its port. Nothing dials in except the kubelet's probe of the bridge (C4).

func Observe

func Observe(prev v1alpha1.AgentRunStatus, revoked string, pod *corev1.Pod, podGone bool, now time.Time) v1alpha1.AgentRunStatus

Observe is the composition's _phaseOf and _reasonOf over a plain pod: a terminal status is final; then revocation; then the harness's exit; then the pod's failure; then a pod lost that the reconciler had created (podGone), whether or not it ever left Pending. finishedAt is always set at a terminal phase, so runwatch never falls back to the Ready condition.

func Pod

func Pod(r *v1alpha1.AgentRun, c Config, m Model, runID string) *corev1.Pod

Pod is the run's pod: the composition's Sandbox pod template without identity-proxy, octo-sts, traces, Kueue and suspend. The model key and the PAT are files the harness reads (3a R4). It is named like the run, as the Sandbox's pod is.

func RevokeEnds

func RevokeEnds(revoked string) bool

RevokeEnds reports whether the revoke annotation's value ends the run.

func Rules

func Rules(r *v1alpha1.AgentRun, runID string) string

Rules is the run's rules.md: the composition's _rulesFor without the lines that name room_* tools or the model gateway, neither of which this runtime has (3a R8).

func ServiceAccount

func ServiceAccount(r *v1alpha1.AgentRun) *corev1.ServiceAccount

ServiceAccount is named exactly like the run: the broker's run issuer maps system:serviceaccount:<ns>:<run name> to the run (C2). It holds no RBAC.

func TaskConfigMap

func TaskConfigMap(r *v1alpha1.AgentRun, runID string) (*corev1.ConfigMap, error)

TaskConfigMap is <run>-task: task.md, rules.md and run.json, as the composition writes them.

Types

type Broker

type Broker struct {
	URL       string            `json:"url"`
	Namespace string            `json:"namespace"`
	Labels    map[string]string `json:"labels"`
	CASecret  string            `json:"caSecret"`
}

Broker is where the bridge connects, and what the CNP lets it reach.

type Config

type Config struct {
	Namespace        string `json:"namespace"`
	NamePrefix       string `json:"namePrefix"`
	RuntimeClassName string `json:"runtimeClassName,omitempty"`
	// AllowUnsandboxed places pods without a RuntimeClass; each run then carries condition
	// Unsandboxed, so the room can say so (3a R5).
	AllowUnsandboxed bool `json:"allowUnsandboxed,omitempty"`
	// NetworkPolicy is "cilium" (default: each run gets a CiliumNetworkPolicy) or "none", for a
	// cluster without Cilium: no policy is created, so nothing confines a run's network.
	NetworkPolicy  string              `json:"networkPolicy,omitempty"`
	ModelSecret    string              `json:"modelSecret"`
	GitSecret      string              `json:"gitSecret"`
	Broker         Broker              `json:"broker"`
	Images         Images              `json:"images"`
	EgressProfiles map[string][]string `json:"egressProfiles,omitempty"`
	// RoomToolsURL is the broker's :8090 room tools, by broker.url's host, for a broker serving
	// roomTools.auth tokenreview. Set, a run with a room gets MCP_URL and a projected token of audience
	// room-tools for the harness alone. Unset, the harness wires no MCP server.
	RoomToolsURL string `json:"roomToolsURL,omitempty"`
}

Config is the run-controller's file, from the chart.

func LoadConfig

func LoadConfig(path string) (Config, error)

LoadConfig reads, strictly decodes, defaults and validates the file at path.

func (Config) FQDNs

func (c Config) FQDNs(r *v1alpha1.AgentRun) []string

FQDNs are the hosts the run may reach on 443: github, then its profiles, deduplicated.

func (Config) Invalid

func (c Config) Invalid(r *v1alpha1.AgentRun) string

Invalid says why the controller refuses r, or "" when it accepts it (3a R6, R7).

func (Config) RunID

func (c Config) RunID(r *v1alpha1.AgentRun) string

RunID is the run's C2 id, or "" for a name this controller does not own.

type Images

type Images struct {
	Harness string `json:"harness"`
	Bridge  string `json:"bridge"`
}

Images are the run pod's two images, pinned by the chart.

type Model

type Model struct {
	BaseURL, Name, Host string
	Port                int
}

Model is the provider the harness calls directly (3a R4), from modelSecret.

func ModelFrom

func ModelFrom(data map[string][]byte) (Model, error)

ModelFrom reads modelSecret's data: api_key and model required, base_url defaulted.

type Reconciler

type Reconciler struct {
	Client    client.Client
	APIReader client.Reader // uncached: Secrets are never listed or watched, and a cached pod NotFound is never trusted
	Cfg       Config
	Now       func() time.Time
	Log       *slog.Logger
}

Reconciler turns an AgentRun into its owned objects and reports the pod back as status. Owned objects are created once: a run's spec is immutable, so there is nothing to patch.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is idempotent: a restart reconciles every non-terminal run from scratch.

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager watches runs and the pods they own.

Jump to

Keyboard shortcuts

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