metal

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TagIPSeperator is the seperator character for key and values in IP-Tags
	TagIPSeperator = "="

	// Ephemeral IPs will be cleaned up automatically on machine, network, project deletion
	Ephemeral IPType = "ephemeral"
	// Static IPs will not be cleaned up and can be re-used for machines, networks within a project
	Static IPType = "static"

	// ScopeEmpty IPs are not bound to a project, machine or cluster
	ScopeEmpty IPScope = ""
	// ScopeProject IPs can be assigned to machines or used by cluster services
	ScopeProject IPScope = "project"
	// ScopeMachine IPs are bound to the usage directly at machines
	ScopeMachine IPScope = "machine"
)
View Source
const (
	CREATE  EventType = "create"
	UPDATE  EventType = "update"
	DELETE  EventType = "delete"
	COMMAND EventType = "command"

	TopicMachine NSQTopic = "machine"
	TopicSwitch  NSQTopic = "switch"
)

Some enums.

View Source
const ASNBase = int64(4200000000)

ASNBase is the offset for all Machine ASN´s

Variables

View Source
var (
	// View Groupname
	ViewGroups = []security.ResourceAccess{
		security.ResourceAccess("k8s_kaas-view"),
		security.ResourceAccess("maas-all-all-view"),
	}

	// Edit Groupname
	EditGroups = []security.ResourceAccess{
		security.ResourceAccess("k8s_kaas-edit"),
		security.ResourceAccess("maas-all-all-edit"),
	}

	// Admin Groupname
	AdminGroups = []security.ResourceAccess{
		security.ResourceAccess("k8s_kaas-admin"),
		security.ResourceAccess("maas-all-all-admin"),
	}

	// Groups that have view permission
	ViewAccess = sec.MergeResourceAccess(ViewGroups, EditGroups, AdminGroups)
	// Groups that have edit permission
	EditAccess = sec.MergeResourceAccess(EditGroups, AdminGroups)
	// Groups that have admin permission
	AdminAccess = AdminGroups
)

These are our supported groups.

View Source
var (
	// AllProvisioningEventTypes are all provisioning events that exist
	AllProvisioningEventTypes = map[ProvisioningEventType]bool{
		ProvisioningEventAlive:            true,
		ProvisioningEventCrashed:          true,
		ProvisioningEventResetFailCount:   true,
		ProvisioningEventPlannedReboot:    true,
		ProvisioningEventPXEBooting:       true,
		ProvisioningEventPreparing:        true,
		ProvisioningEventRegistering:      true,
		ProvisioningEventWaiting:          true,
		ProvisioningEventInstalling:       true,
		ProvisioningEventBootingNewKernel: true,
		ProvisioningEventPhonedHome:       true,
	}
	// ProvisioningEventsInspectionLimit The length of how many provisioning events are being inspected for calculating incomplete cycles
	ProvisioningEventsInspectionLimit = 2 * len(expectedProvisioningEventSequence) // only saved events count

)
View Source
var (
	// AllStates contains all possible values of a machine state
	AllStates = []MState{AvailableState, ReservedState, LockedState}
)
View Source
var (
	// Topics is a list of topics of which the metal-api is a producer.
	// metal-api will make sure these topics exist when it is started.
	Topics = []NSQTopic{
		TopicMachine,
		TopicSwitch,
	}
)
View Source
var (
	// UnknownSize is the size to use, when someone requires a size we do not know.
	UnknownSize = &Size{
		Base: Base{
			ID:   "unknown",
			Name: "unknown",
		},
	}
)

Functions

func Conflict

func Conflict(format string, args ...interface{}) error

Conflict creates a new conflict error with a given error message.

func Internal

func Internal(err error, format string, args ...interface{}) error

Internal creates a new Internal error with a given error message and the original error.

func IpTag

func IpTag(key, value string) string

func IsConflict

func IsConflict(e error) bool

IsConflict checks if an error is a conflict error.

func IsInternal

func IsInternal(e error) bool

IsInternal checks if an error is a Internal error.

func IsNotFound

func IsNotFound(e error) bool

IsNotFound checks if an error is a notfound error.

func NotFound

func NotFound(format string, args ...interface{}) error

NotFound creates a new notfound error with a given error message.

Types

type BIOS

type BIOS struct {
	Version string `rethinkdb:"version"`
	Vendor  string `rethinkdb:"vendor"`
	Date    string `rethinkdb:"date"`
}

BIOS contains machine bios information

type Base

type Base struct {
	ID          string    `rethinkdb:"id,omitempty"`
	Name        string    `rethinkdb:"name"`
	Description string    `rethinkdb:"description"`
	Created     time.Time `rethinkdb:"created"`
	Changed     time.Time `rethinkdb:"changed"`
}

Base implements common fields for most basic entity types (not all).

func (*Base) GetChanged

func (b *Base) GetChanged() time.Time

GetChanged returns the last changed timestamp of the entity

func (*Base) GetCreated

func (b *Base) GetCreated() time.Time

GetCreated returns the creation timestamp of the entity

func (*Base) GetID

func (b *Base) GetID() string

GetID returns the ID of the entity

func (*Base) SetChanged

func (b *Base) SetChanged(changed time.Time)

SetChanged sets the last changed timestamp of the entity

func (*Base) SetCreated

func (b *Base) SetCreated(created time.Time)

SetCreated sets the creation timestamp of the entity

func (*Base) SetID

func (b *Base) SetID(id string)

SetID sets the ID of the entity

type BlockDevice

type BlockDevice struct {
	Name string `rethinkdb:"name"`
	Size uint64 `rethinkdb:"size"`
}

BlockDevice information.

type BootConfiguration

type BootConfiguration struct {
	ImageURL    string `rethinkdb:"imageurl"`
	KernelURL   string `rethinkdb:"kernelurl"`
	CommandLine string `rethinkdb:"commandline"`
}

BootConfiguration defines the metal-hammer initrd, kernel and commandline

type ChassisIdentifyLEDState

type ChassisIdentifyLEDState struct {
	Value       LEDState `rethinkdb:"value"`
	Description string   `rethinkdb:"description"`
}

A ChassisIdentifyLEDState describes the state of a chassis identify LED, i.e. LED-ON/LED-OFF.

type Connection

type Connection struct {
	Nic       Nic    `rethinkdb:"nic"`
	MachineID string `rethinkdb:"machineid"`
}

Connection between switch port and machine.

type ConnectionMap

type ConnectionMap map[string]Connections

ConnectionMap is an indexed map of connection-lists

type Connections

type Connections []Connection

Connections is a list of connections.

type Constraint

type Constraint struct {
	Type ConstraintType `rethinkdb:"type"`
	Min  uint64         `rethinkdb:"min"`
	Max  uint64         `rethinkdb:"max"`
}

A Constraint describes the hardware constraints for a given size. At the moment we only consider the cpu cores and the memory.

func (*Constraint) Matches

Matches returns true if the given machine hardware is inside the min/max values of the constraint.

type ConstraintMatchingLog

type ConstraintMatchingLog struct {
	Constraint Constraint
	Match      bool
	Log        string
}

A ConstraintMatchingLog is used do return a log message to the caller beside the contraint itself.

type ConstraintType

type ConstraintType string

ConstraintType ...

const (
	CoreConstraint    ConstraintType = "cores"
	MemoryConstraint  ConstraintType = "memory"
	StorageConstraint ConstraintType = "storage"
)

come constraint types

type Entity

type Entity interface {
	// GetID returns the entity's id
	GetID() string
	// SetID sets the entity's id
	SetID(id string)
	// GetChanged returns the entity's changed time
	GetChanged() time.Time
	// SetChanged sets the entity's changed time
	SetChanged(changed time.Time)
	// GetCreated sets the entity's creation time
	GetCreated() time.Time
	// SetCreated sets the entity's creation time
	SetCreated(created time.Time)
}

Entity is an interface that allows metal entities to be created and stored into the database with the generic creation and update functions.

type EventType

type EventType string

EventType is the type for event types.

type Fru

type Fru struct {
	ChassisPartNumber   string `rethinkdb:"chassis_part_number"`
	ChassisPartSerial   string `rethinkdb:"chassis_part_serial"`
	BoardMfg            string `rethinkdb:"board_mfg"`
	BoardMfgSerial      string `rethinkdb:"board_mfg_serial"`
	BoardPartNumber     string `rethinkdb:"board_part_number"`
	ProductManufacturer string `rethinkdb:"product_manufacturer"`
	ProductPartNumber   string `rethinkdb:"product_part_number"`
	ProductSerial       string `rethinkdb:"product_serial"`
}

Fru (Field Replaceable Unit) data

type IP

type IP struct {
	IPAddress        string    `rethinkdb:"id"`
	ParentPrefixCidr string    `rethinkdb:"prefix"`
	Name             string    `rethinkdb:"name"`
	Description      string    `rethinkdb:"description"`
	ProjectID        string    `rethinkdb:"projectid"`
	NetworkID        string    `rethinkdb:"networkid"`
	Type             IPType    `rethinkdb:"type"`
	Tags             []string  `rethinkdb:"tags"`
	Created          time.Time `rethinkdb:"created"`
	Changed          time.Time `rethinkdb:"changed"`
}

IP of a machine/firewall.

func (*IP) ASN

func (ip *IP) ASN() (int64, error)

ASN calculate a ASN from the ip we start to calculate ASNs for machines with the first ASN in the 32bit ASN range and add the last 2 octets of the ip of the machine to achieve unique ASNs per vrf TODO consider using IntegerPool here as well to calculate the addition to ASNBase

func (*IP) AddMachineId

func (ip *IP) AddMachineId(id string)

func (*IP) GetChanged

func (ip *IP) GetChanged() time.Time

GetChanged returns the last changed timestamp of the entity

func (*IP) GetCreated

func (ip *IP) GetCreated() time.Time

GetCreated returns the creation timestamp of the entity

func (*IP) GetID

func (ip *IP) GetID() string

GetID returns the ID of the entity

func (*IP) GetMachineIds

func (ip *IP) GetMachineIds() []string

func (*IP) GetScope

func (ip *IP) GetScope() IPScope

GetScope determines the scope of an ip address

func (*IP) HasMachineId

func (ip *IP) HasMachineId(id string) bool

func (*IP) RemoveMachineId

func (ip *IP) RemoveMachineId(id string)

func (*IP) SetChanged

func (ip *IP) SetChanged(changed time.Time)

SetChanged sets the last changed timestamp of the entity

func (*IP) SetCreated

func (ip *IP) SetCreated(created time.Time)

SetCreated sets the creation timestamp of the entity

func (*IP) SetID

func (ip *IP) SetID(id string)

SetID sets the ID of the entity

type IPMI

type IPMI struct {
	// Address is host:port of the connection to the ipmi BMC, host can be either a ip address or a hostname
	Address    string `rethinkdb:"address"`
	MacAddress string `rethinkdb:"mac"`
	User       string `rethinkdb:"user"`
	Password   string `rethinkdb:"password"`
	Interface  string `rethinkdb:"interface"`
	Fru        Fru    `rethinkdb:"fru"`
	BMCVersion string `rethinkdb:"bmcversion"`
}

IPMI connection data

type IPScope

type IPScope string

IPScope is the scope of an ip.

type IPType

type IPType string

IPType is the type of an ip.

type IPs

type IPs []IP

func (IPs) ByProjectID

func (l IPs) ByProjectID() IPsMap

type IPsMap

type IPsMap map[string]IPs

type Image

type Image struct {
	Base
	URL      string                    `rethinkdb:"url"`
	Features map[ImageFeatureType]bool `rethinkdb:"features"`
}

An Image describes an image which could be used for provisioning.

func (*Image) HasFeature

func (i *Image) HasFeature(feature ImageFeatureType) bool

HasFeature returns true if this image has given feature enabled, otherwise false.

func (*Image) ImageFeatureString

func (i *Image) ImageFeatureString() string

ImageFeatureString returns the features of an image as a string.

type ImageFeatureType

type ImageFeatureType string
const (
	ImageFeatureFirewall ImageFeatureType = "firewall"
	ImageFeatureMachine  ImageFeatureType = "machine"
)

func ImageFeatureTypeFrom

func ImageFeatureTypeFrom(name string) (ImageFeatureType, error)

ImageFeatureTypeFrom a given name to a ImageFeatureType or error.

type ImageMap

type ImageMap map[string]Image

ImageMap is an indexed map for images.

type Images

type Images []Image

Images is a collection of images.

func (Images) ByID

func (ii Images) ByID() ImageMap

ByID creates an indexed map from an image collection.

type LEDState

type LEDState string

LEDState is the state of the LED of the Machine

const (
	// LEDStateOn LED is on
	LEDStateOn LEDState = "LED-ON"
	// LEDStateOff LED is off
	LEDStateOff LEDState = "LED-OFF"
)

func LEDStateFrom

func LEDStateFrom(name string) (LEDState, error)

LEDStateFrom converts an LEDState string to the corresponding type

type MState

type MState string

A MState is an enum which indicates the state of a machine

const (
	AvailableState MState = ""
	ReservedState  MState = "RESERVED"
	LockedState    MState = "LOCKED"
)

The enums for the machine states.

func MachineStateFrom

func MachineStateFrom(name string) (MState, error)

MachineStateFrom converts a machineState string to the type

type MacAddress

type MacAddress string

A MacAddress is the type for mac adresses. When using a custom type, we cannot use strings directly.

type Machine

type Machine struct {
	Base
	Allocation  *MachineAllocation      `rethinkdb:"allocation"`
	PartitionID string                  `rethinkdb:"partitionid"`
	SizeID      string                  `rethinkdb:"sizeid"`
	RackID      string                  `rethinkdb:"rackid"`
	Hardware    MachineHardware         `rethinkdb:"hardware"`
	State       MachineState            `rethinkdb:"state"`
	LEDState    ChassisIdentifyLEDState `rethinkdb:"ledstate"`
	Tags        []string                `rethinkdb:"tags"`
	IPMI        IPMI                    `rethinkdb:"ipmi"`
	BIOS        BIOS                    `rethinkdb:"bios"`
}

A Machine is a piece of metal which is under the control of our system. It registers itself and can be allocated or freed. If the machine is allocated, the substructure Allocation will be filled. Any unallocated (free) machine won't have such values.

func (*Machine) HasMAC

func (m *Machine) HasMAC(mac string) bool

HasMAC returns true if this machine has the given MAC.

func (*Machine) IsFirewall

func (m *Machine) IsFirewall(iMap ImageMap) bool

IsFirewall returns true if this machine is a firewall machine.

type MachineAllocation

type MachineAllocation struct {
	Created         time.Time         `rethinkdb:"created"`
	Name            string            `rethinkdb:"name"`
	Description     string            `rethinkdb:"description"`
	Project         string            `rethinkdb:"project"`
	ImageID         string            `rethinkdb:"imageid"`
	MachineNetworks []*MachineNetwork `rethinkdb:"networks"`
	Hostname        string            `rethinkdb:"hostname"`
	SSHPubKeys      []string          `rethinkdb:"sshPubKeys"`
	UserData        string            `rethinkdb:"userdata"`
	ConsolePassword string            `rethinkdb:"console_password"`
	Succeeded       bool              `rethinkdb:"succeeded"`
}

A MachineAllocation stores the data which are only present for allocated machines.

type MachineCommand

type MachineCommand string

A MachineCommand is an alias of a string

const (
	MachineOnCmd             MachineCommand = "ON"
	MachineOffCmd            MachineCommand = "OFF"
	MachineResetCmd          MachineCommand = "RESET"
	MachineBiosCmd           MachineCommand = "BIOS"
	ChassisIdentifyLEDOnCmd  MachineCommand = "LED-ON"
	ChassisIdentifyLEDOffCmd MachineCommand = "LED-OFF"
)

our supported machines commands.

type MachineEvent

type MachineEvent struct {
	Type EventType           `json:"type,omitempty"`
	Old  *Machine            `json:"old,omitempty"`
	New  *Machine            `json:"new,omitempty"`
	Cmd  *MachineExecCommand `json:"cmd,omitempty"`
}

MachineEvent is propagated when a machine is create/updated/deleted.

type MachineExecCommand

type MachineExecCommand struct {
	Target  *Machine       `json:"target,omitempty"`
	Command MachineCommand `json:"cmd,omitempty"`
	Params  []string       `json:"params,omitempty"`
}

A MachineExecCommand can be sent via a MachineEvent to execute the command against the specific machine. The specified command should be executed against the given target machine. The parameters is an optional array of strings which are implementation specific and dependent of the command.

type MachineHardware

type MachineHardware struct {
	Memory   uint64        `rethinkdb:"memory"`
	CPUCores int           `rethinkdb:"cpu_cores"`
	Nics     Nics          `rethinkdb:"network_interfaces"`
	Disks    []BlockDevice `rethinkdb:"block_devices"`
}

MachineHardware stores the data which is collected by our system on the hardware when it registers itself.

func (*MachineHardware) DiskCapacity

func (hw *MachineHardware) DiskCapacity() uint64

DiskCapacity calculates the capacity of all disks.

func (*MachineHardware) ReadableSpec

func (hw *MachineHardware) ReadableSpec() string

ReadableSpec returns a human readable string for the hardware.

type MachineLiveliness

type MachineLiveliness string

MachineLiveliness indicates the liveliness of a machine

const (
	MachineLivelinessAlive   MachineLiveliness = "Alive"
	MachineLivelinessDead    MachineLiveliness = "Dead"
	MachineLivelinessUnknown MachineLiveliness = "Unknown"
	MachineDeadAfter         time.Duration     = 5 * time.Minute
	MachineResurrectAfter    time.Duration     = time.Hour
)

The enums for the machine liveliness states.

func (MachineLiveliness) Is

func (l MachineLiveliness) Is(liveliness string) bool

Is return true if given liveliness is equal to specific Liveliness

type MachineNetwork

type MachineNetwork struct {
	NetworkID           string   `rethinkdb:"networkid"`
	Prefixes            []string `rethinkdb:"prefixes"`
	IPs                 []string `rethinkdb:"ips"`
	DestinationPrefixes []string `rethinkdb:"destinationprefixes"`
	Vrf                 uint     `rethinkdb:"vrf"`
	Private             bool     `rethinkdb:"private"`
	ASN                 int64    `rethinkdb:"asn"`
	Nat                 bool     `rethinkdb:"nat"`
	Underlay            bool     `rethinkdb:"underlay"`
}

MachineNetwork stores the Network details of the machine

func (*MachineNetwork) ContainsIP

func (n *MachineNetwork) ContainsIP(ip string) bool

ContainsIP checks whether the given ip is included in the networks prefixes

type MachineState

type MachineState struct {
	Value       MState `rethinkdb:"value"`
	Description string `rethinkdb:"description"`
}

A MachineState describes the state of a machine. If the Value is AvailableState, the machine will be available for allocation. In all other cases the allocation must explicitly point to this machine.

type Machines

type Machines []Machine

Machines is a slice of Machine

func (Machines) ByProjectID

func (ms Machines) ByProjectID() map[string]Machines

ByProjectID creates a map of machines with the project id as the index.

type NSQTopic

type NSQTopic string

NSQTopic .

func (NSQTopic) GetFQN

func (t NSQTopic) GetFQN(partitionID string) string

GetFQN gets the fully qualified name of a NSQTopic

type Network

type Network struct {
	Base
	Prefixes            Prefixes          `rethinkdb:"prefixes"`
	DestinationPrefixes Prefixes          `rethinkdb:"destinationprefixes"`
	PartitionID         string            `rethinkdb:"partitionid"`
	ProjectID           string            `rethinkdb:"projectid"`
	ParentNetworkID     string            `rethinkdb:"parentnetworkid"`
	Vrf                 uint              `rethinkdb:"vrf"`
	PrivateSuper        bool              `rethinkdb:"privatesuper"`
	Nat                 bool              `rethinkdb:"nat"`
	Underlay            bool              `rethinkdb:"underlay"`
	Labels              map[string]string `rethinkdb:"labels"`
}

Network is a network in a metal as a service infrastructure. TODO specify rethinkdb restrictions.

func (*Network) FindPrefix

func (n *Network) FindPrefix(cidr string) *Prefix

FindPrefix returns the prefix by cidr if contained in this network, nil otherwise

func (*Network) SubstractPrefixes

func (n *Network) SubstractPrefixes(prefixes ...Prefix) []Prefix

SubstractPrefixes returns the prefixes of the network minus the prefixes passed in the arguments

type NetworkMap

type NetworkMap map[string]Network

NetworkMap is an indexed map of networks

type NetworkUsage

type NetworkUsage struct {
	AvailableIPs      uint64 `json:"available_ips" description:"the total available IPs" readonly:"true"`
	UsedIPs           uint64 `json:"used_ips" description:"the total used IPs" readonly:"true"`
	AvailablePrefixes uint64 `json:"available_prefixes" description:"the total available Prefixes" readonly:"true"`
	UsedPrefixes      uint64 `json:"used_prefixes" description:"the total used Prefixes" readonly:"true"`
}

NetworkUsage contains usage information of a network

type Networks

type Networks []Network

Networks is a list of networks.

func (Networks) ByID

func (nws Networks) ByID() NetworkMap

ByID creates an indexed map of partitions whre the id is the index.

type Nic

type Nic struct {
	MacAddress MacAddress `rethinkdb:"macAddress"`
	Name       string     `rethinkdb:"name"`
	Vrf        string     `rethinkdb:"vrf"`
	Neighbors  Nics       `rethinkdb:"neighbors"`
}

Nic information.

type NicMap

type NicMap map[MacAddress]*Nic

type Nics

type Nics []Nic

Nics is a list of nics.

func (Nics) ByMac

func (nics Nics) ByMac() NicMap

ByMac creates a indexed map from a nic list.

type Partition

type Partition struct {
	Base
	BootConfiguration          BootConfiguration `rethinkdb:"bootconfig"`
	MgmtServiceAddress         string            `rethinkdb:"mgmtserviceaddr"`
	PrivateNetworkPrefixLength int               `rethinkdb:"privatenetworkprefixlength"`
}

A Partition represents a location.

type PartitionMap

type PartitionMap map[string]Partition

PartitionMap is an indexed map of partitions

type Partitions

type Partitions []Partition

Partitions is a list of partitions.

func (Partitions) ByID

func (sz Partitions) ByID() PartitionMap

ByID creates an indexed map of partitions whre the id is the index.

type Prefix

type Prefix struct {
	IP     string `rethinkdb:"ip"`
	Length string `rethinkdb:"length"`
}

Prefix is a ip with mask, either ipv4/ipv6

func NewPrefixFromCIDR

func NewPrefixFromCIDR(cidr string) (*Prefix, error)

NewPrefixFromCIDR returns a new prefix from a given cidr.

func (*Prefix) Equals

func (p *Prefix) Equals(other *Prefix) bool

Equals returns true when prefixes have the same cidr.

func (*Prefix) String

func (p *Prefix) String() string

String implements the Stringer interface

type Prefixes

type Prefixes []Prefix

Prefixes is an array of prefixes

func (Prefixes) String

func (p Prefixes) String() []string

type ProvisioningEvent

type ProvisioningEvent struct {
	Time    time.Time             `rethinkdb:"time"`
	Event   ProvisioningEventType `rethinkdb:"event"`
	Message string                `rethinkdb:"message"`
}

ProvisioningEvent is an event emitted by a machine during the provisioning sequence

type ProvisioningEventContainer

type ProvisioningEventContainer struct {
	Base
	Liveliness                   MachineLiveliness  `rethinkdb:"liveliness"`
	Events                       ProvisioningEvents `rethinkdb:"events"`
	LastEventTime                *time.Time         `rethinkdb:"last_event_time"`
	IncompleteProvisioningCycles string             `rethinkdb:"incomplete_cycles"`
}

ProvisioningEventContainer stores the provisioning events of a machine

func (*ProvisioningEventContainer) CalculateIncompleteCycles

func (p *ProvisioningEventContainer) CalculateIncompleteCycles(log *zap.SugaredLogger) string

CalculateIncompleteCycles calculates the number of events that occurred out of order. Can be used to determine if a machine is in an error loop.

func (*ProvisioningEventContainer) TrimEvents

func (p *ProvisioningEventContainer) TrimEvents(maxCount int)

TrimEvents trim the events to maxCount

type ProvisioningEventContainerMap

type ProvisioningEventContainerMap map[string]ProvisioningEventContainer

ProvisioningEventContainerMap is an indexed map of machine event containers.

type ProvisioningEventContainers

type ProvisioningEventContainers []ProvisioningEventContainer

ProvisioningEventContainers is a list of machine provisioning event containers.

func (ProvisioningEventContainers) ByID

ByID creates a map of event provisioning containers with the id as the index.

type ProvisioningEventType

type ProvisioningEventType string

ProvisioningEventType indicates an event emitted by a machine during the provisioning sequence

const (
	ProvisioningEventAlive            ProvisioningEventType = "Alive"
	ProvisioningEventCrashed          ProvisioningEventType = "Crashed"
	ProvisioningEventResetFailCount   ProvisioningEventType = "Reset Fail Count"
	ProvisioningEventPXEBooting       ProvisioningEventType = "PXE Booting"
	ProvisioningEventPlannedReboot    ProvisioningEventType = "Planned Reboot"
	ProvisioningEventPreparing        ProvisioningEventType = "Preparing"
	ProvisioningEventRegistering      ProvisioningEventType = "Registering"
	ProvisioningEventWaiting          ProvisioningEventType = "Waiting"
	ProvisioningEventInstalling       ProvisioningEventType = "Installing"
	ProvisioningEventBootingNewKernel ProvisioningEventType = "Booting New Kernel"
	ProvisioningEventPhonedHome       ProvisioningEventType = "Phoned Home"
)

The enums for the machine provisioning events.

func (ProvisioningEventType) Is

func (p ProvisioningEventType) Is(event string) bool

Is return true if given event is equal to specific EventType

type ProvisioningEvents

type ProvisioningEvents []ProvisioningEvent

ProvisioningEvents is just a list of ProvisioningEvents

type Size

type Size struct {
	Base
	Constraints []Constraint `rethinkdb:"constraints"`
}

A Size represents a supported machine size.

type SizeMap

type SizeMap map[string]Size

SizeMap is an indexed map of sizes.

type SizeMatchingLog

type SizeMatchingLog struct {
	Name        string
	Log         string
	Match       bool
	Constraints []ConstraintMatchingLog
}

A SizeMatchingLog returns information about a list of constraints.

type Sizes

type Sizes []Size

Sizes is a list of sizes.

func (Sizes) ByID

func (sz Sizes) ByID() SizeMap

ByID creates a map of sizes with the id as the index.

func (Sizes) FromHardware

func (sz Sizes) FromHardware(hardware MachineHardware) (*Size, []*SizeMatchingLog, error)

FromHardware searches a Size for given hardware specs. It will search for a size where the constraints matches the given hardware.

type Switch

type Switch struct {
	Base
	Nics               Nics          `rethinkdb:"network_interfaces"`
	MachineConnections ConnectionMap `rethinkdb:"machineconnections"`
	PartitionID        string        `rethinkdb:"partitionid"`
	RackID             string        `rethinkdb:"rackid"`
}

Switch have to register at the api. As metal-core is a stateless application running on a switch, the api needs persist all the information such that the core can create or restore a its entire switch configuration.

func (*Switch) ConnectMachine

func (s *Switch) ConnectMachine(machine *Machine)

ConnectMachine iterates over all switch nics and machine nic neighbor to find existing wire connections. Implementation is very inefficient, will also find all connections, which should not happen in a real environment.

type SwitchEvent

type SwitchEvent struct {
	Type     EventType `json:"type"`
	Machine  Machine   `json:"machine"`
	Switches []Switch  `json:"switches"`
}

SwitchEvent is propagated when a switch needs to update its configuration.

Jump to

Keyboard shortcuts

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