Add ConnectionReset, InternalError, etc also as retryable API errors

pull/8/head
Shyam Jeedigunta 2018-04-15 20:52:59 +02:00
parent ee4d90aaa6
commit 7ab5bea961
1 changed files with 10 additions and 1 deletions

View File

@ -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 {