naming

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: GPL-3.0, LGPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package naming turns short node names into host names and service processor names, replacing the prefix logic the shell tools carried.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Short

func Short(name string) string

Short returns the node name without its domain.

Types

type Namer

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

Namer applies the naming rules of a site.

func New

func New(spec v1alpha1.NamingSpec, domains map[string]string) (*Namer, error)

New compiles the naming rules of a site.

func (*Namer) BMC

func (n *Namer) BMC(node string) (string, error)

BMC returns the host name of a node's service processor.

The name comes from the bmc template of the first rule that matches the short name, and nothing else: a node whose rule has none, or that no rule matches, is refused rather than given its own name, because the site's BMC account would then be sent to the node. For the same reason a template that gives the node's short name or host name back is refused. A node whose service processor cannot be named by a rule has its address written in the inventory, which the commands prefer.

A name with a domain is accepted only when it is the host name the rules give its short name. Any other domain names a different machine, whose service processor the rules do not know. An IP address is refused too: it has no short name, and cutting it at the first dot named one host for a whole subnet.

func (*Namer) BMCSet

func (n *Namer) BMCSet(ns *nodeset.NodeSet) (*nodeset.NodeSet, error)

BMCSet maps every node of a set to its service processor name.

func (*Namer) Domain

func (n *Namer) Domain(role string) string

Domain returns a named domain of the site.

func (*Namer) FQDN

func (n *Namer) FQDN(node string) (string, error)

FQDN returns the host name of a node.

A name that already carries a domain is returned unchanged, so that an administrator can always name a host exactly. Host names are not case sensitive, so a name is lowercased first: WLM01 is wlm01, and gets its rule.

func (*Namer) FQDNSet

func (n *Namer) FQDNSet(ns *nodeset.NodeSet) (*nodeset.NodeSet, error)

FQDNSet maps every node of a set to its host name.

Jump to

Keyboard shortcuts

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