-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
✨ Reduce github api requests in clusterctl by querying go modules #7192
✨ Reduce github api requests in clusterctl by querying go modules #7192
Conversation
5fd4b37
to
cc65b30
Compare
cc @ykakarap |
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.
Looks awesome - do we have any idea how much this helps? Is there many fewer calls in a clusterctl init for example?
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.
Just took a high-level look at this and this looks great.
I think technically a provider can be written in any language and not necessarily be in golang. This would enfore that the provider be a go project for clusterctl to be able to use the github repo to perform any actions.
I dont know if there are any providers that are actually not written in go (I dont imagine there are) but I wanted to call out the dependency this will establish.
How about adding a fallback to list the versions using the old github method? This would also cover the case if the provider's go module name does not match the github owner name (like "kubernetes-sigs" -> "sigs.k8s.io" and "kubernetes" -> "k8s.io").
I agree with that, looks even more to 👍 for the fallback to the old method as in #7192 (comment) :-) |
Yes:
I analyzed it by adding print statements in the code. Prior to this change for installing the AWS provider:
In sum: 13 API Calls to github. With this PR (if the providers are go based and supported via goproxy) we reduce the amount of API calls by 3 (to 10) in this example:
I will go ahead and implement the fallback mechanism. |
Refactored the code and moved the caching + goproxy call up by one func so the fallback mechanism seems to be cleaner. |
/test help |
@chrischdi: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
In response to this:
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. |
/test pull-cluster-api-apidiff-main |
/test pull-cluster-api-e2e-full-main |
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.
This looks great!
I will handle GOPROXY=off or directly by silently falling back to GitHub API; also, I will document we are relying on goproxy for reducing API calls + we are respecting GOPROXY env var in https://cluster-api.sigs.k8s.io/clusterctl/overview.html?highlight=github#avoiding-github-rate-limiting and reference the same paragraph from https://cluster-api.sigs.k8s.io/clusterctl/provider-contract.html?highlight=github#creating-a-provider-repository-on-github.
/retitle ✨ Reduce github api requests in clusterctl by querying go modules |
0101c0b
to
c88740e
Compare
/test pull-cluster-api-apidiff-main |
0210a05
to
982bb18
Compare
/test pull-cluster-api-apidiff-main |
982bb18
to
87bcb54
Compare
87bcb54
to
ea2e4e2
Compare
@fabriziopandini / @sbueringer : friendly reminder, this one is still around :-) It may be a nice small improvement, although it may already be too late for v1.3. |
/test pull-cluster-api-e2e-full-main |
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.
A few nits
1fe0b50
to
f54300e
Compare
f54300e
to
7c1df3a
Compare
Only one nit from my side. A similar note should go into https://cluster-api.sigs.k8s.io/clusterctl/provider-contract.html#creating-a-provider-repository-on-github and probably in https://cluster-api.sigs.k8s.io/clusterctl/overview.html#avoiding-github-rate-limiting |
* Removes additional cert-manager latest version detection because it always gets overwritten. * Uses goproxy instead of github api for listing repository versions.
7c1df3a
to
f7db0c7
Compare
@chrischdi: 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. |
Thx!! /lgtm |
/assign @fabriziopandini |
Great work! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Reduce github api requests in clusterctl
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Part of #3982