Remove Authorization from ghproxy cache key for cross-pod deduplication#843
Merged
Remove Authorization from ghproxy cache key for cross-pod deduplication#843
Conversation
Each TaskSpawner uses its own GitHub token, so including the Authorization header in the cache key prevented cache sharing across spawner pods watching the same repos. Since all tokens have equivalent read access to the same repository data, the cached response bodies are identical regardless of which token fetched them. Dropping Authorization from the key enables cross-pod deduplication: when N spawner pods watch the same repo, only one upstream request is needed per cache TTL window instead of one per pod.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/kind cleanup
What this PR does / why we need it:
Removes the Authorization header from the ghproxy cache key so that spawner pods with different GitHub tokens share cached responses for the same repos.
Previously, each token produced a separate cache entry, so N spawner pods watching the same repo caused N upstream requests per TTL window. Since all tokens have equivalent read access to the same repository data, the responses are identical — caching them separately wasted the deduplication benefit of a shared proxy.
Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
The cache key now varies by upstream host + path + Accept header only. Authorization is still forwarded to upstream on every request (cache miss or revalidation) — only the cache lookup ignores it.
Does this PR introduce a user-facing change?
Summary by cubic
Remove the Authorization header from the
ghproxycache key to share GET responses across pods using different GitHub tokens. This reduces upstream GitHub requests and improves cache hit rates.Written for commit 698a7fb. Summary will update on new commits.