Skip to content

Operator: Reconciler implementation, status reporting, and tests #29

@fmallmann

Description

@fmallmann

Parent Issue

Part of #27

Description

Implement the full reconciliation logic with all resource generation, status management, and test coverage.

Scope

ConfigMap generation

  • Serialize inline scenarios to experiment.json ConfigMap
  • Create placeholder ConfigMap for dataset mode (populated by setup phase)

TestWorkflow generation

  • Build TestWorkflow spec chaining phase templates (setuprunevaluatepublishvisualize)
  • Conditionally include setup-template only when spec.dataset is set
  • Skip setup and inject experiment.json via ConfigMap when spec.scenarios is set

TestTrigger generation

  • Create TestTrigger when spec.trigger.enabled: true, watching the Deployment derived from agentRef
  • Delete/skip TestTrigger when disabled or omitted

Config parameter mapping

  • Resolve agentRef to agent URL (Agent CR status or service DNS)
  • Pass llmAsAJudgeModel into experiment JSON
  • Inject OTEL endpoint from cluster ConfigMap (otel-config)

Ownership & garbage collection

  • Set ownerReferences on all generated resources (ConfigMap, TestWorkflow, TestTrigger)
  • Verify cascade deletion works correctly

Status reporting

  • Update Ready and WorkflowReady conditions on the Experiment CR after each reconciliation
  • Track generated resource names in status.generatedResources

Validation webhook (stretch)

  • Reject CRs with both dataset and scenarios set
  • Validate agentRef references an existing Agent CR

Tests

  • Unit tests for reconciliation logic (envtest or mocked client)
  • Unit tests for trigger creation/deletion logic and status updates
  • CRD validation tests (invalid thresholds, missing required fields)
  • E2E test: create Experiment CR → verify ConfigMap, TestWorkflow, TestTrigger generated → delete CR → verify cascade deletion
  • golangci-lint passing

Acceptance Criteria

  • Creating an Experiment CR generates ConfigMap + TestWorkflow + (optional) TestTrigger
  • Updating an Experiment CR updates generated resources accordingly
  • Deleting an Experiment CR cascades deletion via ownerReferences
  • TestWorkflow correctly chains phase templates based on data source mode
  • Agent URL resolved from agentRef
  • Experiment JSON correctly serialized into ConfigMap from inline scenarios
  • TestTrigger created/deleted based on spec.trigger.enabled
  • Status conditions and generatedResources updated after reconciliation
  • Unit tests and E2E test passing
  • golangci-lint passing

References

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions