-
Notifications
You must be signed in to change notification settings - Fork 39.9k
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
Clean up PUT semantics #2114
Comments
Edited. Same case was pasted in twice.
is 404, which makes sense. |
Put requires that the pod already exist. Have you created it with a POST Brendan
|
Is that a kubernetes thing? |
I had thought it was generally a RESTful thing (POST == create, PUT == update) But looking around, it seems like there is disagreements about PUT in the RESTful context... I could see supporting PUT for create, but it definitely makes the logic more complicated. |
The spec says that PUT allows create, and is optional. If you support both, there's always the case that you don't want the create behavior on PUT, which means you need to set something on create to do that (If-None-Match: Name, etc). Can be annoying. Since we do have strong naming and versioning, create-or-update seems more useful to clients... The second case error is definitely wrong, probably because pod update is not using |
Use some constants for tokens. Refactor tokenfile creation to function. Reorder some test cases to make lookups follow creates so they succeed. Add expected status code to test cases (some are not quite what expected, so filed bugs kubernetes#2112, kubernetes#2113, kubernetes#2114) Check expected status codes. Close Body after each iterations so that we don't run out of file handles when I add even more test cases in the next PR. Handle that it is unpredictable whether status 200 or 202 is returned.
Hey Brian -- is this fixed with go-restful? |
I don't see how it would affect it |
@roberthbailey No. Why do you ask? |
We were triaging bugs today, and I thought the go-restful conversion might Brendan
|
I took a todo to look at this after v1veta3 if no one gets there first
|
Noticed a few more behaviors we need to define:
|
Right now this is the only behavior available-- if you give the right resource version, server overwrites all fields.
This would be cool, esp combined with a client-side AtomicUpdate... |
There was some discussion of updates here. I guess omission of resourceVersion would be similar to omission of Automatic retry on collision: One option would be PATCH. Short of that, I think we need a PATCH-like client library method that would GET, re-merge, and PUT again on conflict. The more general form of this is #1702. In order to remove previously configured fields by omission we'd need to keep track of configured fields in annotations. What are the difficulties with /pod/spec and /pod/status? Perhaps we should discuss that in #2726. |
/cc @nikhiljindal |
AllowCreateOnUpdate is currently false for most resources (except services, endpoints, events, limitranges). I think we should enable it for most resources (namespaces TBD) and use the uid as a precondition, if set, in addition to resourceVersion. |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
/remove-lifecycle rotten |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
OCPBUGS-38838: Re-enable 1.31 kubectl tests
PUTs are not doing what I expect them to do.
Bad Case 1
PUT /api/v1beta1/pods/a
Body:
I expected 200 since POST of the same body to "/api/v1beta1/pods".
Or, if that is the wrong way to do a PUT, then I would expect a 400, but not a 500. 500 is for server errors.
Here is the response body:
Bad Case 2
Previous cases are where no object existed.
Next case is an update (created object named
a
with a POST already)PUT /api/v1beta1/pods/a
Same body as above.
I was expecting 200, but I got 500. I'd take a 400 or 404 over a 500, though.
Response body:
The text was updated successfully, but these errors were encountered: