mirror of https://github.com/k3s-io/k3s
Add ConnectionReset, InternalError, etc also as retryable API errors
parent
ee4d90aaa6
commit
7ab5bea961
|
@ -51,7 +51,16 @@ func RetryWithExponentialBackOff(fn wait.ConditionFunc) error {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue