helper

package
v0.11.1 Latest Latest
Warning

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

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

Documentation

Overview

Package helper provides shared utilities for v2 validator containers.

Index

Constants

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

GpuResourceName is the Kubernetes resource name for NVIDIA GPUs.

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to the given bool value.

func FindSchedulableGpuNodes

func FindSchedulableGpuNodes(ctx context.Context, clientset kubernetes.Interface) ([]v1.Node, error)

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

func Int32Ptr

func Int32Ptr(i int32) *int32

Int32Ptr returns a pointer to the given int32 value.

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.

func LoadPodFromTemplate

func LoadPodFromTemplate(templatePath string, data map[string]string) (*v1.Pod, error)

LoadPodFromTemplate reads and processes a pod template file with variable substitution.

func StrPtr

func StrPtr(s string) *string

StrPtr returns a pointer to the given string value.

func VerifyResource

func VerifyResource(ctx context.Context, clientset kubernetes.Interface, er recipe.ExpectedResource) error

VerifyResource checks that a single expected resource exists and is healthy. Supports Deployment, DaemonSet, StatefulSet, Service, ConfigMap, Secret.

Types

type PodLifecycle

type PodLifecycle struct {
	ClientSet kubernetes.Interface
	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) GetPodLogs

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

GetPodLogs retrieves logs from a pod.

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.

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.

Jump to

Keyboard shortcuts

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