-
Notifications
You must be signed in to change notification settings - Fork 2k
Java informer portal implementation #461
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
Java informer portal implementation #461
Conversation
SharedInformerFactory factory = new SharedInformerFactory(); | ||
|
||
// Node informer | ||
ClusterScopeInformer<V1Node> nodeInformer = factory.informerForClusterScopeResource(V1Node.class); |
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.
example stands out here @mbohlool @brendandburns
4f99714
to
5ee6189
Compare
Thanks for starting this PR! Can I get a quick doc added that gives a high-level guide to the approach here? It doesn't seem to me like forking the http-gson code is sustainable (or necessary) but I'm probably not fully thinking about the problem correctly. |
94ec012
to
1b0be5b
Compare
So when I had thought about this, I had thought about using Generics and some interfaces to build a single Informer object. I think that it is do-able, and much cleaner than code gen. Happy to send you my sketch. |
@brendandburns sure, am all ears. where the link? 👍🏻 |
@yue9944882 Here's the rough sketch: It's an implementation of a ListWatch cache, but it would be easy to add event handlers to implement a generic Informer.... |
367bcbd
to
c3f4ba4
Compare
5be4d59
to
7bf882b
Compare
@@ -139,8 +139,8 @@ | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-compiler-plugin</artifactId> | |||
<configuration> | |||
<source>1.7</source> | |||
<target>1.7</target> | |||
<source>8</source> |
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.
lambda is supported since java8
/hold cancel |
7bf882b
to
4029c6d
Compare
@brendandburns here's a brief note about our informer https://docs.google.com/document/d/1HFOcs39oTD3g-cBuWyLd5QaevPg6omCBWnCbPV5JvBg/edit |
politely bumping this thread @brendandburns |
Sorry, didn't realize this PR was still active, I will review ASAP... |
examples/src/main/java/io/kubernetes/client/examples/CacheExample.java
Outdated
Show resolved
Hide resolved
util/src/main/java/io/kubernetes/client/informer/cache/Deltas.java
Outdated
Show resolved
Hide resolved
util/src/main/java/io/kubernetes/client/informer/cache/Deltas.java
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
public enum DeltaType { |
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.
This feels like a duplicate of EventType?
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.
no, it isn't. delta type represents an inner state of the queuing items which has one more type "Sync" comparing to event type. while event type is exposed as a part of the informer's public API.
util/src/main/java/io/kubernetes/client/informer/cache/function/IndexFunc.java
Outdated
Show resolved
Hide resolved
util/src/main/java/io/kubernetes/client/informer/cache/function/KeyFunc.java
Outdated
Show resolved
Hide resolved
util/src/main/java/io/kubernetes/client/informer/cache/function/PopProcessFunc.java
Outdated
Show resolved
Hide resolved
util/src/main/java/io/kubernetes/client/informer/cache/function/ResyncFunc.java
Outdated
Show resolved
Hide resolved
util/src/main/java/io/kubernetes/client/informer/exception/EmptyDeltasException.java
Outdated
Show resolved
Hide resolved
util/src/main/java/io/kubernetes/client/informer/impl/DefaultSharedIndexInformer.java
Outdated
Show resolved
Hide resolved
Many thanks for the tests! I added a few more comments about reducing the number of custom classes in the implementation so that it's easier to understand. |
util/src/main/java/io/kubernetes/client/informer/impl/DefaultSharedIndexInformer.java
Outdated
Show resolved
Hide resolved
07e30df
to
7c3533e
Compare
Thanks for all the changes and the patience. Add the TODO and this is LGTM and ready to merge. |
util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java
Show resolved
Hide resolved
so glad to see this get merged @yue9944882 @brendandburns as a follow up we could help build more utility, like work-queue, leader election. Let's just get this Java informer framework fully functional. |
7c3533e
to
296e569
Compare
@adohe do you want me to wait on an LGTM from you before I merge? Otherwise, I think this is good to go... |
overall lgtm. Let's just get it merge @brendandburns |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, yue9944882 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Gopher testing
Plz ignore any funny part in this pull if u notice 🙂Nvmd, i will revert later
Also, am opening a consumer part of this pull at k/gen repo
/hold