-
Notifications
You must be signed in to change notification settings - Fork 40k
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
WIP: Proposal for moving "printers" (kubectl get) to the server #29472
Comments
Still in progress |
@smarterclayton I think it would be better to list some work items here so other people can pick and help. wdyt? |
Going to write up a proposal shortly for the API part, then start suggesting changes into smaller work items. Joe Beda had a good suggestion for describe that resolves some of the issues we had with it. |
Really look forward to this :) |
I like this approach a lot. Given that this has been open for a while and hasn't seen much activity since, would it make sense to attempt building this as a 3rd-party resource first? Firstly, this approach would allow more room for experimentation without much in the way, like it can be implemented by a novice to API machinery and agains a released version of Kubernetes. Also, I can imagine that re-mapping can be done in lots of clever ways, so it'd be fun to work on. |
All of the endpoint handler work is done at this point (and the majority of
the internal work). What this is blocked on is creating the meta/v1 group
and getting types moved into it so that we can have a common type that
clients can reference. That's still on track for 1.6
External doesn't help much because it's one more place for clients to look
things up at.
On Dec 30, 2016, at 5:20 AM, Ilya Dmitrichenko <notifications@github.com> wrote:
I like this approach a lot. Given that this has been open for a while and
hasn't seen much activity since, would it make sense to attempt building
this as a 3rd-party resource first? Firstly, this approach would allow more
room for experimentation without much in the way, like it can be
implemented by a novice to API machinery and agains a released version of
Kubernetes. Also, I can imagine that re-mapping can be done in lots of
clever ways, so it'd be fun to work on.
Additionally, I see how there is some benefit for having this triggered
with Accept header and/or query parameter, but it would make the endpoint
handler more complex and presumably make API spec more complex as well as
require changes to API machinery and all that stuff, so having it more
external by design would be easier, wouldn't it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29472 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pyashJ8jrC0lkmnCZVhlxkCqODFxks5rNNr5gaJpZM4JTKJi>
.
|
Is there a more concrete proposal/design for this somewhere? I'm a little concerned we're rushing into a fairly significant change without much discussion or feedback beyond what is in this issue. |
I just reminded myself that Elasticsearch has a similar things, it's called "cat API", I think it's rather quite neat and we should consider it as an example. |
A couple other things we need to make certain of:
I suspect there will be a number of these kinds of features, where we need to pass a great deal of information from the client back to the server just so the server can render something properly. In general, this means I have a bunch of concerns about this. It's fine to add a simple table API if we want, but I'm quite worried that we will sacrifice user experience in the client in exchange for server side rendering. |
If you have an internationalization proposal, I'd be happy to add design
points on the server side implications of translation to it. It's
something we've discussed quite a bit.
The design proposal for get has been germinating for a while in discussions
with the sig. it'll go up soon, now that we've completed the prerequisite
changes for it.
The point of server side rendering is that we have several clients that all
want superior handling for third party resources and extensions, and
forcing the client to do it doesn't actually mean the client does better at
it. Kubectl get for a pod is almost impossible for another client to
reproduce, yet it's info valuable to all users. The request comes from web
consoles (which are having to reimplement every resource).
It also shields third party clients from each recreating an identical "get"
operation that depends on swagger (which also has to be versioned, since
we've already changed it several times in non compatible ways).
You can see a prototype at
#40848. Effectively we'd just
wire up the existing get code on the server and transform its output into a
table.
On Feb 6, 2017, at 7:12 PM, Brendan Burns <notifications@github.com> wrote:
A couple other things we need to make certain of:
1.
I'm adding internationalization support, if we're pretty printing on the
server, it needs to take language as a parameter so that it can translate
appropriately.
2.
I'm adding colorization support, again, we likely want the format here
to work for colorization too.
I suspect there will be a number of these kinds of features, where we need
to pass a great deal of information from the client back to the server just
so the server can render something properly.
In general, this means I have a bunch of concerns about this. It's fine to
add a simple table API if we want, but I'm quite worried that we will
sacrifice user experience in the client in exchange for server side
rendering.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29472 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p566V6kFPf9xk7xgAx1bByXyDXs3ks5rZ7brgaJpZM4JTKJi>
.
|
After syncing up offline, this makes sense to me and is complementary with the using the approach described here as a fallback. |
Is almost merged! |
Still WIP
As mentioned in #12143 (and #11617) we want to move printers to the server so that all clients can benefit from them, the naive client implementation is simpler, and so we can avoid having to perform external -> internal conversions in the client.
Considerations
kubectl get
is an alternative representation of the underlying API object or objects - in HTTP and REST this is most commonly treated as another representation of the same resource.kubectl get pods
) and the individual item (kubectl get pod
).?table=1
) and one is the content type (Accept: application/json;tabular=1
).Accept: application/json;pretty=1
and?pretty=1
today, which are roughly equivalent.export
, which is implemented as a query parameter. Export always returns the same object schema as the normal GET request.watch
, which is implemented as a query parameter, but which returns a different content-type and object schema as a normal GET request.Proposed:
Support both content type and query parameter for selecting an alternate representation of the object. Supporting content-type means we can in the future add new representations AND allow the user to request multiple serializations in order.
Example:
ISSUE: Do we want to continue the inlining of schemas (return
v1
forv1
resources), or explicitly return a different schema type? The latter is easier for generic clients. The former is easier for versioned clients.It would be valid to specify
?watch=1
or?export=1
with?table=
in the future. Tabular output is a transformation of the resulting object from a Get.This is a reasonably simple table schema (it's possible to extend values in the future) but in the near term additional descriptive metadata could be hung off "columns". The use of the
table
parameter aligns with the requested schema. For instance, the "default filter" concept needs to be implemented server side, which means each row needs a descriptive field (filtered or not).Implementation (more details needed)
printers.k8s.io
with av1
version that accepts this object.TransformTable(context api.Context, obj runtime.Object) (api.Table, error)
to RESTStorageTransformTable
ongeneric.Etcd
that handles fields supported by ObjectMetakubectl.Printers
into a package outside ofpkg/kubectl
where it can be reused by bothresource.Helper
to request tabular output.DecodeInto(..., &v1.Table{})
to decode the response (which should error if v1.Table is not recognized)kubectl get
to invoke the generic helper.The text was updated successfully, but these errors were encountered: