helper

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 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 AKSRdmaSharedResource = "rdma/hca_shared_devices_a"

AKSRdmaSharedResource is the extended resource the network operator's rdma-shared-device-plugin publishes on Mellanox RDMA nodes. Its name is pinned by recipes/components/network-operator/manifests/nic-cluster-policy-aks.yaml (resourceName hca_shared_devices_a). The resource is transport-agnostic — the same pool backs InfiniBand and RoCE — so nothing keyed off it is IB-specific. Both the deployment-phase RDMA fabric readiness gate and the NCCL performance consumer key off this exact resource, so it lives here as the single source of truth rather than a duplicated literal in each validator binary.

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

GpuResourceName is the Kubernetes resource name for NVIDIA GPUs.

View Source
const PCIMellanoxPresentLabel = "feature.node.kubernetes.io/pci-15b3.present"

PCIMellanoxPresentLabel is the NFD feature label marking nodes with a Mellanox (PCI vendor 15b3) NIC — the vendor NFD detects for any ConnectX card, whether it runs InfiniBand or RoCE, so this is an RDMA-capability marker, not an IB one. It is the nodeAffinity the AKS NicClusterPolicy uses to place the RDMA fabric (nic-cluster-policy-aks.yaml), so it identifies exactly the nodes that can ever advertise AKSRdmaSharedResource.

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