-
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
Creating an api module #3654
Creating an api module #3654
Conversation
Can one of the admins verify this patch? |
The next set of changes more fully refine the new interfaces - the node/pod metrics logic is a little more regular and includes a workaround for #3662 The only really big change here is the removal of RawCustomResource logic - but I have not yet converted the main test over yet, so there are build failures in kubernetes-tests. This also removed the mifmif dependency - I don't see that it's directly needed by the client logic. As you can see the api module is effectively an api + utils/commons. However as mentioned above we likely need to leave a lot of the common/util logic in place and/or it's too much effort to separate it. Additional cleanups needed:
|
220d047
to
d895afc
Compare
Disregard the previous version of this comment, I changed podmetrics to default to any namespace for consistency with the prior logic. |
9efe1d6
to
d94068a
Compare
creates interfaces for metrics, sharedinformerfactory, runoperations removes operationcontext from sharedinformerfactory removes rawoperation... completely moving the mifmif dependency to openshift-client removes duplicate patch objectmetamixin
The basic separation of both kubernetes-client and openshift-client is complete. This does not yet address repackaging things left in the client modules nor readiness, and does not yet propose an alternative way to create clients. If there's general agreement on how this works I'll continue to flesh it out. If we want to opt instead for just a http client module, let me know. |
# Conflicts: # kubernetes-client/pom.xml
Added a Kubernetes/OpenShiftClientBuilder(s) using reflection - if that is not a good choice, we can switch to a service loader, or even do like slf4j and create/remove dummy classes in the api modules. |
# Conflicts: # openshift-client/pom.xml
so we need a specialized subbuilder that is safe only for methods that can be / are called after the client is already constructed
I have a question regarding the informers' cache… If we want to change the cache directly (for optimisation purposes), how do we do it with this new API? Right now, we get the store and cast it to |
If we move toward the model of an informer only saving what state is necessary for level event handling, then modifying the cache directly shouldn't be needed. You'd maintain a separate application level cache of the full resources.
It wasn't directly available before these changes - the Store/Indexer interfaces did not allow for modifications, you already have to cast to Cache.
This seems like it would need to be done very carefully. If you don't lock modifications on the resourceVersion, locking on the cache is not sufficient:
The cache is eventually consistent, but there can be incorrect intermediate events. I'm honestly not sure if you can simply compare resourceVersions to discard events like these, but if you did then the event stream would have events missing - there would be no proper emitting of the update from v1 to v2. With resourceVersion locking:
It seems like the logic adding v3 to the cache would need to track what the expected entry revision is. If not's not v2, then you can't add v3. It seems like there are a lot of application level concerns and assumptions about consistency that the informer must take on or expose. |
...nt/src/main/java/io/fabric8/kubernetes/client/informers/impl/DefaultSharedIndexInformer.java
Show resolved
Hide resolved
Review comments/notesCommit
|
That interface simply takes the place of a class with the same name. There's nothing new from an api perspective - but yes new/additional docs never hurt. |
Yes, I know. Those are just reminders for possible improvements. Since this is now an Interface, it makes sense to document it properly (not that it didn't make sense before too). |
Yes, I'm not convinced that reflection is appropriate either - #3654 (comment) This was more to propose something that would logically take the place of direct access to the constructors. We can even back that out for now to be refined as a separate issue. |
I think we can leave it for now and reevaluate, discuss for a subsequent PR. Despite my personal preference for an SPI approach to achieve this, wouldn't this reflection procedure be problematic for Quarkus Native? |
The complication with the service loader:
|
I haven't give it a thought. I think the confusion here lies on what we're calling a "client" and what does the SPI provide. Probably we are referring to different things In this PR you introduce the Builder pattern for creating instances of KubernetesClient (DefaultKubernetesClient/DefaultOpenShiftClient). I still need to understand how does this play with https://github.com/shawkins/httpclient What I mean is that the underlying implementation of the HttpClient should be retrievable via ServiceLoader. A valid implementation should then be loaded depending on what there is in the runtime classpath. |
Yes they are somewhat separate concerns. Here's the thoughts on the HttpClient:
The plan was to address this as part of the work to bring in the jdk implementation. |
Sounds good, more or less aligned with what I was thinking. Anyway, maybe we could sync on this (I'll reach out to you internally) because there are things that I'm not fully grasping. |
SonarCloud Quality Gate failed. 7 Bugs |
@manusa PodIT.evict seems to be a flaky test, I can get it to fail locally as well - but only sometimes. |
I'm aware 😅. We need to do something with this test and the Karat, I hate this situation. |
Description
start at #3645 - adding a kubernetes-client-api
removes operationcontext from sharedinformerfactory
removes rawoperation... completely
creates interfaces for metrics
does not yet address OpenShift, DefaultKubernetesClient, and uses reflection for loading okhttp client.
Type of change
test, version modification, documentation, etc.)
Checklist