nodemonitor

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package nodemonitor provides interfaces and implementations for detecting hardware failures on Kubernetes nodes.

Index

Constants

View Source
const (
	// NVCREJobLabel is the label used to identify pods belonging to an NVCRE Job.
	NVCREJobLabel = "nvcre.nvidia.com/job"

	// PodNVCREJobIndexField is the field index for pod lookups by NVCRE job label.
	// This enables efficient cache-based queries when discovering nodes for a Job.
	PodNVCREJobIndexField = "metadata.labels.nvcre.nvidia.com/job"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DetectionResult

type DetectionResult struct {
	// Failed indicates whether the node has a hardware failure.
	Failed bool

	// NodeName is the name of the node that was evaluated.
	NodeName string

	// Reason is a short, machine-readable reason code for the failure.
	Reason string

	// Message provides human-readable details about the failure.
	Message string
}

DetectionResult represents the outcome of evaluating a node for hardware failures.

type NodeDiscoverer

type NodeDiscoverer struct {
	// contains filtered or unexported fields
}

NodeDiscoverer finds nodes running pods for a given workload.

func NewNodeDiscoverer

func NewNodeDiscoverer(c client.Client) *NodeDiscoverer

NewNodeDiscoverer creates a new node discoverer.

func (*NodeDiscoverer) DiscoverNodesForJob

func (d *NodeDiscoverer) DiscoverNodesForJob(ctx context.Context, namespace, jobName string) ([]string, error)

DiscoverNodesForJob finds all nodes running pods associated with an NVCRE Job. It uses a field index on the nvcre.nvidia.com/job label for efficient cache-based lookups. Only returns nodes where pods are Running or Pending (i.e., scheduled).

Use this for questions about live health. For questions about where a job ran, including after its pods terminated, use DiscoverPlacedNodesForJob.

func (*NodeDiscoverer) DiscoverPlacedNodesForJob added in v0.7.0

func (d *NodeDiscoverer) DiscoverPlacedNodesForJob(ctx context.Context, namespace, jobName string) ([]string, error)

DiscoverPlacedNodesForJob finds every node a Job's pods were bound to, whatever phase those pods are now in.

This is the attribution question, not the health question, and the two need different filters. A job that fails fast leaves behind Failed pods, and a job whose pods have already been cleaned up to Succeeded leaves those; both still record the node they ran on in spec.nodeName. Filtering to Running or Pending the way DiscoverNodesForJob does would report no nodes in exactly the case attribution exists for, so a failed run would name no failed nodes.

A pod that was never bound has no placement to report and is skipped.

func (*NodeDiscoverer) GetNode

func (d *NodeDiscoverer) GetNode(ctx context.Context, name string) (*corev1.Node, error)

GetNode retrieves a Node object by name.

func (*NodeDiscoverer) GetNodes

func (d *NodeDiscoverer) GetNodes(ctx context.Context, names []string) ([]*corev1.Node, []error)

GetNodes retrieves multiple Node objects by name. Returns the nodes that were found and any errors encountered. Continues to fetch remaining nodes even if some fail.

type NodeFailureDetector

type NodeFailureDetector interface {
	// Name returns the unique identifier for this detector type.
	Name() string

	// Detect evaluates the given node and returns whether it has a hardware failure.
	// The context can be used for cancellation and timeouts.
	Detect(ctx context.Context, node *corev1.Node) (DetectionResult, error)

	// Validate checks if the detector configuration is valid.
	// This should be called during setup to catch configuration errors early.
	Validate() error
}

NodeFailureDetector is the interface for detecting hardware failures on nodes. Implementations can use different mechanisms such as CEL expressions, external APIs, or custom logic.

Directories

Path Synopsis
Package cel provides a CEL-based node failure detector implementation.
Package cel provides a CEL-based node failure detector implementation.

Jump to

Keyboard shortcuts

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