-
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
Made changes to DELETE API to let v1.DeleteOptions be passed in as a queryParameter #35806
Conversation
@@ -759,7 +759,7 @@ func DeleteResource(r rest.GracefulDeleter, checkBody bool, scope RequestScope, | |||
ctx = api.WithNamespace(ctx, namespace) | |||
|
|||
options := &api.DeleteOptions{} | |||
if checkBody { | |||
if isGracefulDeletion { |
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 change this?
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.
The only place this function is called, the passed in value is "isGracefulDeleter". It just seemed like with the change, what we're checking is no longer whether or not to check the body, but whether or not to look for graceful deletion.
Totally fine with leaving it as checkBody.
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.
Probably better for it to be allowsOptions
(now that you support query parameters). We may have sub resources that support delete that have different api objects instead of DeleteOptions in the future and this would be one step towards that.
@@ -781,6 +781,13 @@ func DeleteResource(r rest.GracefulDeleter, checkBody bool, scope RequestScope, | |||
scope.err(fmt.Errorf("decoded object cannot be converted to DeleteOptions"), res.ResponseWriter, req.Request) | |||
return | |||
} | |||
} else { | |||
if values := req.Request.URL.Query(); len(values) > 0 { |
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.
please add a test to apiserver_test.go that verifies the 3 permutations (body+query, body, query)
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.
Added, please take a look
@k8s-bot verify test this |
Changes look good, please squash once you get green and I'll label. |
Also please add a release note to the PR description. |
@k8s-bot unit test this |
@k8s-bot cvm gce e2e test this |
/lgtm |
I am surprised that there is no swagger spec change in this PR. cc @mbohlool |
We need to change the generation code in api_installer and potentially openapi. |
Good catch @nikhiljindal |
I've looked into this. Look like some (most?) operations accept SomeOption also as query parameters. Because query parameters cannot be a type (should be simple type like string), it reads the Option type members and decode/encode them as a single query param. I don't see we add those to the spec anywhere, so I suggest this change is not doing worse than what we have by not adding query parameters. We should fix that for all operations. |
Don't we already do this in swagger for ListOptions? What's the difference? On Nov 1, 2016, at 6:45 PM, mbohlool notifications@github.com wrote: I've looked into this. Look like some (most?) operations accept SomeOption — |
You are right. First I didn't see any ListOptions in swagger, but that is the point. addObjectParams in api_installer will do the trick. I suggest we do the same for DeleteOption. |
Jenkins GCE Node e2e failed for commit 5e6c034633aa858b33fe9df9bfe2ae742bb1616c. Full PR test history. The magic incantation to run this job again is |
Jenkins unit/integration failed for commit 5e6c034633aa858b33fe9df9bfe2ae742bb1616c. Full PR test history. The magic incantation to run this job again is |
Jenkins Kubemark GCE e2e failed for commit 5e6c034633aa858b33fe9df9bfe2ae742bb1616c. Full PR test history. The magic incantation to run this job again is |
Jenkins GCI GCE e2e failed for commit 5e6c034633aa858b33fe9df9bfe2ae742bb1616c. Full PR test history. The magic incantation to run this job again is |
Jenkins GCE etcd3 e2e failed for commit 5e6c034633aa858b33fe9df9bfe2ae742bb1616c. Full PR test history. The magic incantation to run this job again is |
Code as is and we'll figure out how to fix struct types in 1.6 On Nov 3, 2016, at 5:12 PM, bdbauer notifications@github.com wrote: @smarterclayton https://github.com/smarterclayton Do you mean leave the — |
We are removing a field from swagger 1.2, is it not a backward compatibility issue? I can see from typeToJSON function that we should only allow unversioned.Time to pass through. We can fix this in a more abstract way later (file the bug please) but I think we should fix it for unversioned.Time to not have a backward compatibility issue with clients that already using swagger 1.2. It should be a simple fix. |
@@ -944,6 +948,11 @@ func addObjectParams(ws *restful.WebService, route *restful.RouteBuilder, obj in | |||
} | |||
switch sf.Type.Kind() { | |||
case reflect.Interface, reflect.Struct: | |||
case reflect.Ptr: | |||
if sf.Type.Elem().Kind() == reflect.Interface || sf.Type.Elem().Kind() == reflect.Struct { |
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.
you can add something like
// TODO... (add appropriate message here to say this is a hack and need to be fixed in a generic way later, hopefully with a bug number)
if (...) && strings.TrimPrefix(sf.Type.String(),"*") != "unversioned.Time"
to let unversioned.Time pass through and have the removed time field back to the spec.
Jenkins GCE e2e failed for commit cb188d9067addb1a88f9b04161c401a67c3ad98a. Full PR test history. The magic incantation to run this job again is |
Jenkins verification failed for commit 297c8dbfc30c31c66ec08f3602f8cfcb706ba404. Full PR test history. The magic incantation to run this job again is |
Jenkins GKE smoke e2e failed for commit 297c8dbfc30c31c66ec08f3602f8cfcb706ba404. Full PR test history. The magic incantation to run this job again is |
@smarterclayton look good? |
/lgtm |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
…6-upstream-release-1.4 Automated cherry pick of #35806
Commit found in the "release-1.4" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked. |
…k-of-#35806-upstream-release-1.4 Automated cherry pick of kubernetes#35806
Which issue this PR fixes (optional, in
fixes #<issue number>(, #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #34856This change is