node

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureLabels added in v0.7.0

func EnsureLabels(ctx context.Context, log *slog.Logger, labeler Updater, nodeName string, serials []*gpu.Serials) error

EnsureLabels is the testable version that accepts an interface

func Get

func Get(ctx context.Context, log *slog.Logger, cs *kubernetes.Clientset, node string) (*corev1.Node, error)

Get fetches the Kubernetes node object by name using the provided clientset and config. It returns an error if the node name is empty, clientset or config is nil, or if the node cannot be fetched.

Types

type Info

type Info struct {
	Provider   string
	Identifier string
	Raw        string
}

Info holds parsed information about a Kubernetes node's cloud provider and instance identifier.

func GetNodeProviderID

func GetNodeProviderID(ctx context.Context, log *slog.Logger, cs *kubernetes.Clientset, node string) (*Info, error)

GetNodeProviderID retrieves and parses the provider ID of a given Kubernetes node. It returns a Info struct containing the cloud provider, instance identifier, and raw provider ID. Supports AWS, GCP, Azure and BareMetal. Returns an error if node cannot be fetched or if provider is unrecognized.

type Labeler added in v0.7.0

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

Labeler implements Updater

func (*Labeler) GetNode added in v0.7.0

func (l *Labeler) GetNode(ctx context.Context, name string) (*corev1.Node, error)

func (*Labeler) UpdateNode added in v0.7.0

func (l *Labeler) UpdateNode(ctx context.Context, node *corev1.Node) (*corev1.Node, error)

type Updater added in v0.7.0

type Updater interface {
	GetNode(ctx context.Context, name string) (*corev1.Node, error)
	UpdateNode(ctx context.Context, node *corev1.Node) (*corev1.Node, error)
}

Updater interface for testability

func NewLabelUpdater added in v0.7.0

func NewLabelUpdater(client kubernetes.Interface) Updater

NewLabelUpdater creates a new Labeler instance

Jump to

Keyboard shortcuts

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