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
- func Branch(r *v1alpha1.AgentRun, runID string) string
- func CAConfigMap(r *v1alpha1.AgentRun, ca []byte) *corev1.ConfigMap
- func Labels(r *v1alpha1.AgentRun, runID string) map[string]string
- func NetworkPolicy(r *v1alpha1.AgentRun, c Config, m Model, runID string) *unstructured.Unstructured
- func Observe(prev v1alpha1.AgentRunStatus, revoked string, pod *corev1.Pod, podGone bool, ...) v1alpha1.AgentRunStatus
- func Pod(r *v1alpha1.AgentRun, c Config, m Model, runID string) *corev1.Pod
- func RevokeEnds(revoked string) bool
- func Rules(r *v1alpha1.AgentRun, runID string) string
- func ServiceAccount(r *v1alpha1.AgentRun) *corev1.ServiceAccount
- func TaskConfigMap(r *v1alpha1.AgentRun, runID string) (*corev1.ConfigMap, error)
- type Broker
- type Config
- type Images
- type Model
- type Reconciler
Constants ¶
const ( NetworkPolicyCilium = "cilium" NetworkPolicyNone = "none" )
The values of Config.NetworkPolicy.
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.
const ( BridgeHealthPort = 8085 HarnessPort = 8000 )
The composition's constants (crossplane-configuration v0.9.15).
Variables ¶
This section is empty.
Functions ¶
func CAConfigMap ¶
CAConfigMap is <run>-ca: the broker's CA, which the bridge verifies :8443 against.
func Labels ¶
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 ¶
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 ¶
RevokeEnds reports whether the revoke annotation's value ends the run.
func Rules ¶
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.
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 ¶
LoadConfig reads, strictly decodes, defaults and validates the file at path.
func (Config) FQDNs ¶
FQDNs are the hosts the run may reach on 443: github, then its profiles, deduplicated.
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 ¶
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.