-
Notifications
You must be signed in to change notification settings - Fork 41.1k
apiserver: fix status code of future resourceVersion api request #131179
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
base: master
Are you sure you want to change the base?
Conversation
Hi @RalXYZ. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: RalXYZ The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/ok-to-test |
37e93f8
to
0362e94
Compare
0362e94
to
9f2b375
Compare
@RalXYZ: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
What type of PR is this?
/kind bug
What this PR does / why we need it:
In short, I discovered a reproducible bug in the Kubernetes REST API, identified the root cause, and implemented a fix. Additionally, I wrote a unit test to verify the resolution.
Steps to Reproduce Manually
StartTestServer
function from thetesting
package, but I believe the results would be the same with other methods).curl -X GET "https://$IP:$PORT/apis/apps/v1/deployments?resourceVersion=2147483647&limit=1"
In other words, we send a GET request to
/apis/apps/v1/deployments
with a request parameter that includes an extremely large and obviously non-existentresourceVersion
. Clearly, the server should return a 4xx error.This is unexpected. The request should be properly handled and return a
504
response instead of anInternal Server Error
(500).Unit Test & Fix
To facilitate reproduction of the issue, I added a unit test. Running this test consistently reproduces the issue as described above.
After investigation, I found that the root cause of this issue lies in etcd's response to a non-existent high
resourceVersion
, which isetcdrpc.ErrFutureRev
. However, this response is not properly handled in the Kubernetes API server. I applied the necessary fix in the source code, and after making the modification, the newly added unit test now behaves as expected.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: