Skip to content
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

Resolve the form of special "verbs" in the api for v1beta3 #3652

Closed
bgrant0607 opened this issue Jan 21, 2015 · 16 comments
Closed

Resolve the form of special "verbs" in the api for v1beta3 #3652

bgrant0607 opened this issue Jan 21, 2015 · 16 comments
Labels
area/api Indicates an issue on api area. area/usability priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@bgrant0607
Copy link
Member

Currently, we support custom "verbs" such as proxy, redirect, and watch. These prefix the object paths, such as /api/v1beta1/watch/... (Note that proxy doesn't follow the actual path convention: api/v1beta1/proxy/minion/minion1:10250 -- note that minion is singular, and the port number.) See #3548 and #3612 for more examples.

More verbs are proposed, such as stop (#1535), resize (#1629), and clone (#170).

In order to be more compatible with REST/OO style, to simplify auth, and to facilitate discoverability and shardability, I propose we change these to SUFFIX api paths, in the standard collection/instance pattern. Something like: object_path/methods/verb_name. Note that some "verbs" (e.g., resize) require the ability to GET as well as POST, which is somewhat different than our REST objects.

@smarterclayton @lavalamp

@bgrant0607 bgrant0607 added priority/backlog Higher priority than priority/awaiting-more-evidence. area/api Indicates an issue on api area. area/usability labels Jan 21, 2015
@derekwaynecarr
Copy link
Member

Doesn't this make the verb names invalid resource names?

For example,

/api/v1beta3/ns/default/pods/watch

Am I asking for a pod named watch or am I watching all pods in the default namespace?

Or maybe I misunderstand example, but if you are suggesting

/api/v1beta3/ns/default/pods/methods/watch

Am I watching for changes to the pod named methods or for all pods in namespace?

Sent from my iPhone

On Jan 20, 2015, at 7:19 PM, Brian Grant notifications@github.com wrote:

Currently, we support custom "verbs" such as proxy, redirect, and watch. These prefix the object paths, such as /api/v1beta1/watch/... (Note that proxy doesn't follow the actual path convention: api/v1beta1/proxy/minion/minion1:10250 -- note that minion is singular, and the port number.) See #3548 and #3612 for more examples.

More verbs are proposed, such as stop (#1535), resize (#1629), and clone (#170).

In order to be more compatible with REST/OO style, to simplify auth, and to facilitate discoverability and shardability, I propose we change these to SUFFIX api paths, in the standard collection/instance pattern. Something like: object_path/methods/verb_name. Note that some "verbs" (e.g., resize) require the ability to GET as well as POST, which is somewhat different than our REST objects.

@smarterclayton @lavalamp


Reply to this email directly or view it on GitHub.

@bgrant0607
Copy link
Member Author

@derekwaynecarr Fair point. Currently they conflict with object Kinds, which are less numerous and under our control. We could insert a character that couldn't be used in object names but is legal in URLs. For example:
/api/v1beta3/ns/default/pods/~/watch

That said, I have to admit that watch, proxy, and redirect have a very different flavor than stop, resize, and clone. Maybe it makes sense to handle them differently.

@smarterclayton
Copy link
Contributor

I think having seen a lot of other attempts to make this work.... that treating them higher in the chain actually makes it cleaner in the long run. They look a bit out of place, but if HTTP clients and servers supported truly flexible verbs we would use them for this. In the meantime, ns/foo/watch/pods is pretty clear.

----- Original Message -----

@derekwaynecarr Fair point. Currently they conflict with object Kinds, which
are less numerous and under our control. We could insert a character that
couldn't be used in object names but is legal in URLs. For example:
/api/v1beta3/ns/default/pods/~/watch

That said, I have to admit that watch, proxy, and redirect have a very
different flavor than stop, resize, and clone. Maybe it makes sense to
handle them differently.


Reply to this email directly or view it on GitHub:
#3652 (comment)

@bgrant0607
Copy link
Member Author

Ok, I'm fine with that. Thanks.

@bgrant0607
Copy link
Member Author

/cc @nikhiljindal

@smarterclayton
Copy link
Contributor

Thinking about bindings, ideally you name the last segment of the path the resource type you are posting. In this case a pod can have only a single binding, so you are POST /pods/foo/binding. You can clone, restart, stop, start many times, so that's POST /pods/foo/method/clone or POST /pods/foo/op/clone

@smarterclayton
Copy link
Contributor

I changed my mind about watch. Starting to feel like that's a different mime type/query param on LIST and GET. Proxy of wildcard never made sense (so that is going to always be a subresource). Redirect can be a query param or subresources.

If we do that we don't need global verbs anymore.

@bgrant0607
Copy link
Member Author

Yeah!

@derekwaynecarr
Copy link
Member

I prefer the use of a query param.

@bgrant0607
Copy link
Member Author

@derekwaynecarr A query param vs. what? And why?

@derekwaynecarr
Copy link
Member

I prefer that a WATCH was done by the following:

GET /namespaces/namespace/pods?watch=true
GET /pods?watch=true

over

GET /namespaces/namespace/pods/watch
GET /pods/watch

It's closer to the behavior in etcd where I can convert any get/list query to a watch by passing ?wait=true

@bgrant0607
Copy link
Member Author

That works for me.

@erictune
Copy link
Member

Tell me if this is a correct summary of what was decided:

  • watch is not a special verb. it is a content-type.
  • the watch content-type is requested via a query paramter
  • resize, stop, and clone are special verbs. They still go as the last path component.

@erictune
Copy link
Member

Once this is settled, I need to figure out implications for mapping requests to policy verbs (#2877).

@smarterclayton
Copy link
Contributor

They are resources - "pod/size" is a resource, with the verb "GET" (show me the current size) and "PUT" (change the current size). So the verb would stay a verb, but the resource would be a different resource. "pod" and "pod/status" are not the same resource.

----- Original Message -----

Tell me if this is a correct summary of what was decided:

  • watch is not a special verb. it is a content-type.
  • the watch content-type is requested via a query paramter
  • resize, stop, and clone are special verbs. They still go as the last
    path component.

Reply to this email directly or view it on GitHub:
#3652 (comment)

@smarterclayton
Copy link
Contributor

Generic proxy would probably just be a path (non-API) while "pod/proxy", "service/proxy", "pod/logs" are all separate resources.

----- Original Message -----

Tell me if this is a correct summary of what was decided:

  • watch is not a special verb. it is a content-type.
  • the watch content-type is requested via a query paramter
  • resize, stop, and clone are special verbs. They still go as the last
    path component.

Reply to this email directly or view it on GitHub:
#3652 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue on api area. area/usability priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

4 participants