* Fix controller example to implement correct interface method
- Change ReconcileKind to Reconcile to match the Reconciler interface
- Add nil check for secretLister to handle initialization timing
- Fix OnError handler in e2e test to not fail immediately on expected errors
This allows the controller-owned-lister example to compile and run correctly.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update examples/controller-owned-lister/main.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add Lister and NamespaceLister as concrete structs (not interfaces)
- Implement cache-backed List/Get operations with type safety
- Add lister support to Inform method, returning (*Lister[T], error)
- Update controller to store owned resource listers
- Add example showing how to use listers with controllers
- Fix error logging in examples to use log.Fatal instead of log.Printf
- Fix flaky e2e test by changing OnError handler to not fail immediately
- Update WatchOwned to automatically get owner GVK from client
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This PR introduces a new controller package that provides a simple, type-safe
framework for building Kubernetes controllers. The implementation is inspired
by Knative's controller patterns but optimized for simplicity.
Key features:
- Simple reconciler interface with just one method (ReconcileKind)
- Automatic detection and persistence of object changes
- Built-in conflict resolution with retry logic
- Owner reference support for watching owned resources
- Error handling patterns (RequeueAfter, RequeueImmediately, PermanentError)
- Context-aware logging with clog integration
- Full test coverage including e2e tests
The framework handles the complexity of update detection, conflict resolution,
and status updates automatically, allowing users to focus on their business logic.
Also includes:
- Comprehensive documentation in controller/README.md
- Example controller implementation in examples/controller/
- Updates to use errors.Is pattern for error checking
- Minor refactoring to use "if err := ..." idiom where appropriate
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>