Skip to content

Implement operator Phase 3: reconciler skeleton with condition state machine#8

Merged
nissessenap merged 3 commits intomainfrom
implemnt_phase3
Jan 27, 2026
Merged

Implement operator Phase 3: reconciler skeleton with condition state machine#8
nissessenap merged 3 commits intomainfrom
implemnt_phase3

Conversation

@nissessenap
Copy link
Owner

Summary

  • Implement the reconcile loop that watches AgentTask resources and manages status conditions through the full lifecycle (Pending → Running → Succeeded/Failed)
  • Add condition state machine helpers (isTerminal, hasCondition, setCondition) using k8s.io/apimachinery/pkg/api/meta
  • Use the new events.EventRecorder API (k8s.io/client-go/tools/events) via mgr.GetEventRecorder() instead of the deprecated record.EventRecorder
  • Use RequeueAfter instead of deprecated Requeue: true (controller-runtime v0.23+, PR #3107)
  • Add comprehensive unit tests (testify, table-driven) for all helpers and envtest integration tests for the reconciler
  • Update implementation plan to reflect events API changes and mark Phase 3 criteria as complete

Test plan

  • make test passes — 91.7% controller coverage
  • go vet ./... clean
  • Unit tests cover isTerminal, hasCondition, setCondition with all condition states
  • envtest: creating AgentTask sets Pending condition
  • envtest: Succeeded/Failed tasks are not re-reconciled
  • envtest: non-existent resource returns no error
  • envtest: second reconcile of pending task does not re-initialize condition

🤖 Generated with Claude Code

nissessenap and others added 3 commits January 27, 2026 22:48
…machine

Implement the reconcile loop for AgentTask resources:
- Fetch AgentTask, skip terminal states (Succeeded/Failed)
- Initialize Pending condition on first reconcile
- Use events.EventRecorder (new API via mgr.GetEventRecorder)
  instead of deprecated record.EventRecorder
- Use RequeueAfter instead of deprecated Requeue field

Add unit tests (testify) for isTerminal, hasCondition, setCondition
helpers and envtest integration tests for the full reconcile flow.

Update plan phases 4-5 to use events.Eventf and RequeueAfter.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add debug log for terminal task skip to aid operational tracing
- Add comment explaining RequeueAfter usage (Requeue deprecated in
  controller-runtime v0.23+, PR #3107)
- Use suite-level ctx consistently in tests, remove unused context import

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nissessenap nissessenap merged commit b4cbafc into main Jan 27, 2026
2 checks passed
@nissessenap nissessenap deleted the implemnt_phase3 branch January 27, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant