Documentation ¶
Index ¶
- func GetTemplate(name string) (string, error)
- func GetTemplateList() []string
- type Cluster
- type Credentials
- type Hypervisor
- type Image
- type Instance
- type Libvirt
- func (h *Libvirt) Create(machine *Machine) error
- func (h *Libvirt) Delete(machine *Machine) error
- func (h *Libvirt) ForceStop(machine *Machine) error
- func (h *Libvirt) Start(machine *Machine) error
- func (h *Libvirt) Status(machine *Machine) (string, error)
- func (h *Libvirt) Stop(machine *Machine) error
- type LocalTemplate
- type Machine
- func (machine *Machine) CopyContent(origin string, dest string) error
- func (machine *Machine) Create() error
- func (machine *Machine) CreateDir() error
- func (machine *Machine) CreateDisks() error
- func (machine *Machine) Delete() error
- func (machine *Machine) DownloadImage() error
- func (machine *Machine) ForceStop() error
- func (machine *Machine) GetVMs() []Machine
- func (machine *Machine) Prepare() error
- func (machine *Machine) RunInitScripts() error
- func (machine *Machine) Shell() error
- func (machine *Machine) Start() error
- func (machine *Machine) Status() (string, error)
- func (machine *Machine) Stop() error
- func (machine *Machine) Wait() error
- type Mount
- type Network
- type Qemu
- type RemoteTemplate
- type Resources
- type Scripts
- type Templater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTemplate ¶
func GetTemplateList ¶
func GetTemplateList() []string
GetTemplateList gets the list of available templates
Types ¶
type Cluster ¶
type Cluster struct { Kind string `yaml:"kind"` // Kind of the resource, should be 'Cluster' Name string `yaml:"name"` // Name of the cluster. Must be unique in the system Params map[string]string `yaml:"params"` // Parameters for the cluster Instances []Machine `yaml:"machines"` // List of machines in the cluster Results []string `yaml:"results"` }
Cluster holds the configuration details for a cluster of machines
type Credentials ¶
type Credentials struct { Username string `yaml:"username,omitempty"` // Username for the machine Password string `yaml:"password,omitempty"` // Password for the machine Groups []string `yaml:"groups,omitempty"` // User groups for the machine }
Credentials holds the username, password, and user groups
type Hypervisor ¶
type Hypervisor interface { Create(machine *Machine) error Start(machine *Machine) error Stop(machine *Machine) error ForceStop(machine *Machine) error Status(machine *Machine) (string, error) Delete(machine *Machine) error }
Hypervisor is an interface for interacting with the hypervisor
type Image ¶
type Image struct { URL string `yaml:"url,omitempty"` // URL of the machine image Checksum string `yaml:"checksum,omitempty"` // Checksum for the image in the format 'algorithm:hash' }
Image holds the URL and checksum of the machine image
type Instance ¶
type Instance struct { Kind string Machines []Machine Config config.Config Hypervisor Hypervisor }
func NewInstance ¶
NewInstance is a factory function that returns an instance of KindManager.
type Libvirt ¶
type Libvirt struct{}
Libvirt is a struct that represents the libvirt hypervisor
func (*Libvirt) Delete ¶
Delete is a method for the libvirt hypervisor that deletes a created machine
func (*Libvirt) ForceStop ¶
ForceStop is a method for the libvirt hypervisor that force stops a running/stuck machine
type LocalTemplate ¶
type LocalTemplate struct {
// contains filtered or unexported fields
}
LocalTemplate represents a local file-based template
func (*LocalTemplate) Load ¶
func (f *LocalTemplate) Load() (*Instance, error)
Load is a method on the LocalTemplate struct that implements the Templater interface. It reads the content of the template from the local file system, parses it, and returns a corresponding KindManager.
type Machine ¶
type Machine struct { Kind string `yaml:"kind"` // Kind of the resource, should be 'Machine' Name string `yaml:"name,omitempty"` // Name of the machine. Must be unique in the system Extends string `yaml:"extends,omitempty"` // Name of the Machine to extend Replicas int `yaml:"replicas,omitempty"` // Number of Replicas (used with kind Cluster) Image Image `yaml:"image,omitempty"` // Image details for the machine Credentials Credentials `yaml:"credentials,omitempty"` // Credentials for the machine Resources Resources `yaml:"resources,omitempty"` // Hardware resources for the machine Scripts Scripts `yaml:"scripts,omitempty"` // Scripts to run in the machine Mount Mount `yaml:"mount,omitempty"` // Mount point details Network Network `yaml:"network,omitempty"` // Network configuration Connection string `yaml:"connection,omitempty"` // Connection to hypervisor Variant string `yaml:"variant,omitempty"` // OS variant to use Hypervisor Hypervisor `yaml:"-"` Runner osutil.Runner `yaml:"-"` // contains filtered or unexported fields }
Machine holds the configuration details for a single machine
func GetMachine ¶
GetMachine loads the YAML file content into the struct
func (*Machine) CopyContent ¶
Copies content from host to guest or vice-versa
func (*Machine) CreateDisks ¶
CreateDisks creates the disks for the machine
func (*Machine) DownloadImage ¶
DownloadImage downloads the image for the machine
func (*Machine) RunInitScripts ¶
Runs the initial scripts after the machine is created
type Mount ¶
type Mount struct { Name string `yaml:"name,omitempty"` // Name of the mount point HostPath string `yaml:"hostPath,omitempty"` // Path in the host GuestPath string `yaml:"guestPath,omitempty"` // Path inside the VM }
Mount holds the hostPath and guestPath for mounting host folders into the VM
type Network ¶
type Network struct { NicName string `yaml:"nicName,omitempty"` // Name of the interface IPAddress string `yaml:"ipAddress,omitempty"` // IP Address of the machine Gateway string `yaml:"gateway,omitempty"` // Gateway of the network MacAddress string `yaml:"macAddress,omitempty"` // MacAddress of the NIC }
Network holds the network configuration
type RemoteTemplate ¶
type RemoteTemplate struct {
// contains filtered or unexported fields
}
RemoteTemplate represents a template that needs to be fetched from a remote source
func (*RemoteTemplate) Load ¶
func (f *RemoteTemplate) Load() (*Instance, error)
Load is a method on the RemoteTemplate struct that implements the Templater interface. It reads the content of the template from the local file system, parses it, and returns a corresponding KindManager.
type Resources ¶
type Resources struct { CPUs string `yaml:"cpus,omitempty"` // Number of CPUs for the machine Memory string `yaml:"memory,omitempty"` // Amount of RAM for the machine Disk string `yaml:"disk,omitempty"` // Disk space for the machine }
Resources holds the hardware specifications of the machine
type Scripts ¶
type Scripts struct { Install string `yaml:"install,omitempty"` // Installation script to run in the machine Init string `yaml:"init,omitempty"` // Initialisation script to run when machine starts }
Scripts holds the installation and initialisation scripts
type Templater ¶
type Templater interface { // Load method is responsible for loading the template // and returning an instance of KindManager and error if any occurs during the loading Load() (*Instance, error) }
Templater is an interface for loading different types of templates
func NewTemplate ¶
NewTemplate is a factory function that returns an instance of Templater. It determines the type of Templater (LocalTemplate or RemoteTemplate) based on whether a file with the given name exists on the local file system.