8000 DELETE requests for some objects get response data with Object instead of Status object · Issue #59501 · kubernetes/kubernetes · GitHub
[go: up one dir, main page]

Skip to content

DELETE requests for some objects get response data with Object instead of Status object #59501

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

Closed
masroorhasan opened this issue Feb 7, 2018 · 15 comments · Fixed by #87559
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@masroorhasan
Copy link

/kind bug

What happened:
DELETE request for pod resource is returning the entire pod resource in the response instead of the Status resource.

What you expected to happen:
Expecting the serialized response data to contain the Status resource instead of the Pod resource.

Here is the response from the API server:
image

Expecting 'Status' response according to the API documentation:
https://v1-7.docs.kubernetes.io/docs/api-reference/v1.7/#delete-58

How to reproduce it (as minimally and precisely as possible):
Delete a Pod using a client where the HTTP call can be traced. Observe the JSON response.

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-06-29T23:15:59Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd64"}

Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.7", GitCommit:"8e1552342355496b62754e61ad5f802a0f3f1fa7", GitTreeState:"clean", BuildDate:"2017-09-28T23:56:03Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration: Azure (deployed using acs-engine)
  • OS (e.g. from /etc/os-release):
    Master: Debian GNU/Linux 8 (jessie)
    Agent: windows (windows server 2016 datacenter)
  • Kernel (e.g. uname -a):
    Master: 4.4.0-112-generic
    Agent: 10.0 14393 (14393.2007.amd64fre.rs1_release.171231-1800)
  • Install tools:
  • Others:
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. kind/bug Categorizes issue or PR as related to a bug. labels Feb 7, 2018
@masroorhasan
Copy link
Author

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 7, 2018
@masroorhasan masroorhasan changed the title Kubernetes 1.7 DELETE pod request sends the response with Pod instead of Status resource kind Kubernetes 1.7 DELETE pod request gets response data with Pod instead of Status resource kind Feb 7, 2018
@liggitt
Copy link
Member
liggitt commented Feb 8, 2018

That's an issue with the documentation (and possibly the openapi doc). Returning the deleted object is intentional.

@masroorhasan masroorhasan changed the title Kubernetes 1.7 DELETE pod request gets response data with Pod instead of Status resource kind Kubernetes 1.7 DELETE pod request gets response data with Pod instead of Status object Feb 8, 2018
@jpbetz
Copy link
Contributor
jpbetz commented Feb 8, 2018

@yliaog

@masroorhasan
Copy link
Author
masroorhasan commented Feb 9, 2018

Thanks @liggitt. If the defined behavior is that the deleted 'Pod' object should be returned then there is definitely a bug in docs as well as the swagger spec (and more?). The swagger spec shows that the DELETE response is expecting a 'Status' object as well:

image

Same thing for deleting pod by name:
image

@electricsam
Copy link

The DELETE Job endpoint has the same problem (DELETE /apis/batch/v1/namespaces/{namespace}/jobs/{name}). The documentation states a Status response, but it is actually the deleted Pod. FWIW, these documentation issues/bugs cause exceptions in the Kubernetes Java client (kubernetes-client/java#205).

@roycaihw
Copy link
Member
roycaihw commented Mar 2, 2018

/sub

@liggitt
Copy link
Member
liggitt commented Mar 2, 2018

this is true for all types that set ReturnDeletedObject: true in their storage configuration

$ grep -r "ReturnDeletedObject: true" pkg 2>/dev/null
pkg/registry/core/pod/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/core/podtemplate/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/core/persistentvolumeclaim/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/core/namespace/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/core/persistentvolume/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/core/serviceaccount/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/core/resourcequota/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/storage/volumeattachment/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/storage/storageclass/storage/storage.go:		ReturnDeletedObject: true,
pkg/registry/extensions/podsecuritypolicy/storage/storage.go:		ReturnDeletedObject: true,

@yliaog
Copy link
Contributor
yliaog commented Mar 2, 2018

https://github.com/kubernetes/apiserver/blob/dd002fed291506760ba79a43ca21c9a5086a6a5d/pkg/endpoints/handlers/rest.go#L1020

it does not always return the object though. sometimes status is returned instead.

@liggitt
Copy link
Member
liggitt commented Mar 2, 2018

sometimes status is returned instead.

Status is always a valid option to be returned (401, 403, 404, 500 errors always return Status objects)

@roycaihw
Copy link
Member
roycaihw commented Mar 2, 2018

It's a known issue kubernetes-client/java#86 (comment), as @kondapally1989 pointed out in kubernetes-client/java#205
oneof is not supported in OpenAPI v2

ref #25716

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 31, 2018
@roycaihw
Copy link
Member

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 31, 2018
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 29, 2018
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 29, 2018
@roycaihw
Copy link
Member
roycaihw commented Oct 3, 2018

/remove-lifecycle rotten
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Oct 3, 2018
@liggitt liggitt changed the title Kubernetes 1.7 DELETE pod request gets response data with Pod instead of Status object Kubernetes 1.7 DELETE requests for some objects get response data with Object instead of Status object Oct 18, 2018
@liggitt liggitt changed the title Kubernetes 1.7 DELETE requests for some objects get response data with Object instead of Status object DELETE requests for some objects get response data with Object instead of Status object Oct 18, 2018
@liggitt liggitt added kind/documentation Categorizes issue or PR as related to documentation. priority/backlog Higher priority than priority/awaiting-more-evidence. labels Jun 12, 2019
daohoangson added a commit to daohoangson/kubernetes that referenced this issue Jan 26, 2020
k8s-publishing-bot pushed a commit to kubernetes/apiserver that referenced this issue Feb 7, 2020
Related to kubernetes/kubernetes#59501

Maybe related to kubernetes/enhancements#1263

Kubernetes-commit: 4d33d837c8be778044d50755de83f8738e957c13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants
0