-
Notifications
You must be signed in to change notification settings - Fork 40.9k
client-go/discovery: Migrate disk cache to RFC 9111 compliant implementation #132681
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?
client-go/discovery: Migrate disk cache to RFC 9111 compliant implementation #132681
Conversation
Replace `gregjones/httpcache` with `bartventer/httpcache` for RFC 9111 compliance and active maintenance. Refs kubernetes#120276
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
Welcome @bartventer! |
Hi @bartventer. 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. |
/area code-organization |
This change does sound to me like it is user visible, albeit only indirectly. |
This sounds like a pretty big change, one missing detail in the PR body: How did you approach when there is a cache from the previous implementation already on disk? Does it get cleaned up? Re-used? Or abandoned to eat disk forever? /ok-to-test |
@lmktfy You're right that this could be indirectly user-visible. The main impacts: Potential benefits:
Potential disruptions:
Since the discovery client API stays the same and this is internal to the caching layer, I marked it as Do you think we should add a brief release note about the cache improvements, or is |
Thanks for pointing this out. The existing cache can't be reused because of incompatible key formats and collision risks between Key Differences in Cache Key Generation:
Cache Collision Risks: Manual cleanup isn't safe because of potential key collisions between old and new cache entries:
Possible Migration Approaches:
@BenTheElder, some questions for you:
I'm leaning toward option 1 (separate storage) given the collision risks, but would appreciate your thoughts on the best path forward. Footnotes
|
Addresses issues for: - `errcheck` - `gocritic` - `testifylint`
/retest |
/remove-sig instrumentation |
What type of PR is this?
/kind feature
/kind cleanup
What this PR does / why we need it:
This PR migrates the discovery disk cache from
gregjones/httpcache
tobartventer/httpcache
for RFC 9111 HTTP Caching compliance, active maintenance, and improved caching behavior (ito hit rates).Motivation:
gregjones/httpcache
is archived and implements the obsolete RFC 7234.bartventer/httpcache
implements RFC 9111 §4.1 with proper normalization of Vary headers and URIs when generating cache keys; this covers recommended normalization steps from RFC 7230 §2.7.3 and RFC 3986 §6. In contrast,gregjones/httpcache
uses(*url.URL).String()
as the cache key, which cannot support Vary-based caching and may produce unpredictable behavior for requests with varying headers.Additionally,
bartventer/httpcache
also:200
,203
,301
,304
,308
,404
,405
,410
,414
,501
)stale-while-revalidate
andimmutable
cache-control extensionsX-Httpcache-Status
: HIT, MISS, STALE, REVALIDATED, BYPASS), in addition toX-From-Cache
(for compatibility with any existing consumers)Technical changes:
to satisfy the
driver.Conn
interfacesumDiskScheme
Which issue(s) this PR is related to:
References #120276
Special notes for your reviewer:
bartventer/httpcache
has it's own acceptance tests for cache implementations, which are run here; I removed overlapping tests, summarized below.gregjones/httpcache
cannot be safely reused due to incompatible key formats and potential collision risks. See discussion below for migration options.Does this PR introduce a user-facing change?