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

Support a SharedInformer API #1384

Closed
skonto opened this issue Mar 4, 2019 · 11 comments · Fixed by #1728
Closed

Support a SharedInformer API #1384

skonto opened this issue Mar 4, 2019 · 11 comments · Fixed by #1728
Assignees
Labels
Projects

Comments

@skonto
Copy link

skonto commented Mar 4, 2019

I think it would be valuable to support such an API as it exists in the go client for writing Operators in Java.

@skonto
Copy link
Author

skonto commented Apr 19, 2019

@rohanKanojia how hard would be to do this and keep things in sync with the go client (if needed). Any thoughts?

@ljnelson
Copy link
Contributor

In the meantime you can see https://github.com/microbean/microbean-kubernetes-controller.

@tony-shi
Copy link

tony-shi commented May 8, 2019

I think kubernetes-client is a pretty good start. But it seems it lacks the support to CRD.
It would be awesome if this support natively so we no need to handle list and watch loop by ourselves.

@rohanKanojia
Copy link
Member

it supports CRDs

@rohanKanojia
Copy link
Member

Are you talking about this client or official client?

@tony-shi
Copy link

tony-shi commented May 8, 2019

Are you talking about this client or official client?
I mean the offical client's crd support seems not plain forward like this client does. But it has a informer support. Sorry for the ambiguity.

@rohanKanojia
Copy link
Member

@tony-shi : Hmm, for first draft what kind of util methods would we want to have for sharedinformer api?

@tony-shi
Copy link

I'm not a K8S pro, but from my perspective and my current use case, I think the most fundamental needs of using k8s is the caching ability.

It would be better if we have a java Reflector to automatic list the Resources in a loop, and a DeltaFIFO to de-couple the event producer and event consumer which known as cache.
The time we have a useful cache, at least we have no need to query the api-server for frequently changed resource. After this fundamental list and watch mechanism has been build natively by fabric8io/kubernetes-client, we may add indexer, Informer/SharedInformer and Controller template feature upon it.

For what i have known, the official client have such utils, but we may need to do some hack when we are using crds, since it it based on code generator. Also it is not support all the features such as add your customized indexer (at least not for now) which available in client-go . In the last, the most important thing is the way to using the official client is not quiet user friendly compared to Fabric8io/kubernetes-client.

We have see some quiet friendly packages and scaffolds such as kubebuilder and apiserver-builder, however they seems all based on go language.

Adding the caching ability then implement a user friendly Reconciler/Controller pattern would let more java users to build more sophisticated controllers/operators in their familiar ways.

So maybe we need to implement it like below:

  1. basic list and watch mechanism support, DeltaFIFO, reflector and simple cache.
  2. Informer mechanism for user customization, which may include Informer, SharedInformer, EventHandler.
  3. Prebuilt reconciler or controller pattern based on features before.

@ljnelson
Copy link
Contributor

Seriously: have you looked at https://github.com/microbean/microbean-kubernetes-controller? There might be some ideas there. I wrote a blog series on it, too: https://lairdnelson.wordpress.com/2018/01/07/understanding-kubernetes-tools-cache-package-part-0/. Let me just say: it’s not trivial. It is unclear to me whether it should be part of this project given its otherwise narrow focus.

@rohanKanojia
Copy link
Member

@ljnelson : Hmm, ok. let me go through your blog today and see whether it makes sense to have it here or not.

@stale
Copy link

stale bot commented Aug 12, 2019

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Project FKC
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants