-
Notifications
You must be signed in to change notification settings - Fork 170
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
Switch to avast/retry-go
for HTTP retry
#2350
base: main
Are you sure you want to change the base?
Conversation
b29bc95
to
a782ddc
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2350 +/- ##
===========================================
- Coverage 66.46% 49.86% -16.61%
===========================================
Files 92 192 +100
Lines 9258 24773 +15515
===========================================
+ Hits 6153 12352 +6199
- Misses 2359 11318 +8959
- Partials 746 1103 +357
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9ae3e8f
to
003ab22
Compare
Green CI :) |
func createRoundTripper(inner http.RoundTripper, o *options) http.RoundTripper { | ||
var tooManyRedirectyRe = regexp.MustCompile(`stopped after \d+ redirects\z`) | ||
|
||
func shouldRetry(resp *http.Response, err error) error { |
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.
Is this a change in behavior or is this copied from go-retryable's implementation?
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.
It's not copied over, but it should reflect the same retry behavior.
pkg/client/rekor_client.go
Outdated
ForceAttemptHTTP2: true, | ||
MaxIdleConnsPerHost: -1, | ||
DisableKeepAlives: !o.NoDisableKeepalives, | ||
TLSClientConfig: &tls.Config{InsecureSkipVerify: o.InsecureTLS}, //nolint:gosec |
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.
Previously this was only set if o.InsecureTLS
. Should we maintain that, or is there no change in behavior? I'm not sure if there's a default tls config we're overriding.
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.
Changed it to only apply if o.InsecureTLS
, but I assume it's the same as before in the end.
The hashicorp dependencies are MPL licensed and therefore not allowed in the CNCF. This means we now use the `avast/retry-go` implementation to achieve the same goal. Signed-off-by: Sascha Grunert <[email protected]>
003ab22
to
3f3e3b0
Compare
@@ -132,7 +131,9 @@ require ( | |||
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect | |||
github.com/google/s2a-go v0.1.9 // indirect | |||
github.com/hashicorp/errwrap v1.1.0 // indirect | |||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect |
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 like these are still indirects (probably because of us supporting hashivault)... is that still an issue for CNCF?
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.
I think so, but the code does not seem to be imported from kubernetes-sigs/release-sdk, we may follow-up on that, though.
Summary
The hashicorp dependencies are MPL licensed and therefore not allowed in the CNCF. This means we now use the
avast/retry-go
implementation to achieve the same goal.Release Note
Use
github.com/avast/retry-go
instead ofgithub.com/hashicorp/go-retryablehttp
for HTTP request retry.Documentation
None
Fixes #2342