-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#480) * fix: Sidecar fails to fetch secrets for Sources and Sinks Signed-off-by: Saravanan Balasubramanian <[email protected]> * lint Signed-off-by: Saravanan Balasubramanian <[email protected]>
- Loading branch information
1 parent
f73c782
commit 3b7d09a
Showing
2 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package retry | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
k8sRetry "k8s.io/client-go/util/retry" | ||
) | ||
|
||
func retryableErrors(err error) bool { | ||
return errors.IsTimeout(err) || errors.IsServerTimeout(err) || errors.IsTooManyRequests(err) | ||
} | ||
|
||
func WithDefaultRetry(fn func() error) error { | ||
return WithRetry(k8sRetry.DefaultBackoff, fn) | ||
} | ||
|
||
func WithRetry(back wait.Backoff, fn func() error) error { | ||
return k8sRetry.OnError(back, retryableErrors, fn) | ||
} |