Skip to content
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

Merged
merged 6 commits into from
Sep 19, 2019

Conversation

rohanKanojia
Copy link
Member

Fix #1384

@@ -316,4 +319,9 @@ public SubjectAccessReviewDSL subjectAccessReviewAuth() {
return new SubjectAccessReviewDSLImpl(httpClient, getConfiguration());
}

@Override
public SharedInformerFactory informers() {
return new SharedInformerFactory(Executors.newCachedThreadPool(), httpClient, getConfiguration());
Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member

@oscerd oscerd left a 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.
Copy link
Contributor

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

Copy link
Member Author

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

Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member Author

@rohanKanojia rohanKanojia Aug 29, 2019

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.

@rohanKanojia
Copy link
Member Author

I tried writing a simple operator using this support and I was able to write it: https://github.com/rohanKanojia/podsetoperatorinjava

@rohanKanojia rohanKanojia force-pushed the pr/informers branch 2 times, most recently from f0f2ec2 to 6fe7588 Compare September 17, 2019 11:10
@rohanKanojia
Copy link
Member Author

[merge]

@fusesource-ci fusesource-ci merged commit e2a8c9f into fabric8io:master Sep 19, 2019
@manusa manusa mentioned this pull request Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support a SharedInformer API
4 participants