Documentation
¶
Index ¶
- Constants
- func FindSchedulableGpuNodes(ctx *checks.ValidationContext) ([]v1.Node, error)
- func IsNodeGpuBusy(ctx context.Context, client kubernetes.Interface, nodeName string) (bool, 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) ExecCommandInPod(ctx context.Context, pod *v1.Pod, command []string) (string, string, 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, pod *v1.Pod, timeout time.Duration) error
Constants ¶
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 ¶
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
T *testing.T
}
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) 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 ¶
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 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, pod *v1.Pod, timeout time.Duration) error
WaitForPodSuccess waits for a pod to reach Succeeded phase