-
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
Expose versioned query parameters and make watch an operation on List #5763
Expose versioned query parameters and make watch an operation on List #5763
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/. If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits. Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name. |
5b403ac
to
d86729c
Compare
d1e7208
to
7382414
Compare
A bunch of these commits are in other pulls, only the last few are specific. |
7382414
to
936ccfc
Compare
I just have to ref. #3652. :-) |
6b35a1c
to
1f126a5
Compare
1f126a5
to
7a17ece
Compare
This pull request now changes watch from being a separate resource (although it's still exposed for legacy purposes at the old paths) to |
@@ -28,12 +30,48 @@ import ( | |||
var Codec = runtime.CodecFor(Scheme, "") | |||
|
|||
func init() { | |||
Scheme.AddDefaultingFuncs( |
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.
Why is this necessary? I'd like to nuke this whole file.
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.
Smart defaulting for ListOptions deserialized from an incoming request. Rather than make all people using it set those to empty and risk doing something wrong.
----- Original Message -----
@@ -28,12 +30,48 @@ import (
var Codec = runtime.CodecFor(Scheme, "")func init() {
- Scheme.AddDefaultingFuncs(
Why is this necessary? I'd like to nuke this whole file.
Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/5763/files#r27089694
@@ -23,6 +23,7 @@ import ( | |||
"github.com/GoogleCloudPlatform/kubernetes/pkg/conversion" | |||
) | |||
|
|||
// TODO: move me to pkg/api/meta |
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 belongs in pkg/runtime vs. elsewhere?
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.
Originally pkg/runtime was an opinionated part of conversion. Things strictly related to decoding generic objects in JSON showed up here. I think where we are today is that we want to have the core "smart object" model (pkg/smartobjects) which can do defaulting, conversion, new, etc, and then a set of serialization choices (JSON, query, protobufs, msgpack, whatever) laid on top of that (orthogonal to). The things in pkg/runtime that relate to the "scheme" (conversion, defaults) should move to smart objects. The things related to JSON serialization should be split out. I'm still torn on what we should do w.r.t. interfaces for helpful methods.
Ideally, I would think the smart objects code would have the ability to generate boilerplate helper methods (like ObjectMeta() or SetObjectMeta(...)) to your scheme. That would reduce the amount of code in api/meta (which is really about just having a common interface on all of our api objects to get and set metadata). We had just balked at adding one getter per type as being painful and hadn't got further.
I'm basically ok with the changes in this PR so far. I'm also 100% on board with the shift towards subresources as opposed to API prefixes, and am more or less ok with the proposed API paths. The difference between proxy and portforward is http vs. tcp? Why does portforward need a container name and not just a port? Do you also intend to support fd forwarding, for stdin/stdout/stderr (aka attach - #1521)? I'd like to see an /endpoints subresource on services, pods, and nodes, and perhaps even on replication controllers. I could see proxy, etc. building upon that functionality. An argument could be made that we should put the container name in the path, such as /pods/foo/containers/test/logs. Container subresources have been proposed before -- #1900. We don't necessarily need to allow mutation via that path right now, however. We could similarly put ports in the path: /pods/foo/ports/5000. Not directly related to this PR, but for proxy, we'll need to resolve the problems mentioned in #4440 at some point. The rewriting performed by the golang library only works for links within the same server, but not for links to other intra-cluster resources. |
Yes I think so
Good point, port is sufficient
Exec does. One problem with all "upgrade" endpoints is that you have to full represent your request via query parameters or request headers, or you have to introduce custom client framing into the connection establishment protocol. It was non-obvious what the best solution was (an example is passing a remote exec that has a massive argument list - 64kb or more, which exceeds the amount of data you'll be able to send via headers even in http2).
It should be possible in api_installer to extract the subpath for a sub resource (below it) and pass that into the sub resource. Just hadn't hit the use case yet. |
906a345
to
2bf9e92
Compare
Comments addressed, ptal |
2bf9e92
to
1396739
Compare
poke :) |
LGTM. (Sorry, was OOO yesterday). Needs to be rebased, unfortunately. |
1396739
to
a1e49b6
Compare
Convert url.Values -> an object, with appropriate versioning. ListOptions should also expose parameter names to swagger.
GET /pods?watch=true&resourceVersion=10 will now function equivalent to GET /watch/pods.
Formalize v1beta1 and v1beta3 style APIs in our test cases.
a1e49b6
to
870da68
Compare
Travis was a flake. |
Merging. |
…sioned Expose versioned query parameters and make watch an operation on List
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and | |||
limitations under the License. | |||
*/ | |||
|
|||
// TODO: move everything in this file to pkg/api/rest |
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.
@smarterclayton Sorry to refer this old PR and disturb you. I saw this todo and want to fix it, but I didn't catch why this file belongs to rest package, not meta package? Could you explain this? Thanks very much!
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.
Will try to respond tomorrow
Sub-resources are needed to properly secure proxying to the node (as per agreement in authz discussions), because we need to tie "resource" and "verb" to an action. The
/proxy
endpoint is too open to give to anyone but cluster admins. As part of #3481 and the general "bastioning" of the API server, we want to introduce new sub resources that allow specific, typed access to a backend. Examples:/pods/foo/proxy/5000/some/resource
/services/foo/proxy/5000/some/resource/path
/pods/foo/logs?container=test
-> returns "text/plain" stream/jobs/foo/logs
->/pods/foo/logs?container=test&since=30s
/pods/foo/exec?container=test&cmd=/bin/bash&arg=-c&arg=echo+$foo
-> upgrades connection to SPDY/HTTP2/pods/foo/portforward/5000?container=test
This requires three pieces of function:
Ideally we would also ensure we have methods that allow proper introspection through swagger
This pull request will contain the changes to enable that functionality through a set of targeted refactors. @csrwng @lavalamp @bgrant0607 @liggitt