machine

package
v0.0.0-...-4ef6c67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindFreeKubeApiPort

func FindFreeKubeApiPort() (int, error)

func FindFreePort

func FindFreePort() (int, error)

func FindFreeSSHPort

func FindFreeSSHPort() (int, error)

func ForEachProvisioner

func ForEachProvisioner(iter func(p Provisioner))

func RegisterProvisioner

func RegisterProvisioner(p Provisioner, fac FactoryFunc) error

Types

type CpuInfo

type CpuInfo struct {
	Processors []*ProcessorInfo
}

func NewCpuInfoParser

func NewCpuInfoParser(str string) (*CpuInfo, error)

func NewCpuInfoParserHelper

func NewCpuInfoParserHelper(str string, err error) (*CpuInfo, error)

func (*CpuInfo) NumCPUs

func (c *CpuInfo) NumCPUs() int

type ExportPortPair

type ExportPortPair struct {
	HostPort      int
	ContainerPort int
}

type FactoryFunc

type FactoryFunc func(logger log.Logger, dir string, verbose bool) MachineCURDFactory

type GpuInfo

type GpuInfo struct {
	DriverVersion string
	Gpus          []*PerGpuInfo
}

func NewGpuInfoParser

func NewGpuInfoParser(str string) (*GpuInfo, error)

func NewGpuInfoParserHelper

func NewGpuInfoParserHelper(str string, err error) (*GpuInfo, error)

func (*GpuInfo) Info

func (g *GpuInfo) Info() string

type GpuMemInfo

type GpuMemInfo struct {
	// contains filtered or unexported fields
}

func (*GpuMemInfo) Free

func (g *GpuMemInfo) Free() string

func (*GpuMemInfo) Total

func (g *GpuMemInfo) Total() string

type MachineCURD

type MachineCURD interface {
	Name() string
	Type() MachineType
	// HostDir returns the configuration files used for that particular machine under host
	GetKubeCli() *kubectl.CLI
	GetKubeConfig() string
	HostDir() string
	Up() error
	Destroy() error
	Info() (*MachineInfo, error)
	ExportKubeConfig(path string, forceOverwrite bool) error
}

type MachineCURDFactory

type MachineCURDFactory interface {
	EnsureRuntime() error
	NewMachine(string, MachineConfiger) (MachineCURD, error)
	ListMachines() ([]MachineCURD, error)
}

func NewMachineFactory

func NewMachineFactory(provisioner Provisioner, logger log.Logger, dir string, verbose bool) (MachineCURDFactory, error)

type MachineConfiger

type MachineConfiger interface {
	GetCPUs() int
	GetMemory() int // in M bytes
	GetGPUs() int
	GetKubeAPIIP() string
	GetExportPorts() []ExportPortPair
	GetForceOverwriteConfig() bool
	AuditEnabled() bool
	GetWorkers() int
	GetNodeLabels() []NodeLabel
	GetLocalPath() string
}

type MachineInfo

type MachineInfo struct {
	CpuInfo *CpuInfo
	MemInfo *MemInfo
	GpuInfo *GpuInfo
	KubeApi string
	Status  string
}

type MachineType

type MachineType string
const (
	MachineTypeDocker  MachineType = "docker"
	MachineTypeVagrant MachineType = "vagrant"
)

func (MachineType) String

func (m MachineType) String() string

type MemInfo

type MemInfo struct {
	// contains filtered or unexported fields
}

func NewMemInfoParser

func NewMemInfoParser(str string) (*MemInfo, error)

func NewMemInfoParserHelper

func NewMemInfoParserHelper(str string, err error) (*MemInfo, error)

func (*MemInfo) Free

func (m *MemInfo) Free() string

func (*MemInfo) Total

func (m *MemInfo) Total() string

type NodeLabel

type NodeLabel struct {
	Key   string
	Value string
}

type PerGpuInfo

type PerGpuInfo struct {
	GpuName    string
	GpuMemInfo GpuMemInfo
}

type ProcessorInfo

type ProcessorInfo struct {
	Id         int64
	PhysicalId int64
	CoreId     int64
}

type Provisioner

type Provisioner string
const (
	Unknwon Provisioner = "unknown"
)

func MustParseProvisioner

func MustParseProvisioner(s string) Provisioner

func ParseProvisioner

func ParseProvisioner(s string) (Provisioner, error)

func (Provisioner) String

func (p Provisioner) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL