Documentation
¶
Overview ¶
Package k8s contains utility functions for interacting with Kubernetes clusters.
Index ¶
- func CheckJobErrors(ctx context.Context, client kubernetes.Interface, namespace, jobName string) error
- func DescribeJob(ctx context.Context, client kubernetes.Interface, namespace, jobName string) string
- func DumpK8sClusterState(ctx context.Context, kubeconfig *clientcmdapi.Config, out *strings.Builder) error
- func WaitForJobPodRunning(ctx context.Context, client kubernetes.Interface, namespace, jobName string, ...) (*corev1.Pod, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckJobErrors ¶
func CheckJobErrors(ctx context.Context, client kubernetes.Interface, namespace, jobName string) error
CheckJobErrors checks if a job has failed and returns an error with more details about the failure, such as the pod that failed and the error code.
func DescribeJob ¶
func DescribeJob(ctx context.Context, client kubernetes.Interface, namespace, jobName string) string
DescribeJob collects diagnostic information about a Job and its Pods into a human-readable string. It is designed for use in failure messages and never returns an error — each section is best-effort.
func DumpK8sClusterState ¶ added in v0.80.0
func WaitForJobPodRunning ¶
func WaitForJobPodRunning(ctx context.Context, client kubernetes.Interface, namespace, jobName string, timeout time.Duration) (*corev1.Pod, error)
WaitForJobPodRunning polls until a Job's Pod leaves the Pending phase or a terminal error is detected. It returns the Pod on success, or an error describing why the Pod could not start (image pull failure, scheduling issue, crash loop, or timeout). The returned Pod may be in any non-Pending phase (Running, Succeeded, or Failed). This function distinguishes infrastructure failures from runtime outcomes — a Pod that started and exited non-zero is still considered "started" for this purpose.
Types ¶
This section is empty.