-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Initial draft for SharedInformer Support #1728
Conversation
9507b3a
to
675fc5a
Compare
@@ -316,4 +319,9 @@ public SubjectAccessReviewDSL subjectAccessReviewAuth() { | |||
return new SubjectAccessReviewDSLImpl(httpClient, getConfiguration()); | |||
} | |||
|
|||
@Override | |||
public SharedInformerFactory informers() { | |||
return new SharedInformerFactory(Executors.newCachedThreadPool(), httpClient, getConfiguration()); |
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.
A new cached pool being created on every method invocation may not be a good idea, perhaps pass the ExecutorService
as a parameter? Maybe use ForkJoinPool.commonPool()
if a parameterless method is needed.
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.
+1
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.
except the stuff reported by @gastaldi , this looks good to me
import java.util.function.Supplier; | ||
|
||
/** | ||
* Controller is a generic controller framework. |
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 looks really complex. A generic framework lying in an utils package for a specific feature makes me wonder if this shouldn't belong to another package or library
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.
oh, okay. I would move it to a dedicated package while updating 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.
It looks like it was copied from https://github.com/kubernetes-client/java/blob/master/util/src/main/java/io/kubernetes/client/informer/cache/Controller.java? I wonder if we could implement this feature without these classes, otherwise it would be better to add a reference saying that it was taken from this project
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.
I'm not sure we can do that. Okay, I'll add reference.
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 all has been ported from client-go codebase(https://github.com/kubernetes/client-go/blob/master/tools/cache/controller.go). I looked into official client's code and tried to fit those in our client since we need informers too.
675fc5a
to
c8b063f
Compare
I tried writing a simple operator using this support and I was able to write it: https://github.com/rohanKanojia/podsetoperatorinjava |
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/DefaultKubernetesClient.java
Show resolved
Hide resolved
f0f2ec2
to
6fe7588
Compare
6fe7588
to
3b24072
Compare
[merge] |
Fix #1384