helper

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const GpuResourceName = "nvidia.com/gpu"

Variables

This section is empty.

Functions

func FindSchedulableGpuNodes

func FindSchedulableGpuNodes(ctx *checks.ValidationContext) ([]v1.Node, error)

FindSchedulableGpuNodes finds nodes that are schedulable and have allocatable GPU resources.

func IsNodeGpuBusy

func IsNodeGpuBusy(ctx context.Context, client kubernetes.Interface, nodeName string) (bool, error)

IsNodeGpuBusy checks if any non-terminal pods on the specified node are currently using GPU resources.

Types

type PodLifecycle

type PodLifecycle struct {
	ClientSet  kubernetes.Interface
	RESTConfig *rest.Config
	Namespace  string
}

PodLifecycle handles creation, verification, and cleanup of a pod

func (*PodLifecycle) CleanupPod

func (p *PodLifecycle) CleanupPod(ctx context.Context, pod *v1.Pod) error

CleanupPod deletes a pod

func (*PodLifecycle) CreatePodFromTemplate

func (p *PodLifecycle) CreatePodFromTemplate(ctx context.Context, templatePath string, data map[string]string) (*v1.Pod, error)

CreatePodFromTemplate creates a pod from a YAML template file

func (*PodLifecycle) ExecCommandInPod

func (p *PodLifecycle) ExecCommandInPod(ctx context.Context, pod *v1.Pod, command []string) (string, string, error)

ExecCommandInPod executes a command in a pod and returns stdout, stderr, and any error

func (*PodLifecycle) GetPodLogs

func (p *PodLifecycle) GetPodLogs(ctx context.Context, pod *v1.Pod) (string, error)

GetPodLogs retrieves logs from a pod. Delegates to the shared podutil.GetPodLogs utility, targeting the first container.

func (*PodLifecycle) WaitForPodByName

func (p *PodLifecycle) WaitForPodByName(ctx context.Context, podName string, timeout time.Duration) (*v1.Pod, error)

WaitForPodByName waits for a pod with the given name to be created in the namespace and returns the pod object when found or an error if the timeout is reached

func (*PodLifecycle) WaitForPodRunning

func (p *PodLifecycle) WaitForPodRunning(ctx context.Context, pod *v1.Pod, timeout time.Duration) error

WaitForPodRunning waits for a pod to reach Running phase

func (*PodLifecycle) WaitForPodSuccess

func (p *PodLifecycle) WaitForPodSuccess(ctx context.Context, v1Pod *v1.Pod, timeout time.Duration) error

WaitForPodSuccess waits for a pod to reach Succeeded phase. Delegates to the shared pod.WaitForPodSucceeded utility.

Jump to

Keyboard shortcuts

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