mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Add ConnectionReset, InternalError, etc also as retryable API errors
This commit is contained in:
parent
ee4d90aaa6
commit
7ab5bea961
@ -51,7 +51,16 @@ func RetryWithExponentialBackOff(fn wait.ConditionFunc) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IsRetryableAPIError(err error) bool {
|
func IsRetryableAPIError(err error) bool {
|
||||||
return apierrs.IsTimeout(err) || apierrs.IsServerTimeout(err) || apierrs.IsTooManyRequests(err) || utilnet.IsProbableEOF(err)
|
// These errors may indicate a transient error that we can retry in tests.
|
||||||
|
if apierrs.IsInternalError(err) || apierrs.IsTimeout(err) || apierrs.IsServerTimeout(err) ||
|
||||||
|
apierrs.IsTooManyRequests(err) || utilnet.IsProbableEOF(err) || utilnet.IsConnectionReset(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// If the error sends the Retry-After header, we respect it as an explicit confirmation we should retry.
|
||||||
|
if _, shouldRetry := apierrs.SuggestsClientDelay(err); shouldRetry {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreatePodWithRetries(c clientset.Interface, namespace string, obj *v1.Pod) error {
|
func CreatePodWithRetries(c clientset.Interface, namespace string, obj *v1.Pod) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user