Documentation ¶
Index ¶
- Constants
- Variables
- func Conflict(format string, args ...interface{}) error
- func Internal(err error, format string, args ...interface{}) error
- func IpTag(key, value string) string
- func IsConflict(e error) bool
- func IsInternal(e error) bool
- func IsNotFound(e error) bool
- func NotFound(format string, args ...interface{}) error
- type BIOS
- type Base
- type BlockDevice
- type BootConfiguration
- type ChassisIdentifyLEDState
- type Connection
- type ConnectionMap
- type Connections
- type Constraint
- type ConstraintMatchingLog
- type ConstraintType
- type DiskPartition
- type Entity
- type EventType
- type Fru
- type IP
- func (ip *IP) ASN() (int64, error)
- func (ip *IP) AddMachineId(id string)
- func (ip *IP) GetChanged() time.Time
- func (ip *IP) GetCreated() time.Time
- func (ip *IP) GetID() string
- func (ip *IP) GetMachineIds() []string
- func (ip *IP) GetScope() IPScope
- func (ip *IP) HasMachineId(id string) bool
- func (ip *IP) RemoveMachineId(id string)
- func (ip *IP) SetChanged(changed time.Time)
- func (ip *IP) SetCreated(created time.Time)
- func (ip *IP) SetID(id string)
- type IPMI
- type IPScope
- type IPType
- type IPs
- type IPsMap
- type Image
- type ImageFeatureType
- type ImageMap
- type Images
- type LEDState
- type MState
- type MacAddress
- type Machine
- type MachineAllocation
- type MachineCommand
- type MachineEvent
- type MachineExecCommand
- type MachineHardware
- type MachineLiveliness
- type MachineNetwork
- type MachineSetup
- type MachineState
- type Machines
- type NSQTopic
- type Network
- type NetworkMap
- type NetworkUsage
- type Networks
- type Nic
- type NicMap
- type Nics
- type Partition
- type PartitionMap
- type Partitions
- type Prefix
- type Prefixes
- type ProvisioningEvent
- type ProvisioningEventContainer
- type ProvisioningEventContainerMap
- type ProvisioningEventContainers
- type ProvisioningEventType
- type ProvisioningEvents
- type Size
- type SizeMap
- type SizeMatchingLog
- type Sizes
- type Switch
- type SwitchSync
- type VersionClassification
Constants ¶
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" )
const ( CREATE EventType = "create" UPDATE EventType = "update" DELETE EventType = "delete" COMMAND EventType = "command" TopicMachine NSQTopic = "machine" )
Some enums.
const ASNBase = int64(4200000000)
ASNBase is the offset for all Machine ASN´s
Variables ¶
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.
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(expectedBootSequence) // only saved events count )
var ( // AllStates contains all possible values of a machine state AllStates = []MState{AvailableState, ReservedState, LockedState} )
var DefaultImageExpiration = time.Hour * 24 * 90
DefaultImageExpiration if not specified images will last for about 3 month
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, } )
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 ¶
Types ¶
type BIOS ¶
type BIOS struct { Version string `rethinkdb:"version" json:"version"` Vendor string `rethinkdb:"vendor" json:"vendor"` Date string `rethinkdb:"date" json:"date"` }
BIOS contains machine bios information
type Base ¶
type Base struct { ID string `rethinkdb:"id,omitempty" json:"id,omitempty"` Name string `rethinkdb:"name" json:"name"` Description string `rethinkdb:"description" json:"description"` Created time.Time `rethinkdb:"created" json:"created"` Changed time.Time `rethinkdb:"changed" json:"changed"` }
Base implements common fields for most basic entity types (not all).
func (*Base) GetChanged ¶
GetChanged returns the last changed timestamp of the entity
func (*Base) GetCreated ¶
GetCreated returns the creation timestamp of the entity
func (*Base) SetChanged ¶
SetChanged sets the last changed timestamp of the entity
func (*Base) SetCreated ¶
SetCreated sets the creation timestamp of the entity
type BlockDevice ¶
type BlockDevice struct { Name string `rethinkdb:"name" json:"name"` Size uint64 `rethinkdb:"size" json:"size"` Partitions []*DiskPartition `rethinkdb:"partitions" json:"partitions"` Primary bool `rethinkdb:"primary" json:"primary"` }
BlockDevice information.
type BootConfiguration ¶
type BootConfiguration struct { ImageURL string `rethinkdb:"imageurl" json:"imageurl"` KernelURL string `rethinkdb:"kernelurl" json:"kernelurl"` CommandLine string `rethinkdb:"commandline" json:"commandline"` }
BootConfiguration defines the metal-hammer initrd, kernel and commandline
type ChassisIdentifyLEDState ¶
type ChassisIdentifyLEDState struct { Value LEDState `rethinkdb:"value" json:"value"` Description string `rethinkdb:"description" json:"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" json:"nic"` MachineID string `rethinkdb:"machineid" json:"machineid"` }
Connection between switch port and machine.
type ConnectionMap ¶
type ConnectionMap map[string]Connections
ConnectionMap is an indexed map of connection-lists
type Constraint ¶
type Constraint struct { Type ConstraintType `rethinkdb:"type" json:"type"` Min uint64 `rethinkdb:"min" json:"min"` Max uint64 `rethinkdb:"max" json:"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 ¶
func (c *Constraint) Matches(hw MachineHardware) (ConstraintMatchingLog, bool)
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 DiskPartition ¶ added in v0.6.0
type DiskPartition struct { Label string `rethinkdb:"label" json:"label"` Device string `rethinkdb:"device" json:"device"` Number uint `rethinkdb:"number" json:"number"` MountPoint string `rethinkdb:"mountpoint" json:"mountpoint"` MountOptions []string `rethinkdb:"mountoptions" json:"mountoptions"` Size int64 `rethinkdb:"size" json:"size"` Filesystem string `rethinkdb:"filesystem" json:"filesystem"` GPTType string `rethinkdb:"gpttyoe" json:"gpttyoe"` GPTGuid string `rethinkdb:"gptguid" json:"gptguid"` Properties map[string]string `rethinkdb:"properties" json:"properties"` }
DiskPartition defines a disk partition
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 Fru ¶
type Fru struct { ChassisPartNumber string `rethinkdb:"chassis_part_number" json:"chassis_part_number"` ChassisPartSerial string `rethinkdb:"chassis_part_serial" json:"chassis_part_serial"` BoardMfg string `rethinkdb:"board_mfg" json:"board_mfg"` BoardMfgSerial string `rethinkdb:"board_mfg_serial" json:"board_mfg_serial"` BoardPartNumber string `rethinkdb:"board_part_number" json:"board_part_number"` ProductManufacturer string `rethinkdb:"product_manufacturer" json:"product_manufacturer"` ProductPartNumber string `rethinkdb:"product_part_number" json:"product_part_number"` ProductSerial string `rethinkdb:"product_serial" json:"product_serial"` }
Fru (Field Replaceable Unit) data
type IP ¶
type IP struct { IPAddress string `rethinkdb:"id" json:"id"` ParentPrefixCidr string `rethinkdb:"prefix" json:"prefix"` Name string `rethinkdb:"name" json:"name"` Description string `rethinkdb:"description" json:"description"` ProjectID string `rethinkdb:"projectid" json:"projectid"` NetworkID string `rethinkdb:"networkid" json:"networkid"` Type IPType `rethinkdb:"type" json:"type"` Tags []string `rethinkdb:"tags" json:"tags"` Created time.Time `rethinkdb:"created" json:"created"` Changed time.Time `rethinkdb:"changed" json:"changed"` }
IP of a machine/firewall.
func (*IP) ASN ¶
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) GetChanged ¶
GetChanged returns the last changed timestamp of the entity
func (*IP) GetCreated ¶
GetCreated returns the creation timestamp of the entity
func (*IP) GetMachineIds ¶
func (*IP) HasMachineId ¶
func (*IP) RemoveMachineId ¶
func (*IP) SetChanged ¶
SetChanged sets the last changed timestamp of the entity
func (*IP) SetCreated ¶
SetCreated sets the creation timestamp 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" json:"address"` MacAddress string `rethinkdb:"mac" json:"mac"` User string `rethinkdb:"user" json:"user"` Password string `rethinkdb:"password" json:"password"` Interface string `rethinkdb:"interface" json:"interface"` Fru Fru `rethinkdb:"fru" json:"fru"` BMCVersion string `rethinkdb:"bmcversion" json:"bmcversion"` }
IPMI connection data
type Image ¶
type Image struct { Base URL string `rethinkdb:"url" json:"url"` Features map[ImageFeatureType]bool `rethinkdb:"features" json:"features"` // OS is parsed from id and is the first part, specifies operating system derivate, internal usage only OS string `rethinkdb:"os" json:"os"` // Version is parsed from id and is the second part, specifies operating system version, internal usage only Version string `rethinkdb:"version" json:"version"` // ExpirationDate defines the time in the future, when this image is not considered for machine allocations anymore ExpirationDate time.Time `rethinkdb:"expirationDate" json:"expirationDate"` // Classification defines the state of a version (preview, supported, deprecated) // only informational, no action depending on the classification done Classification VersionClassification `rethinkdb:"classification" json:"classification"` }
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 ¶
ImageFeatureString returns the features of an image as a string.
type ImageFeatureType ¶
type ImageFeatureType string
ImageFeatureType specifies the features of a images
const ( // ImageFeatureFirewall from this image only a firewall can created ImageFeatureFirewall ImageFeatureType = "firewall" // ImageFeatureMachine from this image only a machine can created ImageFeatureMachine ImageFeatureType = "machine" )
func ImageFeatureTypeFrom ¶
func ImageFeatureTypeFrom(name string) (ImageFeatureType, error)
ImageFeatureTypeFrom a given name to a ImageFeatureType or error.
type LEDState ¶
type LEDState string
LEDState is the state of the LED of the Machine
func LEDStateFrom ¶
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 ¶
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" json:"allocation"` PartitionID string `rethinkdb:"partitionid" json:"partitionid"` SizeID string `rethinkdb:"sizeid" json:"sizeid"` RackID string `rethinkdb:"rackid" json:"rackid"` Hardware MachineHardware `rethinkdb:"hardware" json:"hardware"` State MachineState `rethinkdb:"state" json:"state"` LEDState ChassisIdentifyLEDState `rethinkdb:"ledstate" json:"ledstate"` Tags []string `rethinkdb:"tags" json:"tags"` IPMI IPMI `rethinkdb:"ipmi" json:"ipmi"` BIOS BIOS `rethinkdb:"bios" json:"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) IsFirewall ¶
IsFirewall returns true if this machine is a firewall machine.
type MachineAllocation ¶
type MachineAllocation struct { Created time.Time `rethinkdb:"created" json:"created"` Name string `rethinkdb:"name" json:"name"` Description string `rethinkdb:"description" json:"description"` Project string `rethinkdb:"project" json:"project"` ImageID string `rethinkdb:"imageid" json:"imageid"` MachineNetworks []*MachineNetwork `rethinkdb:"networks" json:"networks"` Hostname string `rethinkdb:"hostname" json:"hostname"` SSHPubKeys []string `rethinkdb:"sshPubKeys" json:"sshPubKeys"` UserData string `rethinkdb:"userdata" json:"userdata"` ConsolePassword string `rethinkdb:"console_password" json:"console_password"` Succeeded bool `rethinkdb:"succeeded" json:"succeeded"` Reinstall bool `rethinkdb:"reinstall" json:"reinstall"` MachineSetup *MachineSetup `rethinkdb:"setup" json:"setup"` }
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" MachineReinstall MachineCommand = "REINSTALL" ChassisIdentifyLEDOnCmd MachineCommand = "LED-ON" ChassisIdentifyLEDOffCmd MachineCommand = "LED-OFF" )
our supported machines commands.
type MachineEvent ¶
type MachineEvent struct { Type EventType `json:"type,omitempty"` OldMachineID string `json:"old,omitempty"` NewMachineID string `json:"new,omitempty"` Cmd *MachineExecCommand `json:"cmd,omitempty"` }
MachineEvent is propagated when a machine is create/updated/deleted.
type MachineExecCommand ¶
type MachineExecCommand struct { TargetMachineID string `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" json:"memory"` CPUCores int `rethinkdb:"cpu_cores" json:"cpu_cores"` Nics Nics `rethinkdb:"network_interfaces" json:"network_interfaces"` Disks []BlockDevice `rethinkdb:"block_devices" json:"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" json:"networkid"` Prefixes []string `rethinkdb:"prefixes" json:"prefixes"` IPs []string `rethinkdb:"ips" json:"ips"` DestinationPrefixes []string `rethinkdb:"destinationprefixes" json:"destinationprefixes"` Vrf uint `rethinkdb:"vrf" json:"vrf"` Private bool `rethinkdb:"private" json:"private"` ASN int64 `rethinkdb:"asn" json:"asn"` Nat bool `rethinkdb:"nat" json:"nat"` Underlay bool `rethinkdb:"underlay" json:"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 MachineSetup ¶ added in v0.6.0
type MachineSetup struct { ImageID string `rethinkdb:"imageid" json:"imageid"` PrimaryDisk string `rethinkdb:"primarydisk" json:"primarydisk"` OSPartition string `rethinkdb:"ospartition" json:"ospartition"` Initrd string `rethinkdb:"initrd" json:"initrd"` Cmdline string `rethinkdb:"cmdline" json:"cmdline"` Kernel string `rethinkdb:"kernel" json:"kernel"` BootloaderID string `rethinkdb:"bootloaderid" json:"bootloaderid"` }
A MachineSetup stores the data used for machine reinstallations.
type MachineState ¶
type MachineState struct { Value MState `rethinkdb:"value" json:"value"` Description string `rethinkdb:"description" json:"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 ¶
ByProjectID creates a map of machines with the project id as the index.
type Network ¶
type Network struct { Base Prefixes Prefixes `rethinkdb:"prefixes" json:"prefixes"` DestinationPrefixes Prefixes `rethinkdb:"destinationprefixes" json:"destinationprefixes"` PartitionID string `rethinkdb:"partitionid" json:"partitionid"` ProjectID string `rethinkdb:"projectid" json:"projectid"` ParentNetworkID string `rethinkdb:"parentnetworkid" json:"parentnetworkid"` Vrf uint `rethinkdb:"vrf" json:"vrf"` PrivateSuper bool `rethinkdb:"privatesuper" json:"privatesuper"` Nat bool `rethinkdb:"nat" json:"nat"` Underlay bool `rethinkdb:"underlay" json:"underlay"` Labels map[string]string `rethinkdb:"labels" json:"labels"` }
Network is a network in a metal as a service infrastructure. TODO specify rethinkdb restrictions.
func (*Network) FindPrefix ¶
FindPrefix returns the prefix by cidr if contained in this network, nil otherwise
func (*Network) SubstractPrefixes ¶
SubstractPrefixes returns the prefixes of the network minus the prefixes passed in the arguments
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" json:"macAddress"` Name string `rethinkdb:"name" json:"name"` Vrf string `rethinkdb:"vrf" json:"vrf"` Neighbors Nics `rethinkdb:"neighbors" json:"neighbors"` }
Nic information.
type NicMap ¶
type NicMap map[MacAddress]*Nic
type Partition ¶
type Partition struct { Base BootConfiguration BootConfiguration `rethinkdb:"bootconfig" json:"bootconfig"` MgmtServiceAddress string `rethinkdb:"mgmtserviceaddr" json:"mgmtserviceaddr"` PrivateNetworkPrefixLength int `rethinkdb:"privatenetworkprefixlength" json:"privatenetworkprefixlength"` }
A Partition represents a location.
type PartitionMap ¶
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" json:"ip"` Length string `rethinkdb:"length" json:"length"` }
Prefix is a ip with mask, either ipv4/ipv6
func NewPrefixFromCIDR ¶
NewPrefixFromCIDR returns a new prefix from a given cidr.
type ProvisioningEvent ¶
type ProvisioningEvent struct { Time time.Time `rethinkdb:"time" json:"time"` Event ProvisioningEventType `rethinkdb:"event" json:"event"` Message string `rethinkdb:"message" json:"message"` }
ProvisioningEvent is an event emitted by a machine during the provisioning sequence
type ProvisioningEventContainer ¶
type ProvisioningEventContainer struct { Base Liveliness MachineLiveliness `rethinkdb:"liveliness" json:"liveliness"` Events ProvisioningEvents `rethinkdb:"events" json:"events"` LastEventTime *time.Time `rethinkdb:"last_event_time" json:"last_event_time"` IncompleteProvisioningCycles string `rethinkdb:"incomplete_cycles" json:"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 ¶
func (p ProvisioningEventContainers) ByID() ProvisioningEventContainerMap
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" json:"constraints"` }
A Size represents a supported machine size.
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) 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" json:"network_interfaces"` MachineConnections ConnectionMap `rethinkdb:"machineconnections" json:"machineconnections"` PartitionID string `rethinkdb:"partitionid" json:"partitionid"` RackID string `rethinkdb:"rackid" json:"rackid"` LastSync *SwitchSync `rethinkdb:"last_sync" json:"last_sync"` LastSyncError *SwitchSync `rethinkdb:"last_sync_error" json:"last_sync_error"` }
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 ¶
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 SwitchSync ¶ added in v0.7.1
type SwitchSync struct { Time time.Time `rethinkdb:"time" json:"time"` Duration time.Duration `rethinkdb:"duration" json:"duration"` Error *string `rethinkdb:"error" json:"error"` }
SwitchSync contains information about the last synchronization of the state held in the metal-api to a switch.
type VersionClassification ¶ added in v0.7.0
type VersionClassification string
VersionClassification is the logical state of a version
const ( // ClassificationPreview indicates that a version has recently been added and not promoted to "Supported" yet. // ClassificationPreview versions will not be considered for automatic OperatingSystem patch version updates. ClassificationPreview VersionClassification = "preview" // ClassificationSupported indicates that a patch version is the default version for the particular minor version. // There is always exactly one supported OperatingSystem patch version for every still maintained OperatingSystem minor version. // Supported versions are eligible for the automated OperatingSystem patch version update machines. ClassificationSupported VersionClassification = "supported" // ClassificationDeprecated indicates that a patch version should not be used anymore, should be updated to a new version // and will eventually expire. // Every version that is neither in preview nor supported is deprecated. // All patch versions of not supported minor versions are deprecated. ClassificationDeprecated VersionClassification = "deprecated" )
func VersionClassificationFrom ¶ added in v0.7.0
func VersionClassificationFrom(classification string) (VersionClassification, error)
VersionClassificationFrom create a VersionClassification from string