mirror of
https://github.com/imjasonh/client-go2
synced 2026-07-08 00:55:56 +00:00
Add generic controller framework inspired by Knative
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>
This commit is contained in:
parent
87b4da941a
commit
e5b7ad1a0d
18 changed files with 2711 additions and 9 deletions
2
go.sum
2
go.sum
|
|
@ -1,3 +1,5 @@
|
|||
github.com/chainguard-dev/clog v1.7.0 h1:guPznsK8vLHvzz1QJe2yU6MFeYaiSOFOQBYw4OXu+g8=
|
||||
github.com/chainguard-dev/clog v1.7.0/go.mod h1:4+WFhRMsGH79etYXY3plYdp+tCz/KCkU8fAr0HoaPvs=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue