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
DeleteCollection API fails if request body is non-empty #111985
Comments
/sig api-machinery |
/cc @Jefftree |
Also change the request bodies of Delete and DeleteCollection requests to be empty if the DeleteOptional has no fields set. Ref: kubernetes/kubernetes#111985
Also change the request bodies of Delete and DeleteCollection requests to be empty if the DeleteOptional has no fields set. Ref: kubernetes/kubernetes#111985 Fixes #125
This is pretty bad because it's not even a backwards-compatible change to serializers, it's a breaking change to at exactly 1.25: Serializing kind/apiVersion breaks on Kubernetes < 1.25delete_collections returns: { status: "Failure", message: "no kind \"DeleteOptions\" is registered for version \"meta.k8s.io/v1\" in scheme \"k8s.io/apimachinery@v1.24.1-k3s1/pkg/runtime/scheme.go:100\"", reason: "", code: 500 } Not serializing kind/apiVersion breaks on Kubernetes >= 1.25delete_collection returns: { status: "Failure", message: "Object 'Kind' is missing in '{}'", reason: "", code: 500 } So now we have to detect versions in non-IO/protocol level modules to do this safely, and it forces the user on a zero version skew. |
Update: the problem has been identified, and the specific reasons are as follows:
|
Thank you! Does that mean we can expect it in 1.25.4? |
Yes, subsequent releases will carry this bugfix. And, I have cherry-pick to 1.25.0. ps: I don't find release-1.25.x released in k/k codebase so there is no way to cherry-pick to released release-1.25.x @xmudrii Can you give me some guidance? |
@sxllwx With #113286 being merged, the fix will be (automatically) included in the upcoming 1.25.4 release (scheduled for November 9). There's nothing else that you need to do about this. Just as a note to make it clear, it's not possible to cherry pick this fix to existing patch releases, such as 1.25.0 — only 1.25.4 and newer releases will have the fix. |
Thanks for your explanation~ |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
What happened?
In v1.25.0, invoking the DeleteCollection API with a non-empty request body fails with HTTP 500 - the error message is
no kind "DeleteOptions" is registered for version "meta.k8s.io/v1" in scheme "pkg/api/legacyscheme/scheme.go:30"
All DeleteCollection APIs are specced (in the OpenAPI spec, eg
deleteCoreV1CollectionNamespacedPod
for the repro below) to take aDeleteOptions
in the request body, and the simplest such value is{}
. I maintain the Rust API client library, and my library's generated code always sets the request body to{}
when all the delete options are default (the serialized form of aDeleteOptions
with no set fields), which is how I noticed this bug.What did you expect to happen?
This works with v1.24 and earlier.
How can we reproduce it (as minimally and precisely as possible)?
(This repro uses
curl
for full control of the request headers and body.)Create kind cluster of v1.25.0
Create client-cert.pem containing the private key and cert extracted from kubectl config. (curl's
--cert
expects PEM-encoded private key followed by PEM-encoded cert in the file.)Try to delete all pods with label
foo=bar
The same request without a request body succeeds:
Anything else we need to know?
No response
Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
Edit: Still an issue as of v1.25.1
The text was updated successfully, but these errors were encountered: