Documentation
¶
Overview ¶
Package evaluation runs the remote-evaluation engine: the gate reconciler expands each immutable Evaluation into its EvaluationUnit children, the unit reconciler schedules them through the sandboxed agent-Job machinery with bounded concurrency and collects each pod's EVOLVE-EVENT stream onto unit statuses (full-fidelity entries into per-unit ConfigMaps), and the TTL loop deletes finished evaluations after their retention. An Evaluation's phase is derived from its children's. This package is the single writer for both kinds, so no transition table is involved.
Index ¶
Constants ¶
const DefaultTTL = 72 * time.Hour
DefaultTTL retains a finished Evaluation for three days: long enough for the submitting client to reconnect and reassemble results after a weekend, short enough that etcd never accumulates finished batches.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GateReconciler ¶
type GateReconciler struct {
client.Client
Namespace string
// EnabledHarnesses is the evolve-runner fleet resolved at startup.
EnabledHarnesses []string
Now func() time.Time
Log *slog.Logger
}
GateReconciler expands a new Evaluation into its EvaluationUnit children. Creation is idempotent (deterministic names, AlreadyExists adopted), so a crashed expansion resumes where it stopped. Units whose harness preference list has no overlap with the enabled fleet are settled immediately as Failed/HarnessUnavailable, never silently dropped.
func (*GateReconciler) Reconcile ¶
Reconcile creates missing children and moves the parent to Running.
func (*GateReconciler) SetupWithManager ¶
func (r *GateReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the gate.
type Runner ¶
type Runner interface {
CreateEval(ctx context.Context, spec jobs.EvalSpec) (string, error)
ResultLines(ctx context.Context, jobName string, fn func(line []byte) error) error
Status(ctx context.Context, jobName string) (jobs.Status, error)
Delete(ctx context.Context, jobName string) error
}
Runner is the jobs surface the unit reconciler needs; satisfied by *jobs.Client.
type TTLReconciler ¶
type TTLReconciler struct {
client.Client
Namespace string
// TTL is the default retention. 0 keeps forever; <0 means DefaultTTL.
// spec.ttlSecondsAfterFinished overrides per evaluation.
TTL time.Duration
Now func() time.Time
Log *slog.Logger
}
TTLReconciler deletes finished Evaluations after their retention; deletion cascades to units, Jobs (via the unit finalizer), and results ConfigMaps. Expiry is deletion, not a phase.
func (*TTLReconciler) SetupWithManager ¶
func (r *TTLReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the TTL loop.
type UnitReconciler ¶
type UnitReconciler struct {
client.Client
Runner Runner
Workspaces WorkspaceStat
Namespace string
// MaxConcurrent bounds simultaneously Running units (default 4).
MaxConcurrent int
// EnabledHarnesses is the evolve-runner fleet resolved at startup.
EnabledHarnesses []string
// ArtifactBaseURL is the public artifact endpoint agent pods fetch
// bundles from, e.g. http://patchy-source-controller.patchy.svc:9790.
ArtifactBaseURL string
Now func() time.Time
Log *slog.Logger
}
UnitReconciler schedules EvaluationUnits into agent Jobs with bounded concurrency and collects their results. Slot accounting comes from the cluster, never memory.
func (*UnitReconciler) Reconcile ¶
Reconcile handles both the singleton scheduling request and per-object runs.
func (*UnitReconciler) SetupWithManager ¶
func (r *UnitReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the unit reconciler: every unit and evaluation Job event also fans into the singleton scheduler request.