Documentation
¶
Overview ¶
Package helper provides shared utilities for v2 validator containers.
Index ¶
- Constants
- func BoolPtr(b bool) *bool
- func FindSchedulableGpuNodes(ctx context.Context, clientset kubernetes.Interface) ([]v1.Node, error)
- func Int32Ptr(i int32) *int32
- func IsNodeGpuBusy(ctx context.Context, client kubernetes.Interface, nodeName string) (bool, error)
- func LoadPodFromTemplate(templatePath string, data map[string]string) (*v1.Pod, error)
- func StrPtr(s string) *string
- func VerifyResource(ctx context.Context, clientset kubernetes.Interface, ...) error
- type PodLifecycle
- func (p *PodLifecycle) CleanupPod(ctx context.Context, pod *v1.Pod) error
- func (p *PodLifecycle) CreatePodFromTemplate(ctx context.Context, templatePath string, data map[string]string) (*v1.Pod, error)
- func (p *PodLifecycle) GetPodLogs(ctx context.Context, pod *v1.Pod) (string, error)
- func (p *PodLifecycle) WaitForPodByName(ctx context.Context, podName string, timeout time.Duration) (*v1.Pod, error)
- func (p *PodLifecycle) WaitForPodRunning(ctx context.Context, pod *v1.Pod, timeout time.Duration) error
- func (p *PodLifecycle) WaitForPodSuccess(ctx context.Context, v1Pod *v1.Pod, timeout time.Duration) error
Constants ¶
const GpuResourceName = "nvidia.com/gpu"
GpuResourceName is the Kubernetes resource name for NVIDIA GPUs.
Variables ¶
This section is empty.
Functions ¶
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 IsNodeGpuBusy ¶
IsNodeGpuBusy checks if any non-terminal pods on the specified node are currently using GPU resources.
func LoadPodFromTemplate ¶
LoadPodFromTemplate reads and processes a pod template file with variable substitution.
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 ¶
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 ¶
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.