Documentation
¶
Index ¶
- func IPMIAddress(ipmi *models.V1MachineIPMI) string
- func IPMIInterface(ipmi *models.V1MachineIPMI) string
- func IPMIMAC(ipmi *models.V1MachineIPMI) string
- func IPMIPassword(ipmi *models.V1MachineIPMI) string
- func IPMIUser(ipmi *models.V1MachineIPMI) string
- type APIClient
- type AppContext
- func (a *AppContext) APIClient() APIClient
- func (a *AppContext) EndpointHandler() EndpointHandler
- func (a *AppContext) EventHandler() EventHandler
- func (a *AppContext) InitHMAC()
- func (a *AppContext) Server() Server
- func (a *AppContext) SetAPIClient(apiClient func(*AppContext) APIClient)
- func (a *AppContext) SetEndpointHandler(endpointHandler func(*AppContext) EndpointHandler)
- func (a *AppContext) SetEventHandler(eventHandler func(*AppContext) EventHandler)
- func (a *AppContext) SetServer(server func(*AppContext) Server)
- type BootConfig
- type BootResponse
- type ChangeBootOrder
- type Config
- type EndpointHandler
- type EventHandler
- type EventType
- type GrpcResponse
- type IPMIConfig
- type MachineCommand
- type MachineEvent
- type MachineExecCommand
- type MetalHammerAbortReinstallRequest
- type MetalHammerRegisterMachineRequest
- func (r *MetalHammerRegisterMachineRequest) IPMIAddress() string
- func (r *MetalHammerRegisterMachineRequest) IPMIInterface() string
- func (r *MetalHammerRegisterMachineRequest) IPMIMAC() string
- func (r *MetalHammerRegisterMachineRequest) IPMIPassword() string
- func (r *MetalHammerRegisterMachineRequest) IPMIUser() string
- type ProvisioningEventType
- type Report
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IPMIAddress ¶
func IPMIAddress(ipmi *models.V1MachineIPMI) string
func IPMIInterface ¶
func IPMIInterface(ipmi *models.V1MachineIPMI) string
func IPMIMAC ¶
func IPMIMAC(ipmi *models.V1MachineIPMI) string
func IPMIPassword ¶
func IPMIPassword(ipmi *models.V1MachineIPMI) string
func IPMIUser ¶
func IPMIUser(ipmi *models.V1MachineIPMI) string
Types ¶
type APIClient ¶
type APIClient interface {
Emit(eventType ProvisioningEventType, machineID, message string) error
AddProvisioningEvent(machineID string, event *models.V1MachineProvisioningEvent) error
FindMachine(id string) (*models.V1MachineResponse, error)
FindMachines(mac string) (int, []*models.V1MachineResponse)
FindPartition(id string) (*models.V1PartitionResponse, error)
RegisterMachine(machineID string, request *MetalHammerRegisterMachineRequest) (int, *models.V1MachineResponse)
AbortReinstall(machineID string, request *MetalHammerAbortReinstallRequest) (int, *models.V1BootInfo)
IPMIConfig(machineID string) (*IPMIConfig, error)
FinalizeAllocation(machineID, consolePassword string, report *Report) (*machine.FinalizeAllocationOK, error)
RegisterSwitch() (*models.V1SwitchResponse, error)
ConstantlyPhoneHome()
SetChassisIdentifyLEDStateOn(machineID, description string) error
SetChassisIdentifyLEDStateOff(machineID, description string) error
}
type AppContext ¶
type AppContext struct {
*Config
*BootConfig
MachineClient *machine.Client
SwitchClient *sw.Client
PartitionClient *partition.Client
Auth runtime.ClientAuthInfoWriter
DevMode bool
// contains filtered or unexported fields
}
func (*AppContext) APIClient ¶
func (a *AppContext) APIClient() APIClient
func (*AppContext) EndpointHandler ¶
func (a *AppContext) EndpointHandler() EndpointHandler
func (*AppContext) EventHandler ¶
func (a *AppContext) EventHandler() EventHandler
func (*AppContext) InitHMAC ¶
func (a *AppContext) InitHMAC()
func (*AppContext) Server ¶
func (a *AppContext) Server() Server
func (*AppContext) SetAPIClient ¶
func (a *AppContext) SetAPIClient(apiClient func(*AppContext) APIClient)
func (*AppContext) SetEndpointHandler ¶
func (a *AppContext) SetEndpointHandler(endpointHandler func(*AppContext) EndpointHandler)
func (*AppContext) SetEventHandler ¶
func (a *AppContext) SetEventHandler(eventHandler func(*AppContext) EventHandler)
func (*AppContext) SetServer ¶
func (a *AppContext) SetServer(server func(*AppContext) Server)
type BootConfig ¶
type BootResponse ¶
type ChangeBootOrder ¶ added in v0.5.0
type Config ¶
type Config struct {
// Valid log levels are: DEBUG, INFO, WARN, ERROR, FATAL and PANIC
CIDR string `required:"true" desc:"set the metal core CIDR"`
PartitionID string `required:"true" desc:"set the partition ID" envconfig:"partition_id"`
RackID string `required:"true" desc:"set the rack ID" envconfig:"rack_id"`
BindAddress string `required:"false" default:"0.0.0.0" desc:"set server bind address" split_words:"true"`
MetricsServerPort int `required:"false" default:"2112" desc:"the port of the metrics server" split_words:"true"`
MetricsServerBindAddress string `required:"false" default:"0.0.0.0" desc:"the bind addr of the metrics server" split_words:"true"`
Port int `required:"false" default:"4242" desc:"set server port"`
LogLevel string `required:"false" default:"info" desc:"set log level" split_words:"true"`
ConsoleLogging bool `required:"false" default:"true" desc:"enable/disable console logging" split_words:"true"`
ApiProtocol string `required:"false" default:"http" desc:"set metal api protocol" envconfig:"metal_api_protocol"`
ApiIP string `required:"false" default:"localhost" desc:"set metal api address" envconfig:"metal_api_ip"`
ApiPort int `required:"false" default:"8080" desc:"set metal api port" envconfig:"metal_api_port"`
ApiBasePath string `required:"false" default:"" desc:"set metal api basepath" envconfig:"metal_api_basepath"`
MQAddress string `required:"false" default:"localhost:4161" desc:"set the MQ server address" envconfig:"mq_address"`
MQCACertFile string `required:"false" default:"" desc:"the CA certificate file for verifying MQ certificate" envconfig:"mq_ca_cert_file"`
MQClientCertFile string `required:"false" default:"" desc:"the client certificate file for accessing MQ" envconfig:"mq_client_cert_file"`
MQLogLevel string `required:"false" default:"info" desc:"sets the MQ loglevel (debug, info, warn, error)" envconfig:"mq_loglevel"`
MachineTopic string `required:"false" default:"machine" desc:"set the machine topic name" split_words:"true"`
MachineTopicTTL int `required:"false" default:"30000" desc:"sets the TTL in milliseconds for MachineTopic" envconfig:"machine_topic_ttl"`
LoopbackIP string `required:"false" default:"10.0.0.11" desc:"set the loopback ip address that is used with BGP unnumbered" split_words:"true"`
ASN string `required:"false" default:"420000011" desc:"set the ASN that is used with BGP"`
SpineUplinks string `required:"false" default:"swp31,swp32" desc:"set the ports that are connected to spines" split_words:"true"`
ManagementGateway string `required:"false" default:"192.168.0.1" desc:"the default gateway for the management network" split_words:"true"`
ReconfigureSwitch bool `required:"false" default:"false" desc:"let metal-core reconfigure the switch" split_words:"true"`
ReconfigureSwitchInterval time.Duration `required:"false" default:"10s" desc:"pull interval to fetch and apply switch configuration" split_words:"true"`
AdditionalBridgeVIDs []string `` /* 129-byte string literal not displayed */
AdditionalBridgePorts []string `` /* 134-byte string literal not displayed */
ChangeBootOrder bool `required:"false" default:"true" desc:"issue ipmi commands to change boot order" split_words:"true"`
InterfacesTplFile string `` /* 162-byte string literal not displayed */
FrrTplFile string `` /* 149-byte string literal not displayed */
HMACKey string `required:"true" desc:"the preshared key for the hmac calculation" envconfig:"hmac_key"`
GrpcAddress string `required:"true" default:"" desc:"the gRPC address" envconfig:"grpc_address"`
GrpcCACertFile string `required:"false" desc:"the gRPC CA certificate file" envconfig:"grpc_ca_cert_file"`
GrpcClientCertFile string `required:"false" desc:"the gRPC client certificate file" envconfig:"grpc_client_cert_file"`
GrpcClientKeyFile string `required:"false" desc:"the gRPC client key file" envconfig:"grpc_client_key_file"`
}
type EndpointHandler ¶
type EndpointHandler interface {
NewBootService() *restful.WebService
NewMachineService() *restful.WebService
NewCertsService() *restful.WebService
FindMachine(request *restful.Request, response *restful.Response)
Boot(request *restful.Request, response *restful.Response)
AbortReinstall(request *restful.Request, response *restful.Response)
Register(request *restful.Request, response *restful.Response)
Report(request *restful.Request, response *restful.Response)
GrpcClientCert(request *restful.Request, response *restful.Response)
}
type EventHandler ¶
type EventHandler interface {
FreeMachine(machineID string)
PowerOnMachine(machineID string)
PowerOffMachine(machineID string)
PowerResetMachine(machineID string)
BootBiosMachine(machineID string)
ReinstallMachine(machineID string)
PowerOnChassisIdentifyLED(machineID, description string)
PowerOffChassisIdentifyLED(machineID, description string)
ReconfigureSwitch()
}
type GrpcResponse ¶ added in v0.6.0
type IPMIConfig ¶
type IPMIConfig struct {
Hostname string
Port int
Ipmi *models.V1MachineIPMI
}
func (*IPMIConfig) Address ¶
func (i *IPMIConfig) Address() string
func (*IPMIConfig) IPMIConnection ¶ added in v0.6.0
func (i *IPMIConfig) IPMIConnection() (string, int, string, string)
func (*IPMIConfig) Interface ¶
func (i *IPMIConfig) Interface() string
func (*IPMIConfig) Mac ¶
func (i *IPMIConfig) Mac() string
func (*IPMIConfig) Password ¶
func (i *IPMIConfig) Password() string
func (*IPMIConfig) User ¶
func (i *IPMIConfig) User() string
type MachineCommand ¶
type MachineCommand 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" )
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"`
}
type MachineExecCommand ¶
type MachineExecCommand struct {
TargetMachineID string `json:"target,omitempty"`
Command MachineCommand `json:"cmd,omitempty"`
Params []string `json:"params,omitempty"`
}
type MetalHammerAbortReinstallRequest ¶ added in v0.5.0
type MetalHammerAbortReinstallRequest struct {
PrimaryDiskWiped bool `json:"primary_disk_wiped" description:"whether the primary disk is already wiped"`
}
type MetalHammerRegisterMachineRequest ¶
type MetalHammerRegisterMachineRequest struct {
models.V1MachineHardwareExtended
UUID string `json:"uuid,omitempty" description:"the uuid of the machine to register"`
IPMI *models.V1MachineIPMI `json:"ipmi" description:"the IPMI connection configuration"`
BIOS *models.V1MachineBIOS `json:"bios" description:"the Bios configuration"`
}
func (*MetalHammerRegisterMachineRequest) IPMIAddress ¶
func (r *MetalHammerRegisterMachineRequest) IPMIAddress() string
func (*MetalHammerRegisterMachineRequest) IPMIInterface ¶
func (r *MetalHammerRegisterMachineRequest) IPMIInterface() string
func (*MetalHammerRegisterMachineRequest) IPMIMAC ¶
func (r *MetalHammerRegisterMachineRequest) IPMIMAC() string
func (*MetalHammerRegisterMachineRequest) IPMIPassword ¶
func (r *MetalHammerRegisterMachineRequest) IPMIPassword() string
func (*MetalHammerRegisterMachineRequest) IPMIUser ¶
func (r *MetalHammerRegisterMachineRequest) IPMIUser() string
type ProvisioningEventType ¶ added in v0.5.0
type ProvisioningEventType string
ProvisioningEventType indicates an event emitted by a machine during the provisioning sequence FIXME factor out to metal-lib
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" ProvisioningEventReinstallAborted ProvisioningEventType = "Reinstall Aborted" )
The enums for the machine provisioning events.
type Report ¶
type Report struct {
Success bool `json:"success,omitempty" description:"true if installation succeeded"`
Message string `json:"message" description:"if installation failed, the error message"`
ConsolePassword string `json:"console_password" description:"the console password which was generated while provisioning"`
PrimaryDisk string `json:"primary_disk" description:"the disk having a partition on which the OS is installed"`
OSPartition string `json:"os_partition" description:"the partition on which the OS is installed"`
Initrd string `json:"initrd" description:"the initrd"`
Cmdline string `json:"cmdline" description:"the cmdline"`
Kernel string `json:"kernel" description:"the kernel"`
BootloaderID string `json:"bootloaderid" description:"the bootloader ID"`
}
Report is sent by metal-hammer to metal-core after installation finished
Click to show internal directories.
Click to hide internal directories.