Documentation
¶
Overview ¶
Package inventory answers questions about the nodes of a site: their attributes, where they sit, what address they have and what they boot.
It replaces the genders file, the rack spreadsheet and the boot path table the shell tools read separately.
Index ¶
- func BootPath(inv *Inventory, rules []v1alpha1.BootPathRule, node string) (string, bool, error)
- type Inventory
- func (inv *Inventory) All() []*Node
- func (inv *Inventory) AttributeKeys() []string
- func (inv *Inventory) AttributeValues(key string) []string
- func (inv *Inventory) AttributeValuesOf(field func(*Node) string) []string
- func (inv *Inventory) InRack(rack string) *nodeset.NodeSet
- func (inv *Inventory) Len() int
- func (inv *Inventory) Lookup(name string) (*Node, bool)
- func (inv *Inventory) Names() []string
- func (inv *Inventory) NodeSet() *nodeset.NodeSet
- func (inv *Inventory) Racks() []string
- func (inv *Inventory) Resolve(name string) (string, bool)
- func (inv *Inventory) Select(ns *nodeset.NodeSet) (known []*Node, unknown []string)
- func (inv *Inventory) WithAttribute(key, value string) *nodeset.NodeSet
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootPath ¶
BootPath returns the boot path configured for a node: the one on its inventory entry, else the first cluster rule that names it.
A node matched by more than one rule is an error rather than a silent first-match, because two rules pointing at different installations is a mistake worth stopping for.
Types ¶
type Inventory ¶
type Inventory struct {
// contains filtered or unexported fields
}
Inventory holds the nodes of a site, indexed by name.
func New ¶
func New(specs ...v1alpha1.NodeInventorySpec) (*Inventory, error)
New builds an inventory from the NodeInventory documents of a site.
Entries are applied in order, so a general entry may be written first and refined by a later one naming fewer nodes. Fields that describe a single machine may only be set by an entry that names exactly one node.
func (*Inventory) AttributeKeys ¶
AttributeKeys lists every attribute name in the inventory.
func (*Inventory) AttributeValues ¶
AttributeValues lists the distinct values of an attribute, in sorted order.
func (*Inventory) AttributeValuesOf ¶
AttributeValuesOf lists the distinct non-empty values a field takes.
func (*Inventory) Resolve ¶
Resolve returns the name the inventory uses for a host, which may differ from the name given only in padding.
func (*Inventory) Select ¶
Select returns the nodes of a set that the inventory knows, and the names of those it does not.
A name is matched through the node set, so that a set written as exe[1-2] finds the nodes an inventory wrote as exe0001 and exe0002: padding is a display property, not part of a host's identity.
type Node ¶
type Node struct {
Name string `json:"name" yaml:"name"`
Attributes map[string]string `json:"attributes,omitempty" yaml:"attributes,omitempty"`
Rack string `json:"rack,omitempty" yaml:"rack,omitempty"`
Level string `json:"level,omitempty" yaml:"level,omitempty"`
Address string `json:"address,omitempty" yaml:"address,omitempty"`
BMCAddress string `json:"bmcAddress,omitempty" yaml:"bmcAddress,omitempty"`
CID string `json:"cid,omitempty" yaml:"cid,omitempty"`
MACs []string `json:"macs,omitempty" yaml:"macs,omitempty"`
BootPath string `json:"bootPath,omitempty" yaml:"bootPath,omitempty"`
}
Node is everything the inventory knows about one machine.