diff --git a/test/utils/create_resources.go b/test/utils/create_resources.go index 7a1379826ef..f92649ac14d 100644 --- a/test/utils/create_resources.go +++ b/test/utils/create_resources.go @@ -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 {