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 (
setup → run → evaluate → publish → visualize)
- 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
References
Parent Issue
Part of #27
Description
Implement the full reconciliation logic with all resource generation, status management, and test coverage.
Scope
ConfigMap generation
scenariostoexperiment.jsonConfigMapTestWorkflow generation
setup→run→evaluate→publish→visualize)setup-templateonly whenspec.datasetis setspec.scenariosis setTestTrigger generation
spec.trigger.enabled: true, watching the Deployment derived fromagentRefConfig parameter mapping
agentRefto agent URL (Agent CR status or service DNS)llmAsAJudgeModelinto experiment JSONotel-config)Ownership & garbage collection
ownerReferenceson all generated resources (ConfigMap, TestWorkflow, TestTrigger)Status reporting
ReadyandWorkflowReadyconditions on theExperimentCR after each reconciliationstatus.generatedResourcesValidation webhook (stretch)
datasetandscenariossetagentRefreferences an existing Agent CRTests
ExperimentCR → verify ConfigMap, TestWorkflow, TestTrigger generated → delete CR → verify cascade deletiongolangci-lintpassingAcceptance Criteria
ExperimentCR generates ConfigMap + TestWorkflow + (optional) TestTriggerExperimentCR updates generated resources accordinglyExperimentCR cascades deletion via ownerReferencesagentRefspec.trigger.enabledgolangci-lintpassingReferences
deploy/local/example-workflow.yaml— current manual TestWorkflowdeploy/local/experiment.yaml— current manual ConfigMapdeploy/local/example-workflow-trigger.yaml— current manual TestTrigger