devicecounts

package
v0.0.0-...-745efbd Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResourceSlicesForNode

func ResourceSlicesForNode(store cache.Store, node *corev1.Node) []*resourcev1.ResourceSlice

ResourceSlicesForNode returns node-local ResourceSlices whose spec.nodeName matches the node.

Types

type ClassConfig

type ClassConfig struct {
	Name                   string                  `toml:"name"`
	Enabled                bool                    `toml:"enabled"`
	Labels                 Labels                  `toml:"labels"`
	GroupingLabels         []string                `toml:"groupingLabels"`
	ExpectedCountOverrides []ExpectedCountOverride `toml:"expectedCountOverrides"`
	CurrentExpression      string                  `toml:"currentExpression"`
}

ClassConfig describes one device-count class, such as GPU or NIC counts.

type Config

type Config struct {
	Enabled bool          `toml:"enabled"`
	Classes []ClassConfig `toml:"classes"`
}

Config controls expected device-count label reconciliation.

func LoadConfig

func LoadConfig(path string) (Config, error)

LoadConfig loads expected device-count TOML configuration from a file.

type ExpectedCountOverride

type ExpectedCountOverride struct {
	MatchLabels map[string]string `toml:"matchLabels"`
	Count       int               `toml:"count"`
}

ExpectedCountOverride pins an expected count when a node's labels match.

type Labels

type Labels struct {
	Current  string `toml:"current"`
	Expected string `toml:"expected"`
}

Labels contains the current and expected node labels managed for a class.

type Manager

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

Manager evaluates device-count classes and applies their derived node labels.

func NewManager

func NewManager(config Config) (*Manager, error)

NewManager compiles enabled device-count classes and returns a ready manager.

func (*Manager) ClassCount

func (m *Manager) ClassCount() int

ClassCount returns the number of compiled device-count classes.

func (*Manager) Enabled

func (m *Manager) Enabled() bool

Enabled reports whether the manager has any compiled device-count classes.

func (*Manager) NodeLabelsAffectDeviceCounts

func (m *Manager) NodeLabelsAffectDeviceCounts(oldLabels, newLabels map[string]string) bool

NodeLabelsAffectDeviceCounts reports whether a node label change affects device-count inputs.

func (*Manager) ReconcileNodeLabelsInPlace

func (m *Manager) ReconcileNodeLabelsInPlace(
	ctx context.Context,
	node *corev1.Node,
	peerNodes []*corev1.Node,
	resourceSlicesForNode func(*corev1.Node) []*resourcev1.ResourceSlice,
) bool

ReconcileNodeLabelsInPlace evaluates all enabled device-count classes for a node.

func (*Manager) RequiresResourceSlices

func (m *Manager) RequiresResourceSlices() bool

RequiresResourceSlices reports whether any enabled class reads ResourceSlices.

Jump to

Keyboard shortcuts

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