This repository was archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 276
Push all k8s clients into a layer of clients #4863
Labels
Milestone
Comments
recording an example from a recent code review, of the unforunate way in which we must currently construct these clients:
This is all to create objects that send HTTPs requests to the same API server. These should be consolidated into a single client for ease of use. Particularly, there are more clients we have access to in the code, and this is not the worst it could be |
Added default label |
4 tasks
This was referenced Jul 20, 2022
This was referenced Aug 15, 2022
@steeling can we close this issue now? |
I have one final PR i'll have out early next week |
Repository owner
moved this from In Progress
to Done
in V1.3 Refactoring
Oct 5, 2022
Repository owner
moved this from In Progress
to Done
in OSM Roadmap (dev)
Oct 5, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
We currently have ~5 flavors of kubernetes clients:
kube.Client
Instead, we should leverage "layers" of clients, such that our business logic is only aware of 1 layer. This might looks like:
As we do this, no functions should accept a client object just to make a call to that client. It should only be accepted for dependency injection. An example of this includes
GetKubernetesServerVersionNumber
. Instead, this should be calledGetServerVersionNumber
, and be a method on a k8s client.This improves our ability to decouple from k8s, and leverage interfaces. Please take a look at the guiding principles section for how we can better leverage interfaces.
The new layer for access to these clients will be:
a) Contains business logic for constructing the trafficpolicy types
b) Has no concept of anything related to K8s
c) Has an embedded compute.Interface
a) Only accepts/returns non-k8s type objects. (The exception to this is custom objects where we do not have an analogous OSM type
b) Performs translations to/from k8s type objects
c) There may be multiple instances of this, which is how we can interface outside of k8s.
a) Basic Get/Set/Update to kubernetes API
c) Maintains the informer cache
d) Has a client for each k8s kind
e) Is only aware of k8s types, is not aware of OSM types
Some nice results:
The text was updated successfully, but these errors were encountered: