Documentation
¶
Index ¶
- Constants
- Variables
- func InitTPMConfig(ctx context.Context, svcCfg *ServiceConfig) error
- func SetupCtrlRuntimeLogs()
- type Config
- type ConfigSwitchType
- type LinkConfig
- type Server
- type ServerConnectivityTestConfig
- type Service
- func (svc *Service) List() error
- func (svc *Service) RunTests(ctx context.Context, cfg testing.RunnerConfig) error
- func (svc *Service) SSH(name string, args []string) error
- func (svc *Service) Serial(name string) error
- func (svc *Service) SetupPeerings(ctx context.Context, cfg SetupPeeringsConfig) error
- func (svc *Service) SetupVPCs(ctx context.Context, cfg SetupVPCsConfig) error
- func (svc *Service) StartServer(killStaleVMs bool, charNBDDev string, installComplete bool, runComplete string, ...) error
- func (svc *Service) TestConnectivity(ctx context.Context, cfg ServerConnectivityTestConfig) error
- func (svc *Service) VFIOPCIBindAll() error
- type ServiceConfig
- type SetupPeeringsConfig
- type SetupVPCsConfig
- type SwitchConfig
- type VM
- func (vm *VM) OnieEepromConfig() (string, error)
- func (vm *VM) Prepare(ctx context.Context, svcCfg *ServiceConfig) error
- func (vm *VM) Run(ctx context.Context, eg *errgroup.Group, svc *Service)
- func (vm *VM) RunInstall(ctx context.Context, svc *Service) func() error
- func (vm *VM) RunTPM(ctx context.Context, svcCfg *ServiceConfig) func() error
- func (vm *VM) RunVM(ctx context.Context, svcCfg *ServiceConfig) func() error
- func (vm *VM) UUID() string
- type VMConfig
- type VMInterface
- type VMManager
- type VMType
- type VMsConfig
Constants ¶
View Source
const ( HHFabCfgPrefix = ".hhfab.fabric.githedgehog.com" HHFabCfgType = "type" + HHFabCfgPrefix HHFabCfgSerial = "serial" + HHFabCfgPrefix HHFabCfgLinkPrefix = "link" + HHFabCfgPrefix + "/" HHFabCfgPCIPrefix = "pci@" HHFabCfgSerialSchemeSSH = "ssh://" HHFabCfgSerialSchemeTelnet = "telnet://" )
View Source
const ( VPCSetupTypeVPCPerServer = "vpc-per-server" VPCSetupTypeSingleVPC = "single-vpc" VPCSetupTypeVPCSubnetPerServer = "subnet-per-server" )
View Source
const ( MACAddrTmpl = "0c:20:12:fe:%02d:%02d" // if changing update onie-qcow2-eeprom-edit config too KubePort = 6443 RegistryPort = 31000 SSHPortBase = 22000 IfPortBase = 30000 IfPortNull = IfPortBase + 9000 IfPortVMIDMult = 100 IfPortPortIDMult = 1 )
View Source
const ( VMSelectorSSH = "ssh" VMSelectorAll = "all" )
View Source
const ( VMSizeDefault = "default" // meaningful VM sizes for dev & testing VMSizeCompact = "compact" // minimal working setup, applied on top of default VMSizeFull = "full" // full setup as specified in requirements and more real switch resources, applied on top of default VMSizeHuge = "huge" // full setup with more resources for servers, applied on top of default VirtualEdgeAnnotation = "external.hhfab.fabric.githedgehog.com/dest" // HHFAB annotation to specify destination for external connection )
View Source
const (
IfacesPerPCIBridge = 32
)
Variables ¶
View Source
var CompactControlVM = VMConfig{
CPU: 4,
RAM: 4096,
Disk: 50,
}
View Source
var CompactServerVM = VMConfig{
CPU: 1,
}
View Source
var CompactSwitchVM = VMConfig{
CPU: 3,
RAM: 3584,
Disk: 30,
}
View Source
var DefaultControlVM = VMConfig{
CPU: 6,
RAM: 6144,
Disk: 100,
}
View Source
var DefaultServerVM = VMConfig{
CPU: 2,
RAM: 768,
Disk: 10,
}
View Source
var DefaultSwitchVM = VMConfig{
CPU: 4,
RAM: 5120,
Disk: 50,
}
View Source
var FullControlVM = VMConfig{
CPU: 8,
RAM: 16384,
Disk: 250,
}
View Source
var FullServerVM = VMConfig{
RAM: 2048,
}
View Source
var FullSwitchVM = VMConfig{
RAM: 8192,
}
View Source
var HugeControlVM = VMConfig{
CPU: 8,
RAM: 16384,
Disk: 250,
}
View Source
var HugeServerVM = VMConfig{
CPU: 4,
RAM: 8192,
}
View Source
var HugeSwitchVM = VMConfig{
RAM: 8192,
}
View Source
var RequiredCommands = []string{
"qemu-system-x86_64",
"qemu-img",
"tpm2",
"swtpm_setup",
"ssh",
"scp",
"sudo",
}
View Source
var SSHQuietFlags = []string{
"-o", "GlobalKnownHostsFile=/dev/null",
"-o", "UserKnownHostsFile=/dev/null",
"-o", "StrictHostKeyChecking=no",
"-o", "LogLevel=ERROR",
}
View Source
var VMSizes = []string{VMSizeDefault, VMSizeCompact, VMSizeFull, VMSizeHuge}
View Source
var VPCSetupTypes = []string{ VPCSetupTypeVPCPerServer, }
Functions ¶
func InitTPMConfig ¶
func InitTPMConfig(ctx context.Context, svcCfg *ServiceConfig) error
Makes sure that swtpm config is initialized before we start VMs
func SetupCtrlRuntimeLogs ¶ added in v0.15.1
func SetupCtrlRuntimeLogs()
TODO properly handle logging config for ctrl runtime
Types ¶
type Config ¶
type Config struct { VMs VMsConfig `json:"vms,omitempty"` Switches map[string]SwitchConfig `json:"switches,omitempty"` Links map[string]LinkConfig `json:"links,omitempty"` }
type ConfigSwitchType ¶ added in v0.6.0
type ConfigSwitchType string
const ( ConfigSwitchTypeVS ConfigSwitchType = "vs" ConfigSwitchTypeHW ConfigSwitchType = "hw" )
type LinkConfig ¶ added in v0.6.0
type LinkConfig struct {
PCIAddress string `json:"pci,omitempty"`
}
type Server ¶ added in v0.6.18
type Server struct { Name string VM *VM ConnectedTo []string ConnectionType string Server *wiringapi.Server Connection *wiringapi.Connection VPCAttachment *vpcapi.VPCAttachment VPC *vpcapi.VPC Subnet string ExternalPeering *vpcapi.ExternalPeering InVPCPeers []string VPCPeers []string Externals []string IP string }
type ServerConnectivityTestConfig ¶ added in v0.6.18
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func Load ¶
func Load(cfg *ServiceConfig) (*Service, error)
func (*Service) SetupPeerings ¶ added in v0.7.1
func (svc *Service) SetupPeerings(ctx context.Context, cfg SetupPeeringsConfig) error
TODO move vpc creation to here, just have flag --vpc-per-server
func (*Service) SetupVPCs ¶ added in v0.7.1
func (svc *Service) SetupVPCs(ctx context.Context, cfg SetupVPCsConfig) error
func (*Service) StartServer ¶
func (*Service) TestConnectivity ¶ added in v0.7.1
func (svc *Service) TestConnectivity(ctx context.Context, cfg ServerConnectivityTestConfig) error
func (*Service) VFIOPCIBindAll ¶ added in v0.6.0
type ServiceConfig ¶ added in v0.6.0
type ServiceConfig struct { DryRun bool Size string SudoSwtpm bool CharNBDDev string InstallComplete bool RunComplete string OnReady []string RestrictServers bool Basedir string Wiring *wiring.Data ControlIgnition string ServerIgnitionDir string ControlInstaller string ServerInstaller string FilesDir string SSHKey string }
type SetupPeeringsConfig ¶ added in v0.7.1
type SetupVPCsConfig ¶ added in v0.7.1
type SetupVPCsConfig struct {
Type string
}
type SwitchConfig ¶ added in v0.6.0
type SwitchConfig struct { Type ConfigSwitchType `json:"type,omitempty"` Serial string `json:"serial,omitempty"` }
type VM ¶
type VM struct { ID int Name string Type VMType Basedir string Config VMConfig Interfaces map[int]VMInterface Ready fileMarker Installed fileMarker }
func (*VM) OnieEepromConfig ¶ added in v0.6.0
type VMConfig ¶ added in v0.6.0
type VMConfig struct { CPU int `json:"cpu,omitempty"` // in cores RAM int `json:"ram,omitempty"` // in MB Disk int `json:"disk,omitempty"` // in GB }
func (VMConfig) DefaultsFrom ¶ added in v0.6.0
func (VMConfig) OverrideBy ¶ added in v0.6.0
type VMInterface ¶ added in v0.6.0
type VMManager ¶ added in v0.6.0
type VMManager struct {
// contains filtered or unexported fields
}
func NewVMManager ¶ added in v0.6.0
func (*VMManager) LogOverview ¶ added in v0.6.0
func (mngr *VMManager) LogOverview()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.