-
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
Revert "Merge pull request #47353 from apelisse/http-cache" #50254
Conversation
cc @apelisse @mbohlool @pwittrock from original PR |
Thanks @liggitt for working on that, and sorry for breaking your use-case. All good points, Can you clarify what the difference is between:
and
Or maybe the question is, would a fix for the first point also fix that second point? If not, can you clarify what you meant for the latter. |
this means that two successful writes by separate processes would stomp on each other (process 1 starts writing, process 2 starts writing, they both write to the file in an interleaved way)
this means that if a single process fails halfway through writing the file, the half-written file is left in place. a future invocation of the cache will scan existing files to determine what is in cache, and the half-written file gets put in the index of available cached responses.
possibly, depending on the fix... if the disk cache changed to always write to a tmp file and only on success do a move to a file that is used to serve future cached responses, I think that would likely address both issues. |
I think we're on the same page then, that's exactly what I had in mind. Thanks |
/lgtm Given that this impacts concurrent kubectl clients in unpredictable ways, and also caches secret data on disk. |
61b1c18
to
60f1828
Compare
rebased to fix godep conflict |
60f1828
to
4ee72eb
Compare
fixed conflict in staging godep |
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, smarterclayton, thockin Associated issue: 47353 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/retest
Neither look related
|
unit flaked on #50022 |
/retest Review the full test history for this PR. |
/test all [submit-queue is verifying that this PR is safe to merge] |
@liggitt: 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/test-infra repository. I understand the commands that are listed here. |
Automatic merge from submit-queue (batch tested with PRs 50254, 50174, 50179) |
Automatic merge from submit-queue (batch tested with PRs 51480, 49616, 50123, 50846, 50404) Kubectl to use http caching to cache openapi responses from the server **What this PR does / why we need it**: This PR is trying to address the problems raised in #50254 > * uses a disk-based cache that is not safe between processes (does not use atomic fs operations) > * writes get/list responses to disk that should not be cached (like kubectl get secrets) > * is vulnerable to partially written cache responses being used as responses to future requests > * breaks uses of the client transport that make use of websockets > * defaults to enabling the cache for any client builder using RecommendedConfigOverrideFlags or DefaultClientConfig which affects more components than just kubectl All of these points are addressed by this pull-request: 1. It now uses atomic fs operations 2. Doesn't cache by default, only if requested by the client (and it's only done by openapi client) 3. Fixed because of atomic fs operations 4. Found the reason for the bug: Cache wrapper couldn't be unwrapped. I implemented the `WrappedRoundTripper` interface. 5. Since 2. is fixed, I think that should be fine @smarterclayton @liggitt **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #50254 **Special notes for your reviewer**: **Release note**: ```release-note Allows kubectl to use http caching mechanism for the OpenAPI schema. The cache directory can be configured through `--cache-dir` command line flag to kubectl. If set to empty string, caching will be disabled. ```
Some issues were discovered with the caching merged in #47353:
kubectl get secrets
)This reverts commit fc89743, reversing changes made to 29ab38e.