-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable the reuse of cached informers on creation by SharedInformerFactory
.
#3856
base: master
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Sud0x67 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @Sud0x67! |
/test |
@Sud0x67: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
@k8s-ci-robot /test |
@k8s-ci-robot /easycla |
@k8s-ci-robot /check-cla |
1 similar comment
@k8s-ci-robot /check-cla |
a9ecf71
to
8973a20
Compare
util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java
Show resolved
Hide resolved
Hi @brendandburns , Thanks for your feedback, which primarily focuses on maintaining compatibility and preserving default behaviors. As discussed in this issue, the default behaviors can sometimes be confusing. However, within this pull request, all default behaviors have been retained except for introducing a boolean parameter in the constructor SharedInformerFactory(ApiClient client, ExecutorService threadPool, boolean reuseCache). To maintain simplicity, I opted not to add an overloaded constructor method like SharedInformerFactory(ApiClient client, ExecutorService threadPool) with reuseCache set to false. I'd appreciate your thoughts and any other suggestions you might have on this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Hey @yue9944882 @brendandburns, it looks like there aren't any more questions on this PR. Could you please approve it? Thanks! |
This PR introduces a new constructor parameter,
reuseExistingCachedInformer
, to the SharedInformerFactory.The aim is to facilitate the reuse of existing cached informers when creating informers through SharedInformerFactory.
Currently, SharedInformerFactory caches only the first informer created for each API type. Developers who wish to avoid creating a new informer each time must first call SharedInformerFactory#getExistingSharedIndexInformer before proceeding with creation.
By setting reuseExistingCachedInformer to true, SharedInformerFactory will automatically reuse existing cached informers instead of creating new ones. This approach simplifies the process and clearly indicates whether to utilize the cached factory, thereby reducing potential confusion.
The discussion can be found here Issue