isRetryableExecError returns true for transient infrastructure errors
(err error)
| 53 | |
| 54 | // isRetryableExecError returns true for transient infrastructure errors |
| 55 | func isRetryableExecError(err error) bool { |
| 56 | if err == nil { |
| 57 | return false |
| 58 | } |
| 59 | |
| 60 | errStr := strings.ToLower(err.Error()) |
| 61 | |
| 62 | // Kubernetes API proxy errors (common in AKS) |
| 63 | if strings.Contains(errStr, "proxy error") || |
| 64 | strings.Contains(errStr, "error dialing backend") { |
| 65 | return true |
| 66 | } |
| 67 | |
| 68 | // HTTP 500 errors from API server |
| 69 | if strings.Contains(errStr, "500 internal server error") || |
| 70 | strings.Contains(errStr, "internal error occurred") { |
| 71 | return true |
| 72 | } |
| 73 | |
| 74 | // Network connectivity issues |
| 75 | if strings.Contains(errStr, "connection refused") || |
| 76 | strings.Contains(errStr, "connection reset") || |
| 77 | strings.Contains(errStr, "i/o timeout") || |
| 78 | strings.Contains(errStr, "tls handshake timeout") || |
| 79 | strings.Contains(errStr, "dial tcp") { |
| 80 | return true |
| 81 | } |
| 82 | |
| 83 | // Kubernetes API errors that are typically transient |
| 84 | if apierrors.IsInternalError(err) || |
| 85 | apierrors.IsServerTimeout(err) || |
| 86 | apierrors.IsTimeout(err) || |
| 87 | apierrors.IsServiceUnavailable(err) || |
| 88 | apierrors.IsTooManyRequests(err) { |
| 89 | return true |
| 90 | } |
| 91 | |
| 92 | return false |
| 93 | } |
| 94 | |
| 95 | // ExecCommand executes a command inside the pod, automatically retrying |
| 96 | // transient errors like proxy failures or network issues. |
no test coverage detected