Documentation
¶
Index ¶
- Constants
- Variables
- func Conflict(format string, args ...any) error
- func Internal(format string, args ...any) 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 ...any) error
- func ValidateSwitchOSVendor(os SwitchOSVendor) error
- type AddressFamilies
- type AddressFamily
- type AllocationEvent
- type BIOS
- type Base
- type BlockDevice
- type BootConfiguration
- type ChassisIdentifyLEDState
- type ChildPrefixLength
- type Connection
- type ConnectionMap
- type Connections
- type Constraint
- type ConstraintType
- type DNSServer
- type DNSServers
- type Disk
- type DiskPartition
- type EgressRule
- type Entity
- type EventType
- type Filesystem
- type FilesystemLayout
- type FilesystemLayoutConstraints
- type FilesystemLayouts
- type FirewallRules
- type FirmwareKind
- type FirmwareUpdate
- type Format
- type Fru
- type GPTType
- type IP
- 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 IngressRule
- type LEDState
- type LVMType
- type LogicalVolume
- type LogicalVolumes
- type MState
- type MacAddress
- type Machine
- type MachineAllocation
- type MachineCommand
- type MachineEvent
- type MachineExecCommand
- type MachineHardware
- type MachineIPMISuperUser
- type MachineLiveliness
- type MachineNetwork
- type MachineSetup
- type MachineState
- type MachineVPN
- type Machines
- type MetalCPU
- type MetalGPU
- type NATType
- type NSQTopic
- type NTPServer
- type NTPServers
- type Network
- type NetworkMap
- type NetworkType
- type NetworkTypeV2
- type NetworkUsage
- type Networks
- type Nic
- type NicMap
- type NicState
- type Nics
- type Partition
- type PartitionMap
- type Partitions
- type PowerMetric
- type PowerSupplies
- type PowerSupply
- type PowerSupplyStatus
- type Prefix
- type Prefixes
- type Protocol
- type ProvisioningEvent
- type ProvisioningEventContainer
- type ProvisioningEventContainerMap
- type ProvisioningEventContainers
- type ProvisioningEventType
- type ProvisioningEvents
- type Raid
- type RaidLevel
- type Role
- type Size
- type SizeImageConstraint
- type SizeImageConstraints
- type SizeMap
- type SizeReservation
- type SizeReservations
- type Sizes
- type Switch
- type SwitchBGPPortState
- type SwitchEvent
- type SwitchMode
- type SwitchOS
- type SwitchOSVendor
- type SwitchPortStatus
- type SwitchStatus
- type SwitchSync
- type Switches
- type VersionClassification
- type VolumeGroup
Constants ¶
const ( // VFAT is used for the UEFI boot partition VFAT = Format("vfat") // EXT3 is usually only used for /boot EXT3 = Format("ext3") // EXT4 is the default fs EXT4 = Format("ext4") // SWAP is for the swap partition SWAP = Format("swap") // TMPFS is used for a memory filesystem typically /tmp TMPFS = Format("tmpfs") // None NONE = Format("none") // GPTBoot EFI Boot Partition GPTBoot = GPTType("ef00") // GPTLinux Linux Partition GPTLinux = GPTType("8300") // GPTLinuxRaid Linux Raid Partition GPTLinuxRaid = GPTType("fd00") // GPTLinux Linux Partition GPTLinuxLVM = GPTType("8e00") // RaidLevel0 is a stripe of two or more disks RaidLevel0 = RaidLevel("0") // RaidLevel1 is a mirror of two disks RaidLevel1 = RaidLevel("1") // LVMTypeLinear append across all physical volumes LVMTypeLinear = LVMType("linear") // LVMTypeStriped stripe across all physical volumes LVMTypeStriped = LVMType("striped") // LVMTypeStripe mirror with raid across all physical volumes LVMTypeRaid1 = LVMType("raid1") )
const ( // TagIPSeparator is the separator character for key and values in IP-Tags TagIPSeparator = "=" // 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 ( // InvalidAddressFamily identifies a invalid Addressfamily InvalidAddressFamily = AddressFamily("invalid") // IPv4AddressFamily identifies IPv4 IPv4AddressFamily = AddressFamily("IPv4") // IPv6AddressFamily identifies IPv6 IPv6AddressFamily = AddressFamily("IPv6") // NetworkType // ExternalNetworkType identifies a network where ips can be allocated from different projects ExternalNetworkType = NetworkTypeV2("external") // UnderlayNetworkType identifies a underlay network UnderlayNetworkType = NetworkTypeV2("underlay") // SuperNetworkType identifies a super network where child networks can be allocated from SuperNetworkType = NetworkTypeV2("super") // SuperNamespacedNetworkType identifies a super network where child networks can be allocated from, namespaced per project SuperNamespacedNetworkType = NetworkTypeV2("super-namespaced") // ChildNetworkType identifies a child network which is only used in one project for machines and firewalls without external connectivity ChildNetworkType = NetworkTypeV2("child") ChildSharedNetworkType = NetworkTypeV2("child-shared") // NATType InvalidNATType = NATType("invalid") // NoneNATType no nat in place when traffic leaves this network NoneNATType = NATType("none") // IPv4MasqueradeNATType masquerade ipv4 behind gateway ip IPv4MasqueradeNATType = NATType("ipv4-masq") )
Variables ¶
var ( SupportedFormats = map[Format]bool{VFAT: true, EXT3: true, EXT4: true, SWAP: true, TMPFS: true, NONE: true} SupportedGPTTypes = map[GPTType]bool{GPTBoot: true, GPTLinux: true, GPTLinuxLVM: true, GPTLinuxRaid: true} SupportedRaidLevels = map[RaidLevel]bool{RaidLevel0: true, RaidLevel1: true} SupportedLVMTypes = map[LVMType]bool{LVMTypeLinear: true, LVMTypeStriped: true, LVMTypeRaid1: true} )
var ( // AllStates contains all possible values of a machine state AllStates = []MState{AvailableState, ReservedState, LockedState} // AllRoles contains all possible values of a role AllRoles = map[Role]bool{ RoleMachine: true, RoleFirewall: true, } )
var ( Name: mn.PrivatePrimaryUnshared, Private: true, PrivatePrimary: true, Shared: false, Underlay: false, Supported: true, } Name: mn.PrivatePrimaryShared, Private: true, PrivatePrimary: true, Shared: true, Underlay: false, Supported: true, } Name: mn.PrivateSecondaryShared, Private: true, PrivatePrimary: false, Shared: true, Underlay: false, Supported: true, } PrivateSecondaryUnshared = NetworkType{ Name: mn.PrivateSecondaryUnshared, Private: true, PrivatePrimary: false, Shared: false, Underlay: false, Supported: false, } External = NetworkType{ Name: mn.External, Private: false, PrivatePrimary: false, Shared: false, Underlay: false, Supported: true, } Underlay = NetworkType{ Name: mn.Underlay, Private: false, PrivatePrimary: false, Shared: false, Underlay: true, Supported: true, } AllNetworkTypes = []NetworkType{PrivatePrimaryUnshared, PrivatePrimaryShared, PrivateSecondaryShared, PrivateSecondaryUnshared, External, Underlay} )
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 ( TopicMachine = NSQTopic{Name: "machine", PartitionAgnostic: true} TopicAllocation = NSQTopic{Name: "allocation", PartitionAgnostic: false} )
var ( // AllProvisioningEventTypes are all provisioning events that exist AllProvisioningEventTypes = map[ProvisioningEventType]bool{ ProvisioningEventAlive: true, ProvisioningEventCrashed: true, ProvisioningEventPlannedReboot: true, ProvisioningEventPXEBooting: true, ProvisioningEventPreparing: true, ProvisioningEventRegistering: true, ProvisioningEventWaiting: true, ProvisioningEventInstalling: true, ProvisioningEventBootingNewKernel: true, ProvisioningEventPhonedHome: true, ProvisioningEventMachineReclaim: true, } )
var DefaultImageExpiration = time.Hour * 24 * 90
DefaultImageExpiration if not specified images will last for about 3 month
var FirmwareKinds = []string{ FirmwareBIOS, FirmwareBMC, }
var Topics = []NSQTopic{ TopicMachine, TopicAllocation, }
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.
Functions ¶
func Internal ¶
Internal creates a new Internal error with a given error message and the original error.
func ValidateSwitchOSVendor ¶ added in v0.38.0
func ValidateSwitchOSVendor(os SwitchOSVendor) error
Types ¶
type AddressFamilies ¶ added in v0.40.0
type AddressFamilies []AddressFamily
Network is a network in a metal as a service infrastructure. TODO specify rethinkdb restrictions.
type AddressFamily ¶ added in v0.40.0
type AddressFamily string
AddressFamily identifies IPv4/IPv6
func ToAddressFamily ¶ added in v0.40.0
func ToAddressFamily(af string) (AddressFamily, error)
ToAddressFamily will convert a string af to a AddressFamily
type AllocationEvent ¶ added in v0.8.1
type AllocationEvent struct {
MachineID string `json:"old,omitempty"`
}
AllocationEvent is propagated when a machine is allocated.
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"`
}
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 ChildPrefixLength ¶ added in v0.40.0
type ChildPrefixLength map[AddressFamily]uint8
Network is a network in a metal as a service infrastructure. TODO specify rethinkdb restrictions.
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
func (ConnectionMap) ByNicName ¶ added in v0.8.0
func (c ConnectionMap) ByNicName() (map[string]Connection, error)
ByNicName builds a map of nic names to machine connection
type Constraint ¶
type Constraint struct {
Type ConstraintType `rethinkdb:"type" json:"type"`
Min uint64 `rethinkdb:"min" json:"min"`
Max uint64 `rethinkdb:"max" json:"max"`
Identifier string `rethinkdb:"identifier" json:"identifier" description:"glob of the identifier of this type"`
}
A Constraint describes the hardware constraints for a given size.
type ConstraintType ¶
type ConstraintType string
ConstraintType ...
const ( CoreConstraint ConstraintType = "cores" MemoryConstraint ConstraintType = "memory" StorageConstraint ConstraintType = "storage" GPUConstraint ConstraintType = "gpu" )
come constraint types
type DNSServer ¶ added in v0.39.0
type DNSServer struct {
IP string `rethinkdb:"ip" json:"ip" description:"ip address of this dns server"`
}
type DNSServers ¶ added in v0.39.0
type DNSServers []DNSServer
func (DNSServers) Validate ¶ added in v0.39.0
func (d DNSServers) Validate() error
type Disk ¶ added in v0.15.0
type Disk struct {
// Device is the full device path
Device string `rethinkdb:"device" json:"device"`
// Partitions to create on this device
Partitions []DiskPartition `rethinkdb:"partitions" json:"partitions"`
// WipeOnReinstall, if set to true the whole disk will be erased if reinstall happens
// during fresh install all disks are wiped
WipeOnReinstall bool `rethinkdb:"wipeonreinstall" json:"wipeonreinstall"`
}
Disk represents a single block device visible from the OS, required
type DiskPartition ¶ added in v0.6.0
type DiskPartition struct {
// Number of this partition, will be added to partitionprefix
Number uint8 `rethinkdb:"number" json:"number"`
// Label to enhance readability
Label *string `rethinkdb:"label" json:"label"`
// Size of this partition in mebibytes (MiB)
// if "0" is given the rest of the device will be used, this requires Number to be the highest in this partition
Size uint64 `rethinkdb:"size" json:"size"`
// GPTType defines the GPT partition type
GPTType *GPTType `rethinkdb:"gpttype" json:"gpttype"`
}
DiskPartition is a single partition on a device, only GPT partition types are supported
type EgressRule ¶ added in v0.27.0
type EgressRule struct {
Protocol Protocol `rethinkdb:"protocol" json:"protocol"`
Ports []int `rethinkdb:"ports" json:"ports"`
To []string `rethinkdb:"to" json:"to"`
Comment string `rethinkdb:"comment" json:"comment"`
}
func (EgressRule) Validate ¶ added in v0.27.0
func (r EgressRule) Validate() error
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 Filesystem ¶ added in v0.15.0
type Filesystem struct {
// Path defines the mountpoint, if nil, it will not be mounted
Path *string `rethinkdb:"path" json:"path"`
// Device where the filesystem is created on, must be the full device path seen by the OS
Device string `rethinkdb:"device" json:"device"`
// Format is the type of filesystem should be created
Format Format `rethinkdb:"format" json:"format"`
// Label is optional enhances readability
Label *string `rethinkdb:"label" json:"label"`
// MountOptions which might be required
MountOptions []string `rethinkdb:"mountoptions" json:"mountoptions"`
// CreateOptions during filesystem creation
CreateOptions []string `rethinkdb:"createoptions" json:"createoptions"`
}
Filesystem defines a single filesystem to be mounted
type FilesystemLayout ¶ added in v0.15.0
type FilesystemLayout struct {
Base
// Filesystems to create on the server
Filesystems []Filesystem `rethinkdb:"filesystems" json:"filesystem"`
// Disks to configure in the server with their partitions
Disks []Disk `rethinkdb:"disks" json:"disks"`
// Raid if not empty, create raid arrays out of the individual disks, to place filesystems onto
Raid []Raid `rethinkdb:"raid" json:"raid"`
// VolumeGroups to create
VolumeGroups []VolumeGroup `rethinkdb:"volumegroups" json:"volumegroups"`
// LogicalVolumes to create on top of VolumeGroups
LogicalVolumes LogicalVolumes `rethinkdb:"logicalvolumes" json:"logicalvolumes"`
// Constraints which must match to select this Layout
Constraints FilesystemLayoutConstraints `rethinkdb:"constraints" json:"constraints"`
}
FilesystemLayout to be created on the given machine
func (*FilesystemLayout) IsReinstallable ¶ added in v0.15.0
func (fl *FilesystemLayout) IsReinstallable() bool
IsReinstallable returns true if at least one disk configures has WipeOnReInstall set, otherwise false
func (*FilesystemLayout) Matches ¶ added in v0.15.0
func (fl *FilesystemLayout) Matches(hardware MachineHardware) error
Matches the specific FilesystemLayout against the selected Hardware
func (*FilesystemLayout) Validate ¶ added in v0.15.0
func (f *FilesystemLayout) Validate() error
Validate a existing FilesystemLayout
type FilesystemLayoutConstraints ¶ added in v0.15.0
type FilesystemLayoutConstraints struct {
// Sizes defines the list of sizes this layout applies to
Sizes []string `rethinkdb:"sizes" json:"sizes"`
// Images defines a map from os to versionconstraint
// the combination of os and versionconstraint per size must be conflict free over all filesystemlayouts
Images map[string]string `rethinkdb:"images" json:"images"`
}
type FilesystemLayouts ¶ added in v0.15.0
type FilesystemLayouts []FilesystemLayout
FilesystemLayouts is a slice of FilesystemLayout
func (FilesystemLayouts) From ¶ added in v0.15.0
func (fls FilesystemLayouts) From(size, image string) (*FilesystemLayout, error)
From will pick a filesystemlayout from all filesystemlayouts which matches given size and image
func (FilesystemLayouts) Validate ¶ added in v0.15.0
func (fls FilesystemLayouts) Validate() error
Validate ensures that for all Filesystemlayouts not more than one constraint matches the same size and image constraint
type FirewallRules ¶ added in v0.27.0
type FirewallRules struct {
Egress []EgressRule `rethinkdb:"egress" json:"egress"`
Ingress []IngressRule `rethinkdb:"ingress" json:"ingress"`
}
type FirmwareKind ¶ added in v0.18.6
type FirmwareKind = string
const ( FirmwareBIOS FirmwareKind = "bios" FirmwareBMC FirmwareKind = "bmc" )
type FirmwareUpdate ¶ added in v0.18.6
type FirmwareUpdate struct {
Kind FirmwareKind `json:"kind"`
URL string `json:"url"`
}
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"`
// AllocationID will be randomly generated during IP creation and helps identifying the point in time
// when an IP was created. This is not the primary key!
// This field can help to distinguish whether an IP address was re-acquired or
// if it is still the same ip address as before.
AllocationUUID string `rethinkdb:"allocationuuid" json:"allocationuuid"`
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) 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"`
PowerState string `rethinkdb:"powerstate" json:"powerstate"`
PowerMetric *PowerMetric `rethinkdb:"powermetric" json:"powermetric"`
PowerSupplies PowerSupplies `rethinkdb:"powersupplies" json:"powersupplies"`
LastUpdated time.Time `rethinkdb:"last_updated" json:"last_updated"`
}
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 IngressRule ¶ added in v0.27.0
type IngressRule struct {
Protocol Protocol `rethinkdb:"protocol" json:"protocol"`
Ports []int `rethinkdb:"ports" json:"ports"`
To []string `rethinkdb:"to" json:"to"`
From []string `rethinkdb:"from" json:"from"`
Comment string `rethinkdb:"comment" json:"comment"`
}
func (IngressRule) Validate ¶ added in v0.27.0
func (r IngressRule) Validate() 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 LogicalVolume ¶ added in v0.15.0
type LogicalVolume struct {
// Name the name of the logical volume, without /dev prefix, will be accessible at /dev/vgname/lvname
Name string `rethinkdb:"name" json:"name"`
// VolumeGroup the name of the volumegroup
VolumeGroup string `rethinkdb:"volumegroup" json:"volumegroup"`
// Size of this LV in mebibytes (MiB), if zero all remaining space in the vg will be used.
Size uint64 `rethinkdb:"size" json:"size"`
// LVMType can be either linear, striped or raid1
LVMType LVMType `rethinkdb:"lvmtype" json:"lvmtype"`
}
LogicalVolume is a block devices created with lvm on top of a volumegroup
type LogicalVolumes ¶ added in v0.16.0
type LogicalVolumes []LogicalVolume
LogicalVolumes is a slice of LogicalVolume
type MState ¶
type MState string
A MState is an enum which indicates the state of a machine
const ( // AvailableState describes a machine state where a machine is available for an allocation AvailableState MState = "" // ReservedState describes a machine state where a machine is not being considered for random allocation ReservedState MState = "RESERVED" // LockedState describes a machine state where a machine cannot be deleted or allocated anymore LockedState MState = "LOCKED" )
func MachineStateFrom ¶
MachineStateFrom converts a machineState string to the type
type MacAddress ¶
type MacAddress string
A MacAddress is the type for mac addresses. 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"`
Waiting bool `rethinkdb:"waiting" json:"waiting"`
PreAllocated bool `rethinkdb:"preallocated" json:"preallocated"`
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 {
Creator string `rethinkdb:"creator" json:"creator"`
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"`
FilesystemLayout *FilesystemLayout `rethinkdb:"filesystemlayout" json:"filesystemlayout"`
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"`
Role Role `rethinkdb:"role" json:"role"`
VPN *MachineVPN `rethinkdb:"vpn" json:"vpn"`
UUID string `rethinkdb:"uuid" json:"uuid"`
FirewallRules *FirewallRules `rethinkdb:"firewall_rules" json:"firewall_rules"`
DNSServers DNSServers `rethinkdb:"dns_servers" json:"dns_servers"`
NTPServers NTPServers `rethinkdb:"ntp_servers" json:"ntp_servers"`
}
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" MachineCycleCmd MachineCommand = "CYCLE" MachineBiosCmd MachineCommand = "BIOS" MachineDiskCmd MachineCommand = "DISK" MachinePxeCmd MachineCommand = "PXE" MachineReinstallCmd MachineCommand = "REINSTALL" ChassisIdentifyLEDOnCmd MachineCommand = "LED-ON" ChassisIdentifyLEDOffCmd MachineCommand = "LED-OFF" UpdateFirmwareCmd MachineCommand = "UPDATE-FIRMWARE" )
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"`
IPMI *IPMI `json:"ipmi,omitempty"`
FirmwareUpdate *FirmwareUpdate `json:"firmwareupdate,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"`
Nics Nics `rethinkdb:"network_interfaces" json:"network_interfaces"`
Disks []BlockDevice `rethinkdb:"block_devices" json:"block_devices"`
MetalCPUs []MetalCPU `rethinkdb:"cpus" json:"cpus"`
MetalGPUs []MetalGPU `rethinkdb:"gpus" json:"gpus"`
}
MachineHardware stores the data which is collected by our system on the hardware when it registers itself.
func (*MachineHardware) ReadableSpec ¶
func (hw *MachineHardware) ReadableSpec() string
ReadableSpec returns a human readable string for the hardware.
type MachineIPMISuperUser ¶ added in v0.22.5
type MachineIPMISuperUser struct {
// contains filtered or unexported fields
}
func DisabledIPMISuperUser ¶ added in v0.22.5
func DisabledIPMISuperUser() MachineIPMISuperUser
func NewIPMISuperUser ¶ added in v0.22.5
func NewIPMISuperUser(log *slog.Logger, path string) MachineIPMISuperUser
func (*MachineIPMISuperUser) IsEnabled ¶ added in v0.22.5
func (i *MachineIPMISuperUser) IsEnabled() bool
func (*MachineIPMISuperUser) Password ¶ added in v0.22.5
func (i *MachineIPMISuperUser) Password() string
func (*MachineIPMISuperUser) User ¶ added in v0.22.5
func (i *MachineIPMISuperUser) User() string
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.
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"`
PrivatePrimary bool `rethinkdb:"privateprimary" json:"privateprimary"`
Private bool `rethinkdb:"private" json:"private"`
ASN uint32 `rethinkdb:"asn" json:"asn"`
Nat bool `rethinkdb:"nat" json:"nat"`
Underlay bool `rethinkdb:"underlay" json:"underlay"`
// The following 3 properties are persisted only for new machines, existing machine allocations will be updated
// This required to enable forward compatibility to apiv2
// TODO carry over these properties to metal-apiserver as well
ProjectID string `rethinkdb:"projectid" json:"projectid"`
NetworkTypeV2 NetworkTypeV2 `rethinkdb:"networktype" json:"networktype"`
NATTypeV2 NATType `rethinkdb:"nattype" json:"nattype"`
}
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
func (*MachineNetwork) Is ¶ added in v0.10.0
func (mn *MachineNetwork) Is(n NetworkType) bool
Is checks whether the machine network has the given type
func (*MachineNetwork) NetworkType ¶ added in v0.10.0
func (mn *MachineNetwork) NetworkType() (*NetworkType, error)
NetworkType determines the network type based on the flags stored in the db entity.
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"`
Issuer string `rethinkdb:"issuer" json:"issuer,omitempty"`
MetalHammerVersion string `rethinkdb:"metal_hammer_version" json:"metal_hammer_version"`
}
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 MachineVPN ¶ added in v0.20.0
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.
func (Machines) WithPartition ¶ added in v0.26.1
type NATType ¶ added in v0.42.0
type NATType string
Network is a network in a metal as a service infrastructure. TODO specify rethinkdb restrictions.
type NTPServer ¶ added in v0.39.0
type NTPServer struct {
Address string `address:"address" json:"address" description:"ip address or dns hostname of this ntp server"`
}
type NTPServers ¶ added in v0.39.0
type NTPServers []NTPServer
func (NTPServers) Validate ¶ added in v0.39.0
func (n NTPServers) Validate() error
type Network ¶
type Network struct {
Base
Prefixes Prefixes `rethinkdb:"prefixes" json:"prefixes"`
DestinationPrefixes Prefixes `rethinkdb:"destinationprefixes" json:"destinationprefixes"`
DefaultChildPrefixLength ChildPrefixLength `` /* 170-byte string literal not displayed */
PartitionID string `rethinkdb:"partitionid" json:"partitionid"`
ProjectID string `rethinkdb:"projectid" json:"projectid"`
ParentNetworkID string `rethinkdb:"parentnetworkid" json:"parentnetworkid"`
Vrf uint `rethinkdb:"vrf" json:"vrf"`
Labels map[string]string `rethinkdb:"labels" json:"labels"`
AdditionalAnnouncableCIDRs []string `` /* 240-byte string literal not displayed */
NetworkType *NetworkTypeV2 `rethinkdb:"networktype"`
NATType *NATType `rethinkdb:"nattype"`
// PrivateSuper if set identifies this Network as a Super Network for private networks
//
// Deprecated: use SuperNetworkType instead
PrivateSuper bool `rethinkdb:"privatesuper"`
// Underlay if set indicates as a underlay network for firewalls and switches
//
// Deprecated: use UnderlayNetworkType instead
Underlay bool `rethinkdb:"underlay"`
//
// Deprecated: use ChildSharedNetworkType instead
Shared bool `rethinkdb:"shared"`
// Nat if set, traffic entering this network is masqueraded behind the interface entering this network
//
// Deprecated: use IPv4MasqueradeNATType instead
Nat bool `rethinkdb:"nat"`
}
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) SubtractPrefixes ¶ added in v0.28.5
SubtractPrefixes returns the prefixes of the network minus the prefixes passed in the arguments
type NetworkType ¶ added in v0.10.0
type NetworkType struct {
Name string `json:"name,omitempty"`
Private bool `json:"private,omitempty"`
PrivatePrimary bool `json:"private_primary,omitempty"`
Underlay bool `json:"underlay,omitempty"`
Supported bool `json:"-"`
}
NetworkType represents the type of a network
func (NetworkType) String ¶ added in v0.10.0
func (n NetworkType) String() string
type NetworkTypeV2 ¶ added in v0.42.0
type NetworkTypeV2 string
Network is a network in a metal as a service infrastructure. TODO specify rethinkdb restrictions.
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 2 bit 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 networks where the id is the index.
type Nic ¶
type Nic struct {
MacAddress MacAddress `rethinkdb:"macAddress" json:"macAddress"`
Name string `rethinkdb:"name" json:"name"`
Identifier string `rethinkdb:"identifier" json:"identifier"`
Vrf string `rethinkdb:"vrf" json:"vrf"`
Neighbors Nics `rethinkdb:"neighbors" json:"neighbors"`
Hostname string `rethinkdb:"hostname" json:"hostname"`
State *NicState `rethinkdb:"state" json:"state"`
BGPPortState *SwitchBGPPortState `rethinkdb:"bgpPortState" json:"bgpPortState"`
}
Nic information.
func (*Nic) GetIdentifier ¶ added in v0.22.2
GetIdentifier returns the identifier of a nic. It returns the mac address as a fallback if no identifier was found. (this is for backwards compatibility with old metal-core and metal-hammer versions)
type NicState ¶ added in v0.28.5
type NicState struct {
Desired *SwitchPortStatus `rethinkdb:"desired" json:"desired"`
Actual SwitchPortStatus `rethinkdb:"actual" json:"actual"`
}
NicState represents the desired and actual state of a network interface controller (NIC). The Desired field indicates the intended state of the NIC, while Actual indicates its current operational state. The Desired state will be removed when the actual state is equal to the desired state.
func (*NicState) SetState ¶ added in v0.28.5
func (ns *NicState) SetState(s SwitchPortStatus) (NicState, bool)
SetState updates the NicState with the given SwitchPortStatus. It returns a new NicState and a bool indicating if the state was changed.
If the given status matches the current Actual state, it checks if Desired is set and matches too. If so, Desired is set to nil since the desired state has been reached.
If the given status differs from the current Actual state, Desired is left unchanged if it differs from the new state so the desired state is still tracked. The Actual state is updated to the given status.
This allows tracking both the desired and actual states, while clearing Desired once the desired state is achieved.
func (*NicState) WantState ¶ added in v0.28.5
func (ns *NicState) WantState(s SwitchPortStatus) (NicState, bool)
WantState sets the desired state for the NIC. It returns a new NicState struct with the desired state set and a bool indicating if the state changed. If the current state already matches the desired state, it returns a state with a cleared desired field.
type Nics ¶
type Nics []Nic
Nics is a list of nics.
func (Nics) ByIdentifier ¶ added in v0.22.2
ByIdentifier creates a map (nic identifier --> nic) from a nic list.
func (Nics) FilterByHostname ¶ added in v0.22.2
type Partition ¶
type Partition struct {
Base
BootConfiguration BootConfiguration `rethinkdb:"bootconfig" json:"bootconfig"`
MgmtServiceAddress string `rethinkdb:"mgmtserviceaddr" json:"mgmtserviceaddr"`
Labels map[string]string `rethinkdb:"labels" json:"labels"`
DNSServers DNSServers `rethinkdb:"dns_servers" json:"dns_servers"`
NTPServers NTPServers `rethinkdb:"ntp_servers" json:"ntp_servers"`
}
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 where the id is the index.
type PowerMetric ¶ added in v0.21.5
type PowerMetric struct {
// AverageConsumedWatts shall represent the
// average power level that occurred averaged over the last IntervalInMin
// minutes.
AverageConsumedWatts float32 `rethinkdb:"averageconsumedwatts" json:"averageconsumedwatts"`
// IntervalInMin shall represent the time
// interval (or window), in minutes, in which the PowerMetrics properties
// are measured over.
// Should be an integer, but some Dell implementations return as a float.
IntervalInMin float32 `rethinkdb:"intervalinmin" json:"intervalinmin"`
// MaxConsumedWatts shall represent the
// maximum power level in watts that occurred within the last
// IntervalInMin minutes.
MaxConsumedWatts float32 `rethinkdb:"maxconsumedwatts" json:"maxconsumedwatts"`
// MinConsumedWatts shall represent the
// minimum power level in watts that occurred within the last
// IntervalInMin minutes.
MinConsumedWatts float32 `rethinkdb:"minconsumedwatts" json:"minconsumedwatts"`
}
type PowerSupplies ¶ added in v0.37.1
type PowerSupplies []PowerSupply
type PowerSupply ¶ added in v0.37.1
type PowerSupply struct {
// Status shall contain any status or health properties
// of the resource.
Status PowerSupplyStatus `rethinkdb:"status" json:"status"`
}
type PowerSupplyStatus ¶ added in v0.37.1
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 FIXME this should be converted to simply a string
func NewPrefixFromCIDR ¶
NewPrefixFromCIDR returns a new prefix from a given cidr.
type Prefixes ¶
type Prefixes []Prefix
Prefixes is an array of prefixes
func NewPrefixesFromCIDRs ¶ added in v0.40.0
func (Prefixes) AddressFamilies ¶ added in v0.40.0
func (p Prefixes) AddressFamilies() AddressFamilies
AddressFamilies returns the addressfamilies of given prefixes. be aware that malformed prefixes are just skipped, so do not use this for validation or something.
func (Prefixes) OfFamily ¶ added in v0.40.0
func (p Prefixes) OfFamily(af AddressFamily) Prefixes
OfFamily returns the prefixes of the given address family. be aware that malformed prefixes are just skipped, so do not use this for validation or something.
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"`
LastErrorEvent *ProvisioningEvent `rethinkdb:"last_error_event" json:"last_error_event"`
CrashLoop bool `rethinkdb:"crash_loop" json:"crash_loop"`
FailedMachineReclaim bool `rethinkdb:"failed_machine_reclaim" json:"failed_machine_reclaim"`
}
ProvisioningEventContainer stores the provisioning events of a machine
func (*ProvisioningEventContainer) TrimEvents ¶
func (p *ProvisioningEventContainer) TrimEvents(maxCount int)
TrimEvents trim the events to maxCount
func (*ProvisioningEventContainer) Validate ¶ added in v0.19.0
func (c *ProvisioningEventContainer) Validate() error
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" 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" ProvisioningEventMachineReclaim ProvisioningEventType = "Machine Reclaim" )
The enums for the machine provisioning events.
func (ProvisioningEventType) String ¶ added in v0.19.0
func (t ProvisioningEventType) String() string
type ProvisioningEvents ¶
type ProvisioningEvents []ProvisioningEvent
ProvisioningEvents is just a list of ProvisioningEvents
type Raid ¶ added in v0.15.0
type Raid struct {
// ArrayName of the raid device, most often this will be /dev/md0 and so forth
ArrayName string `rethinkdb:"arrayname" json:"arrayname"`
// Devices the devices to form a raid device
Devices []string `rethinkdb:"devices" json:"devices"`
// Level the raidlevel to use, can be one of 0,1
Level RaidLevel `rethinkdb:"raidlevel" json:"raidlevel"`
// CreateOptions required during raid creation, example: --metadata=1.0 for uefi boot partition
CreateOptions []string `rethinkdb:"createoptions" json:"createoptions"`
// Spares defaults to 0
Spares int `rethinkdb:"spares" json:"spares"`
}
Raid is optional, if given the devices must match.
type Size ¶
type Size struct {
Base
Constraints []Constraint `rethinkdb:"constraints" json:"constraints"`
Labels map[string]string `rethinkdb:"labels" json:"labels"`
}
A Size represents a supported machine size.
func UnknownSize ¶
func UnknownSize() *Size
UnknownSize is the size to use, when someone requires a size we do not know.
func (*Size) Overlaps ¶ added in v0.11.4
Overlaps returns nil if Size does not overlap with any other size, otherwise returns overlapping Size
func (*Size) Validate ¶ added in v0.26.0
func (s *Size) Validate(partitions PartitionMap) error
Validate a size, returns error if a invalid size is passed
type SizeImageConstraint ¶ added in v0.16.3
type SizeImageConstraint struct {
Base
// Images a map from imageID to semver compatible matcher string
// example:
// images:
// ubuntu: ">= 20.04.20211011"
// debian: ">= 10.0.20210101"
Images map[string]string `rethinkdb:"images" json:"images"`
}
SizeImageConstraint expresses optional restrictions for specific size to image combinations this might be required if the support for a specific hardware in a given size is only supported with a newer version of the image.
If the size in question is not found, no restrictions apply. If the image in question is not found, no restrictions apply as well. If the image in question is found, but does not match the given expression, machine creation must be forbidden.
func (*SizeImageConstraint) Matches ¶ added in v0.16.3
func (sc *SizeImageConstraint) Matches(size Size, image Image) error
func (*SizeImageConstraint) Validate ¶ added in v0.16.3
func (sc *SizeImageConstraint) Validate() error
type SizeImageConstraints ¶ added in v0.16.3
type SizeImageConstraints []SizeImageConstraint
SizeImageConstraints is a slice of ImageConstraint
func (*SizeImageConstraints) Matches ¶ added in v0.16.3
func (scs *SizeImageConstraints) Matches(size Size, image Image) error
func (*SizeImageConstraints) Validate ¶ added in v0.16.3
func (scs *SizeImageConstraints) Validate() error
type SizeReservation ¶ added in v0.36.0
type SizeReservation struct {
Base
SizeID string `rethinkdb:"sizeid" json:"sizeid"`
Amount int `rethinkdb:"amount" json:"amount"`
ProjectID string `rethinkdb:"projectid" json:"projectid"`
PartitionIDs []string `rethinkdb:"partitionids" json:"partitionids"`
Labels map[string]string `rethinkdb:"labels" json:"labels"`
}
SizeReservation defines a reservation of a size for machine allocations
func (*SizeReservation) Validate ¶ added in v0.36.0
func (r *SizeReservation) Validate(sizes SizeMap, partitions PartitionMap, projects map[string]*mdmv1.Project) error
type SizeReservations ¶ added in v0.36.0
type SizeReservations []SizeReservation
func (*SizeReservations) BySize ¶ added in v0.36.0
func (rs *SizeReservations) BySize() map[string]SizeReservations
func (*SizeReservations) ForPartition ¶ added in v0.36.0
func (rs *SizeReservations) ForPartition(partitionID string) SizeReservations
func (*SizeReservations) Validate ¶ added in v0.36.0
func (rs *SizeReservations) Validate(sizes SizeMap, partitions PartitionMap, projects map[string]*mdmv1.Project) error
type Sizes ¶
type Sizes []Size
Sizes is a list of sizes.
func (Sizes) FromHardware ¶
func (sz Sizes) FromHardware(hardware MachineHardware) (*Size, 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"`
Mode SwitchMode `rethinkdb:"mode" json:"mode"`
OS *SwitchOS `rethinkdb:"os" json:"os"`
ManagementIP string `rethinkdb:"management_ip" json:"management_ip"`
ManagementUser string `rethinkdb:"management_user" json:"management_user"`
ConsoleCommand string `rethinkdb:"console_command" json:"console_command"`
}
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 checks if a machine is physically connected to the switch and updates the switch's connections if necessary
func (*Switch) MapPortNames ¶ added in v0.38.0
func (s *Switch) MapPortNames(targetOS SwitchOSVendor) (map[string]string, error)
MapPortNames creates a dictionary that maps the naming convention of this switch's OS to that of the target OS
func (*Switch) SetVrfOfMachine ¶ added in v0.18.0
SetVrfOfMachine set port on switch where machine is connected to given vrf
func (*Switch) TranslateNicMap ¶ added in v0.38.0
func (s *Switch) TranslateNicMap(targetOS SwitchOSVendor) (NicMap, error)
TranslateNicMap creates a NicMap where the keys are translated to the naming convention of the target OS
example mapping from cumulus to sonic for one single port:
map[string]Nic {
"swp1s1": Nic{
Name: "Ethernet1",
MacAddress: ""
}
}
type SwitchBGPPortState ¶ added in v0.39.5
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.
type SwitchMode ¶ added in v0.8.0
type SwitchMode string
A SwitchMode is an enum which indicates the mode of a switch
const ( SwitchOperational SwitchMode = "operational" SwitchReplace SwitchMode = "replace" )
The enums for the switch modes.
func SwitchModeFrom ¶ added in v0.8.0
func SwitchModeFrom(name string) SwitchMode
SwitchModeFrom converts a switch mode string to the type
type SwitchOS ¶ added in v0.22.1
type SwitchOS struct {
Vendor SwitchOSVendor `rethinkdb:"vendor" json:"vendor"`
Version string `rethinkdb:"version" json:"version"`
MetalCoreVersion string `rethinkdb:"metal_core_version" json:"metal_core_version"`
}
type SwitchOSVendor ¶ added in v0.38.0
type SwitchOSVendor string
SwitchOSVendor is an enum denoting the name of a switch OS
const ( SwitchOSVendorSonic SwitchOSVendor = "SONiC" SwitchOSVendorCumulus SwitchOSVendor = "Cumulus" )
The enums for switch OS vendors
type SwitchPortStatus ¶ added in v0.28.5
type SwitchPortStatus string
SwitchPortStatus is a type alias for a string that represents the status of a switch port. Valid values are defined as constants in this package.
const ( SwitchPortStatusUnknown SwitchPortStatus = "UNKNOWN" SwitchPortStatusUp SwitchPortStatus = "UP" SwitchPortStatusDown SwitchPortStatus = "DOWN" )
SwitchPortStatus defines the possible statuses for a switch port. UNKNOWN indicates the status is not known. UP indicates the port is up and operational. DOWN indicates the port is down and not operational.
func (SwitchPortStatus) IsConcrete ¶ added in v0.28.5
func (s SwitchPortStatus) IsConcrete() bool
IsConcrete returns true if the SwitchPortStatus is UP or DOWN, which are concrete, known statuses. It returns false if the status is UNKNOWN, which indicates the status is not known.
func (SwitchPortStatus) IsValid ¶ added in v0.28.5
func (s SwitchPortStatus) IsValid() bool
IsValid returns true if the SwitchPortStatus is a known valid value (UP, DOWN, UNKNOWN).
type SwitchStatus ¶ added in v0.22.8
type SwitchStatus struct {
Base
LastSync *SwitchSync `rethinkdb:"last_sync" json:"last_sync" description:"last successful synchronization to the switch" optional:"true"`
LastSyncError *SwitchSync `` /* 134-byte string literal not displayed */
}
SwitchStatus stores the received switch notifications in a separate table
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
type VolumeGroup ¶ added in v0.15.0
type VolumeGroup struct {
// Name of the volumegroup without the /dev prefix
Name string `rethinkdb:"name" json:"name"`
// Devices the devices to form a volumegroup device
Devices []string `rethinkdb:"devices" json:"devices"`
// Tags to attach to the volumegroup
Tags []string `rethinkdb:"tags" json:"tags"`
}
VolumeGroup is optional, if given the devices must match.