Documentation ¶
Overview ¶
Package vm implements common methods for VM provisioners.
Index ¶
- func ConfigureSignals() chan os.Signal
- func DHCPd(ifName string, ips []net.IP, statePath string) error
- func DumpIPAMRecord(statePath string, record IPAMRecord) error
- func NewHTTPServer(gatewayAddr netip.Addr, port int, config []byte, controller Controller) (inmemhttp.Server, error)
- func ReadConfig(config interface{}) error
- func StopProcessByPidfile(pidPath string) error
- type Controller
- type IPAMDatabase
- type IPAMRecord
- type Provisioner
- func (p *Provisioner) CrashDump(ctx context.Context, cluster provision.Cluster, out io.Writer)
- func (p *Provisioner) CreateDHCPd(state *State, clusterReq provision.ClusterRequest) error
- func (p *Provisioner) CreateDisks(state *State, nodeReq provision.NodeRequest) (diskPaths []string, err error)
- func (p *Provisioner) CreateKMS(state *State, clusterReq provision.ClusterRequest, options provision.Options) error
- func (p *Provisioner) CreateLoadBalancer(state *State, clusterReq provision.ClusterRequest) error
- func (p *Provisioner) CreateNetwork(ctx context.Context, state *State, network provision.NetworkRequest, ...) error
- func (p *Provisioner) DestroyDHCPd(state *State) error
- func (p *Provisioner) DestroyKMS(state *State) error
- func (p *Provisioner) DestroyLoadBalancer(state *State) error
- func (p *Provisioner) DestroyNetwork(state *State) error
- func (p *Provisioner) DestroyNode(node provision.NodeInfo) error
- func (p *Provisioner) DestroyNodes(cluster provision.ClusterInfo, options *provision.Options) error
- func (p *Provisioner) Reflect(ctx context.Context, clusterName, stateDirectory string) (provision.Cluster, error)
- func (p *Provisioner) UserDiskName(index int) string
- type State
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureSignals ¶
ConfigureSignals configures signal handling for the process.
func DumpIPAMRecord ¶
func DumpIPAMRecord(statePath string, record IPAMRecord) error
DumpIPAMRecord appends IPAM record to the database.
func NewHTTPServer ¶
func NewHTTPServer(gatewayAddr netip.Addr, port int, config []byte, controller Controller) (inmemhttp.Server, error)
NewHTTPServer creates new inmemhttp.Server and mounts config file into it.
func ReadConfig ¶
func ReadConfig(config interface{}) error
ReadConfig loads configuration from stdin.
func StopProcessByPidfile ¶ added in v1.5.0
StopProcessByPidfile stops a process by reading its PID from a file.
Types ¶
type Controller ¶
type Controller interface { PowerOn() error PowerOff() error Reboot() error PXEBootOnce() error Status() Status }
Controller interface should be implemented by the VM to be controlled via the API.
type IPAMDatabase ¶
type IPAMDatabase map[string]map[int]IPAMRecord
IPAMDatabase is a mapping from MAC address to records with IPv4/IPv6 flag.
func LoadIPAMRecords ¶
func LoadIPAMRecords(statePath string) (IPAMDatabase, error)
LoadIPAMRecords loads all the IPAM records indexed by the MAC address.
type IPAMRecord ¶
type IPAMRecord struct { IP netip.Addr Netmask byte MAC string Hostname string Gateway netip.Addr MTU int Nameservers []netip.Addr TFTPServer string IPXEBootFilename string }
IPAMRecord describes a single record about a node.
type Provisioner ¶
type Provisioner struct { // Name actual provisioner type. Name string }
Provisioner base for VM provisioners.
func (*Provisioner) CrashDump ¶
CrashDump produces debug information to help with debugging failures.
func (*Provisioner) CreateDHCPd ¶
func (p *Provisioner) CreateDHCPd(state *State, clusterReq provision.ClusterRequest) error
CreateDHCPd creates DHCPd.
func (*Provisioner) CreateDisks ¶
func (p *Provisioner) CreateDisks(state *State, nodeReq provision.NodeRequest) (diskPaths []string, err error)
CreateDisks creates empty disk files for each disk.
func (*Provisioner) CreateKMS ¶ added in v1.5.0
func (p *Provisioner) CreateKMS(state *State, clusterReq provision.ClusterRequest, options provision.Options) error
CreateKMS creates KMS server.
func (*Provisioner) CreateLoadBalancer ¶
func (p *Provisioner) CreateLoadBalancer(state *State, clusterReq provision.ClusterRequest) error
CreateLoadBalancer creates load balancer.
func (*Provisioner) CreateNetwork ¶
func (p *Provisioner) CreateNetwork(ctx context.Context, state *State, network provision.NetworkRequest, options provision.Options) error
CreateNetwork builds bridge interface name by taking part of checksum of the network name so that interface name is defined by network name, and different networks have different bridge interfaces.
func (*Provisioner) DestroyDHCPd ¶
func (p *Provisioner) DestroyDHCPd(state *State) error
DestroyDHCPd destoys load balancer.
func (*Provisioner) DestroyKMS ¶ added in v1.5.0
func (p *Provisioner) DestroyKMS(state *State) error
DestroyKMS destroys KMS server.
func (*Provisioner) DestroyLoadBalancer ¶
func (p *Provisioner) DestroyLoadBalancer(state *State) error
DestroyLoadBalancer destroys load balancer.
func (*Provisioner) DestroyNetwork ¶
func (p *Provisioner) DestroyNetwork(state *State) error
DestroyNetwork destroy bridge interface by name to clean up.
func (*Provisioner) DestroyNode ¶
func (p *Provisioner) DestroyNode(node provision.NodeInfo) error
DestroyNode destroys VM.
func (*Provisioner) DestroyNodes ¶
func (p *Provisioner) DestroyNodes(cluster provision.ClusterInfo, options *provision.Options) error
DestroyNodes destroys all VMs.
func (*Provisioner) Reflect ¶
func (p *Provisioner) Reflect(ctx context.Context, clusterName, stateDirectory string) (provision.Cluster, error)
Reflect decode state file.
func (*Provisioner) UserDiskName ¶
func (p *Provisioner) UserDiskName(index int) string
UserDiskName returns disk device path.
type State ¶
type State struct { ProvisionerName string BridgeName string ClusterInfo provision.ClusterInfo VMCNIConfig *libcni.NetworkConfigList // contains filtered or unexported fields }
State common state representation for vm provisioners.
func (*State) GetRelativePath ¶
GetRelativePath get file path relative to config folder.