-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat: add support for httpcaching of github requests (alpha) #25879
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?
feat: add support for httpcaching of github requests (alpha) #25879
Conversation
❗ Preview Environment deployment failed on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
9325450 to
399c6e5
Compare
|
Do we need to be concerned with security implications? For example, might an AppSet be able to retrieve a response that happens to be available in the cache that it wouldn't be able to access if it had to go to GitHub to auth? Do we need the cache to be segmented by AppSet or secret or something like that? |
The caching library used here handle the segmentation internally IMO the security questions to consider are more:
Could be an option but it will improve the performance more than the security the Etag recalculation will happen a bit less. |
b2d6f1d to
7ac057c
Compare
812e17f to
24b8971
Compare
ppapapetrou76
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also add metrics?
You can use lru.NewWithEvict to capture evictions and increment metrics.
f8061ac to
9a3432c
Compare
@ppapapetrou76 will add the metrics layer later once other remarks will be solved |
98bb0f6 to
c2d466c
Compare
f20f112 to
84d7fd4
Compare
d70a8f4 to
e7f433b
Compare
I'm a bit worried about this actually. The library is pretty clear that it does this by having reverse-engineered the Etag and this is undocumented behavior and is not supported by GitHub. And while it works fine, I'm not sure we should be depending on behaviors that could be changed by GitHub any day without notice. I'm wondering if we should just use standard HTTP conditional requests despite the drawback of having more cache misses when the credentials change |
@alexymantha for github app it's not useful at all since we recreate the token on each reconciliation loop On our side we are using github app and we do understand the risk if Github change the Etag behaviour. |
Signed-off-by: Jean-Damien HATZENBUHLER <[email protected]>
876c75b to
0409044
Compare
This PR adds a LRU cache to the applicationset controller for github scm provider.
This uses a specific httpcache strategy described in here and recommanded in here
Fixes #11376
Deployed the fix on our production by building a custom image and we get a ~90% cache hit

see
Checklist: