Documentation
¶
Index ¶
- Variables
- func IsTransientExecError(err error) bool
- func Run(ctx context.Context, client ExecClient, namespace, pod string, ...) error
- func RunOnContainer(ctx context.Context, client ExecClient, namespace, pod, container string, ...) error
- func RunOnContainerWithRetry(ctx context.Context, client ExecClient, namespace, pod, container string, ...) error
- func RunWithRetry(ctx context.Context, client ExecClient, namespace, pod string, ...) error
- type ExecClient
- type ExecContainerClient
- type RetryPolicy
Constants ¶
This section is empty.
Variables ¶
var DefaultRetryPolicy = RetryPolicy{ MaxAttempts: 3, InitialBackoff: 1 * time.Second, MaxBackoff: 5 * time.Second, }
Functions ¶
func IsTransientExecError ¶ added in v0.7.3
IsTransientExecError reports whether err looks like a transport/network-level failure from a kube exec stream (broken pipe, EOF mid-stream, connection reset, etc.) rather than a non-zero command exit. It is the single source of truth for both the retry path in this package and failure classification in callers (e.g. multi-pod exec). Context cancellation and deadline-exceeded errors return false; callers that care about those should check them explicitly with errors.Is.
The patterns are deliberately narrow substrings unique to transport failures. Bare "timeout" is intentionally excluded because remote command stderr (and wrapped error context) commonly contains the word in non-transport senses (e.g. "request timeout from upstream", "nslookup: timed out"); use "i/o timeout", "tls handshake timeout", or "client.timeout exceeded" instead.
func RunOnContainer ¶ added in v0.7.0
func RunOnContainer(ctx context.Context, client ExecClient, namespace, pod, container string, command []string, tty bool, stdin io.Reader, stdout io.Writer, stderr io.Writer) error
RunOnContainer executes a command in a specific container within a pod using DefaultRetryPolicy. Transient connect errors are retried the same way as RunWithRetry; non-transient errors (including non-zero command exit codes) surface immediately. If container is empty, it falls back to the pod-level ExecInteractive path.
func RunOnContainerWithRetry ¶ added in v0.7.3
func RunOnContainerWithRetry(ctx context.Context, client ExecClient, namespace, pod, container string, command []string, tty bool, stdin io.Reader, stdout io.Writer, stderr io.Writer, policy RetryPolicy) error
RunOnContainerWithRetry is the explicit-policy variant of RunOnContainer.
Types ¶
type ExecClient ¶
type ExecContainerClient ¶ added in v0.7.0
type ExecContainerClient interface {
ExecClient
ExecInteractiveInContainer(ctx context.Context, namespace, pod, container string, tty bool, command []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error
}
ExecContainerClient extends ExecClient with container-targeted exec.