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 ¶
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
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