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 Config
- type EndpointHandler
- type EventHandler
- type EventType
- type IPMIConfig
- type MachineCommand
- type MachineEvent
- type MachineExecCommand
- 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 Report
- type Server
- type SwitchEvent
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 {
FindMachines(mac string) (int, []*models.V1MachineResponse)
FindPartition(id string) (*models.V1PartitionResponse, error)
RegisterMachine(machineID string, request *MetalHammerRegisterMachineRequest) (int, *models.V1MachineResponse)
InstallImage(machineID string) (int, *models.V1MachineResponse)
IPMIConfig(machineID string) (*IPMIConfig, error)
AddProvisioningEvent(machineID string, event *models.V1MachineProvisioningEvent) error
FinalizeAllocation(machineID, consolepassword string) (*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 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"`
SwitchTopic string `required:"false" default:"switch" desc:"set the switch topic name" split_words:"true"`
SwitchTopicTTL int `required:"false" default:"30000" desc:"sets the TTL in milliseconds for SwitchTopic" envconfig:"switch_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"`
HMACKey string `required:"true" desc:"the preshared key for the hmac calculation" envconfig:"hmac_key"`
}
type EndpointHandler ¶
type EndpointHandler interface {
NewBootService() *restful.WebService
NewMachineService() *restful.WebService
Boot(request *restful.Request, response *restful.Response)
Install(request *restful.Request, response *restful.Response)
Register(request *restful.Request, response *restful.Response)
Report(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)
PowerOnChassisIdentifyLED(machineID, description string)
PowerOffChassisIdentifyLED(machineID, description string)
ReconfigureSwitch(switchID string) error
}
type IPMIConfig ¶
type IPMIConfig struct {
Hostname string
Port int
Ipmi *models.V1MachineIPMI
}
func (*IPMIConfig) Address ¶
func (i *IPMIConfig) Address() 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" ChassisIdentifyLEDOnCmd MachineCommand = "LED-ON" ChassisIdentifyLEDOffCmd MachineCommand = "LED-OFF" )
type MachineEvent ¶
type MachineEvent struct {
Type EventType `json:"type,omitempty"`
Old *models.V1MachineResponse `json:"old,omitempty"`
New *models.V1MachineResponse `json:"new,omitempty"`
Cmd *MachineExecCommand `json:"cmd,omitempty"`
}
type MachineExecCommand ¶
type MachineExecCommand struct {
Target *models.V1MachineResponse `json:"target,omitempty"`
Command MachineCommand `json:"cmd,omitempty"`
Params []string `json:"params,omitempty"`
}
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 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"`
}
Report is send back to metal-core after installation finished
type SwitchEvent ¶
type SwitchEvent struct {
Type EventType `json:"type"`
Machine models.V1MachineResponse `json:"machine"`
Switches []models.V1SwitchResponse `json:"switches"`
}
Click to show internal directories.
Click to hide internal directories.