cache/informer: add type-safe informer support - #3553
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sttts The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| // TypedObject is a client.Object that can be used with the type-safe informer API. | ||
| type TypedObject interface { | ||
| client.Object | ||
| toolscache.Object |
There was a problem hiding this comment.
@sttts Could you tell your LLM to update this to just extend client.Object to be comparable to avoid all the noise?
There was a problem hiding this comment.
Done in 06b411f: TypedObject now embeds client.Object and comparable directly instead of toolscache.Object.
There was a problem hiding this comment.
Wondering if toolscache.Object absolutely has to be comparable. Because if it would not be this problem wouldn't exist
| // TypedInformer is used to provide a source of events originating inside the cluster from Watches using generic | ||
| // event handlers and predicates. | ||
| type TypedInformer[object any, request comparable] struct { | ||
| type TypedInformer[object toolscache.Object, request comparable] struct { |
06b411f to
22c8bff
Compare
|
Invalid commit message issues detected Fixup/amend/squash commitsTemporary commits like fixup!, amend!, or squash! are not allowed. Use git rebase --autosquash to fix them.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What
This ports controller-runtime informer/source wiring to the type-safe informer constructs from kubernetes/kubernetes#139821.
cache.TypedInformer,cache.NewTypedInformer, andcache.GetTypedInformer.source.Kindandsource.TypedInformerthroughTypedResourceEventHandler.Impact
This intentionally allows breaking code changes:
source.Kind/source.TypedKindobjects now need to satisfycache.TypedObject.source.TypedInformer.Informernow expectscache.TypedInformer[T].The Kubernetes module replaces point at the current head used for kubernetes/kubernetes#139821 until those APIs are available from upstream Kubernetes modules.
Validation
make testgit diff --check