Skip to content
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

GitHub downloader subject to rate limits #17

Open
alexzielenski opened this issue May 4, 2023 · 2 comments
Open

GitHub downloader subject to rate limits #17

alexzielenski opened this issue May 4, 2023 · 2 comments
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.

Comments

@alexzielenski
Copy link
Contributor

For unsupported schemas we have the option of downloading them from GitHub. This requires 1 or 2 api calls to list Kubernetes source directories. GitHub responses support E-Tags in their responses so can be cached without affecting the rate limit. We should add an on-disk cache similar to kubectl that stores the etags.

Another improvement would be to use the GitHub api key if supplied in envar or argument. That way the test suite would not ever be subject to rate limiting.

@alexzielenski alexzielenski added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label May 5, 2023
@gmemstr
Copy link

gmemstr commented May 29, 2023

I am interested in taking this on

We should add an on-disk cache similar to kubectl that stores the etags

To be clear, we want to cache the response data as well, not just the etag? Will take a look at how kubectl manages this as well.

/assign

@alexzielenski
Copy link
Contributor Author

alexzielenski commented May 30, 2023

To be clear, we want to cache the response data as well, not just the etag? Will take a look at how kubectl manages this as well.

That's correct. For caching discovery & openapi kubectl uses a caching http.RoundTripper: https://github.com/kubernetes/client-go/blob/master/discovery/cached/disk/round_tripper.go

It may be possible for us to just use a caching roundtripper directly for our GitHub downloader. kubectl uses the roundtripper wrapped inside a rest client:

Wraps rest client config here:
https://github.com/kubernetes/client-go/blob/cf830e3cb3abbcc32cc1b6bea4feb1a9a1881af3/discovery/cached/disk/cached_discovery.go#L301

Create caching rest client:
https://github.com/kubernetes/client-go/blob/cf830e3cb3abbcc32cc1b6bea4feb1a9a1881af3/discovery/discovery_client.go#L715

Gives to open api here:
https://github.com/kubernetes/client-go/blob/cf830e3cb3abbcc32cc1b6bea4feb1a9a1881af3/discovery/discovery_client.go#L656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

2 participants