-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Client package proposal #15730
Client package proposal #15730
Conversation
GCE e2e build/test failed for commit 50ca09edc2bb31dcb9bbda0ff7bb924fab7e0b29. |
Labelling this PR as size/L |
Extensions() ext_v1beta1.Client | ||
Net() net_v1beta1.Client | ||
|
||
GroupVersion(group, version string) generic.Client |
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.
What is this for?
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.
Nevermind, I see it in next paragraph.
/sub |
somewhere. It consumes a Config object with options appropriate for this. | ||
(That's most of the current client.Config structure.) | ||
|
||
Third parties (e.g., open shift) may have their own implementation. |
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.
OpenShift
abstain from commenting the same through doc
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 figured someone would correct me, I just didn't know what to--I will fix. ;)
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 don't think we want Openshift or other clients to have their own implementation. I believe transport is generic to "Kube-like" APIs - standard auth, security, behavior, and other patterns. A kube like API should be able to use the Kube like transport
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.
OK-- I think I interpreted your comments in the previous discussion at the wrong level of meta. See if you agree now.
@lavalamp - I am interested in also defining a client pattern that lets me take an APIResource and perform generic ObjectMeta oriented LIST, DELETE(item) request/response. use case is for namespace controller to allow generic deletion pattern:
so this client would know how to build URL paths given arbitrary APIResource definition. thoughts? |
@derekwaynecarr I absolutely think we should support that, and I think that falls well within the scope of what I've imaginatively called the generic client. We can also extend the things like runtime.Unknown/Unstructured to provide metadata manipulation abilities for arbitrary (api-conforming) objects. |
for executing discovery commands. The group and version may be overridable with | ||
a function call. | ||
|
||
RESTClients may have semantic information built in. For example, if the |
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.
Couldn't this be accomplished at the transport layer? Currently you can provide your own transport or even provide something that wraps a transport. I imagine this RESTClient could just consume a transport that does this?
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's possible, but I'm imagining a different RESTClient per group/version, with all of them sharing a common Transport. We do want to cache & reuse transports if possible, on account of http connection reuse.
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 should be relatively simple to wrap a shared transport for different clients. HTTPWrappersForConfig does this already.
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.
As Clayton points out, we should keep as much semantic info in the Codec as possible.
Thanks for the comments everyone-- I will update accordingly, perhaps on Monday. |
I'll try and take a look before Monday. On Oct 16, 2015, at 5:41 PM, Daniel Smith notifications@github.com wrote: Thanks for the comments everyone-- I will update accordingly, perhaps on — |
appropriate query parameter when you call the "LabelSelector()" method. | ||
|
||
3rd parties such as open shift may provide their own implementation, but it | ||
should conform to the same interface as the standard RESTClient. |
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.
Again, any go code implementing a Kube like API should be able to reuse the standard impl. No "hacks" specific to a certain API group should be in this layer
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.
added.
below). | ||
* `GroupName()` returns the generated client that this section is about. | ||
* `NamespaceSpecifier()` may take a namespace parameter or nothing. | ||
* `Action` is one of Create/Get/Update/Delete/Watch, or appropriate actions |
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.
We need to settle on the pattern for sub resources. You don't have to do it here, but I'd like the current state called out as "insufficiently defined"
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.
Done
Will |
|
||
# Client: layering and package structure | ||
|
||
## Desired layers |
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.
TOC and/or TL;DR of the proposed layers / modules.
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.
Added TOC
GCE e2e test build/test passed for commit 6f8fcbfacc9a5015ba92e42feeb8eab5f20bf336. |
One thought I had today - we really should manage and version the conversions and API objects outside of the core Kube package somehow. Having go code that can take a v1beta3 object and convert it to v3 (even if it's lossy to reverse) is generally useful. Being able to keep old conversions over a long lifetime seems useful. It would also make it easy to control lifecycle of API external versions. |
OK, I pushed a new revision.
kubectl should use the dynamic client as much as possible, and for things that it has special knowledge of, it should use a pre-built clientset.
Agree, but outside the scope of this doc...
I added lines for the first two in various places. |
@smarterclayton if you're happy with these changes I'll squash and we can get this in :) |
My point is, if kubectl uses the pre-built clientset, then the version is decided at compile time, the APIVersion field in kubeconfig will be meaningless. Perhaps we should just remove that field from kubeconfig. |
I'm fine with changes, LGTM |
There can be multiple built in clientsets On Dec 2, 2015, at 6:10 PM, Chao Xu notifications@github.com wrote: kubectl should use the dynamic client as much as possible, and for things My point is, if kubectl uses the pre-built clientset, then the version is — |
Sure, we can switch clientset based on the specified "group/version", but I imagine the code won't be elegant, because you need to translate "group/version" to the the release version of clientset somehow. |
GCE e2e build/test failed for commit a873007f4115e2343aa3ff101f9a8528269388ad. |
Why is that hard? We already have to have scheme registries in clients for On Dec 2, 2015, at 6:47 PM, Chao Xu notifications@github.com wrote: There can be multiple built in clientsets Sure, we can switch clientset based on the specified "group/version", but I — |
Sorry I don't follow. Let's look at a concrete example. (https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/portforward.go#L104-L109)
In this proposal, the |
Squashed. Let's merge and we can make changes later if needed. |
GCE e2e test build/test passed for commit dc5e1ea. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
I'm accumulating everything I've learned from talking with people about the client into a single proposal to make sure everyone is on the same page.
@smarterclayton @krousey @caesarxuchao