Add a server side exporter parameter and impl.#17483
Add a server side exporter parameter and impl.#17483k8s-github-robot merged 3 commits intokubernetes:masterfrom
Conversation
|
Labelling this PR as size/L |
|
Thanks, we do need export, and I do think it should be in the server. cc @liggitt @derekwaynecarr re. whether this can be extended to work for Openshift cc @lavalamp to see whether he has suggestions I would prefer to put the individual export methods into each resource's strategy implementation. As we've found with the namespace deleter, centralizing the code like this makes it likely that it will be overlooked when adding new resources. I think a subresource isn't needed, so the query parameter is probably fine. Will take a closer look tomorrow. cc @janetkuo |
|
GCE e2e test build/test passed for commit 2014d975b3ad3c57fb58ccec7752812222faaeb1. |
pkg/apiserver/apiserver.go
Outdated
There was a problem hiding this comment.
If we do this here clients can't tell what methods support exporting. Servers outside the Kube code base also can't provide an export behavior. the pattern we use for optional behavior like this is to support another interface on the storage object which calls to the strategy. I would prefer to test for the interface in apiinstaller and pass it down to the get handler, and also add the parameter to the go-restful description there.
There was a problem hiding this comment.
Swagger supports specifying query parameters, though we don't use it consistently.
One could view this as a specialized form of field selection.
Probably every resource that supports GET should support export, even if it's a no-op.
There was a problem hiding this comment.
If we did leave this as a query param, we'd want to handle it similarly to other query params. See DeleteOptions and ListOptions as examples.
There was a problem hiding this comment.
If we did leave this as a query param, we'd want to handle it similarly to other query params.
+1
|
Somewhat related: #17333 Eventually we may want to export just what the user configured, both in terms of fields and resources, and if a user did a bulk export, they won't want to export resources (e.g., pods) created by other resources (e.g., RCs). OTOH, if they were using kubectl apply already, they probably don't need export. |
pkg/apiserver/apiserver.go
Outdated
There was a problem hiding this comment.
Why do we need exact? What does it mean?
There was a problem hiding this comment.
This is copied from openshift, exact means "preserve things that are cluster dependent, like namespace"
|
One thing I'd like to use this for is edit: export, edit, then patch. @janetkuo Do you think that would work? The benefit is that it would remove cruft like the uid, creationTimestamp, status, etc. |
|
@smarterclayton what you suggest is tricky to do given the way the framework is put together. The best you could do is either pass an I think another way to achieve what you are asking for @smarterclayton is to allow upstream users to inject their own @bgrant0607 there is already a So then my concrete proposal would be to make type GetterWithOptions interface {
Get(ctx api.Context, name string, opts runtime.Object, export ExportOptions)
}
type Getter interface {
Get(ctx api.Context, name string, export ExportOptions)
}and then drive that down to a concrete implementation in the Strategy. Does that work for both people? I would very much like to enable: kubectl --context=cluster-a export all | kubectl --context=cluster-b create -f -to clone one cluster into another |
|
I think export is different from the intent of getterwithoptions. The On Nov 19, 2015, at 7:15 PM, Brendan Burns notifications@github.com wrote: @smarterclayton https://github.com/smarterclayton what you suggest is I think another way to achieve what you are asking for @smarterclayton @bgrant0607 https://github.com/bgrant0607 there is already a So then my concrete proposal would be to make type GetterWithOptions interface { and then drive that down to a concrete implementation in the Strategy. Does that work for both people? I would very much like to enable: kubectl --context=cluster-a export all | kubctl --context=cluster-b create -f - to clone one cluster into another — |
|
So to be concrete, what you are suggesting is that in Let me know which one you prefer. |
|
The latter - sorry for the delay, in meetings. On Fri, Nov 20, 2015 at 12:29 PM, Brendan Burns notifications@github.com
|
|
cc @lavalamp |
pkg/api/export/exporter.go
Outdated
There was a problem hiding this comment.
I would strongly prefer to see something added to the strategy (like the list, get, create, etc behaviors). You can even add a default to the generic one and get most of this for free, it looks like.
2014d97 to
4bf2288
Compare
|
GCE e2e build/test failed for commit 4bf228835229f65458b8d0872f8a9101e66e72dd. |
4bf2288 to
0968156
Compare
|
Moved over to the strategy based approach suggested by @smarterclayton, @lavalamp and others. please take another look. --brendan |
0968156 to
44d948d
Compare
|
GCE e2e build/test failed for commit 09681562d70b0165279e335c9c3171f48e851d9b. |
|
GCE e2e build/test failed for commit 44d948dcf15e642a40e9285849b41e7142a9bbae. |
|
ping @smarterclayton @k8s-bot please test this |
pkg/apiserver/resthandler.go
Outdated
There was a problem hiding this comment.
Why do we need this check? Would delegate it to the strategy implementor.
There was a problem hiding this comment.
Why force every strategy to put the same boilerplate at the top of each export method?
There was a problem hiding this comment.
You don't need to do it in the strategy. The etcd generic store can do it and call the strategy to do the rest. I think it'd make more sense there.
|
A few comments, also needs a test in apiserver_test, and a strategy test for each type. |
44d948d to
32b0825
Compare
dc8f168 to
8cfe4a7
Compare
|
GCE e2e test build/test passed for commit 060836c4570deacaf98322a0095a6134375fb9de. |
|
GCE e2e test build/test passed for commit fb55ab4c8280b8d2f6d79f79db20e9361aff696e. |
8cfe4a7 to
2efcccf
Compare
|
Labelling this PR as size/XL |
|
GCE e2e test build/test passed for commit 8cfe4a72a202e16cb125c3ab5ec9f8aea0d42e6f. |
|
GCE e2e test build/test passed for commit dc8f1683ae4081f0a3c0594f84d499ebc99beba7. |
|
GCE e2e test build/test passed for commit 2efcccf. |
|
@k8s-bot unit test this please |
2efcccf to
a60069b
Compare
|
Labelling this PR as size/XXL |
|
GCE e2e test build/test passed for commit a60069b. |
|
Labelling this PR as size/XS |
|
GCE e2e test build/test passed for commit 884c163. |
|
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
|
GCE e2e test build/test passed for commit 884c163. |
|
Automatic merge from submit-queue |
This is mostly an import of the existing openshift code
Ref: #13038
@smarterclayton @bgrant0607