podutil

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package podutil provides pod discovery and status helpers for Kubernetes workloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerRestartStatus

func ContainerRestartStatus(pod *corev1.Pod, name string) (restarts int32, waiting bool)

ContainerRestartStatus returns the restart count and whether the named container is in a waiting state (e.g., CrashLoopBackOff).

func GetContainerTerminationTime

func GetContainerTerminationTime(pod *corev1.Pod, containerName string) *metav1.Time

GetContainerTerminationTime returns when a container terminated. Returns nil if the container has not terminated or is not found.

func IsPodRunning

func IsPodRunning(pod *corev1.Pod) bool

IsPodRunning checks if a pod is in the Running phase.

Types

type WorkerDiscoverer

type WorkerDiscoverer struct {
	// contains filtered or unexported fields
}

WorkerDiscoverer finds worker pods for training workloads.

func NewWorkerDiscoverer

func NewWorkerDiscoverer(c client.Reader) *WorkerDiscoverer

NewWorkerDiscoverer creates a new WorkerDiscoverer.

func (*WorkerDiscoverer) GetReplicatedJobPod

func (d *WorkerDiscoverer) GetReplicatedJobPod(ctx context.Context, namespace, workloadName, replicatedJobName string) (*corev1.Pod, error)

GetReplicatedJobPod finds the first running pod for a specific replicatedJob within a TrainJob's JobSet. replicatedJobName is "launcher" for MPI workloads or "node" for torch workloads.

func (*WorkerDiscoverer) GetWorkerPods

func (d *WorkerDiscoverer) GetWorkerPods(ctx context.Context, namespace, name, workloadKind string) (worker0 *corev1.Pod, lastWorker *corev1.Pod, err error)

GetWorkerPods returns the worker-0 and optionally the last worker pod. workloadKind is one of: "TrainJob". The lastWorker may be nil if the workload is single-worker or replica count is 1.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL