Documentation
¶
Overview ¶
Package driverqemu implements a kutti driver for QEMU/KVM on Linux using libvirt. It orchestrates VMs and networks via the system-wide libvirt daemon (qemu:///system) through the virsh command line utility.
For cluster networking, it creates dedicated virtual networks for each cluster with their own bridge interface and NAT routing. For VM creation, it copies a cached Debian QCOW2 image and defines KVM domains. IP addresses are leased from dnsmasq and kept stable using static DHCP host mappings.
Index ¶
- Constants
- Variables
- type Driver
- func (d *Driver) DeleteMachine(machinename string, clustername string) error
- func (d *Driver) DeleteNetwork(clustername string) error
- func (d *Driver) Description() string
- func (d *Driver) Error() string
- func (d *Driver) GetImage(k8sversion string) (drivercore.Image, error)
- func (d *Driver) GetMachine(machinename string, clustername string) (drivercore.Machine, error)
- func (d *Driver) K8sVersions() []string
- func (d *Driver) ListImages() ([]drivercore.Image, error)
- func (d *Driver) Name() string
- func (d *Driver) NewMachine(machinename string, clustername string, k8sversion string) (drivercore.Machine, error)
- func (d *Driver) NewNetwork(clustername string) (drivercore.Network, error)
- func (d *Driver) QualifiedMachineName(machinename string, clustername string) string
- func (d *Driver) QualifiedNetworkName(clustername string) string
- func (d *Driver) Status() string
- func (d *Driver) UpdateImageList() error
- func (d *Driver) UsesNATNetworking() bool
- func (d *Driver) UsesPerClusterNetworking() bool
- func (d *Driver) ValidK8sVersion(k8sversion string) bool
- type Image
- type Machine
- func (m *Machine) Error() string
- func (m *Machine) ExecuteCommand(command drivercore.PredefinedCommand, params ...string) error
- func (m *Machine) ForceStop() error
- func (m *Machine) ForwardPort(hostport int, machineport int) error
- func (m *Machine) ForwardSSHPort(hostport int) error
- func (m *Machine) IPAddress() string
- func (m *Machine) ImplementsCommand(command drivercore.PredefinedCommand) bool
- func (m *Machine) Name() string
- func (m *Machine) SSHAddress() string
- func (m *Machine) Start() error
- func (m *Machine) Status() drivercore.MachineStatus
- func (m *Machine) Stop() error
- func (m *Machine) UnforwardPort(machineport int) error
- func (m *Machine) WaitForStateChange(timeoutinseconds int)
- type Network
Constants ¶
const ImagesVersion = "0.1"
ImagesVersion defines the image repository version for the current version of the driver.
Variables ¶
var ImagesSourceURL = "https://github.com/kuttiproject/driver-qemu-images/releases/download/v" + ImagesVersion + "/" + imagesConfigFile
ImagesSourceURL is the location where the master list of images can be found.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements the drivercore.Driver interface for QEMU/libvirt.
func (*Driver) DeleteMachine ¶
DeleteMachine stops, undefines the VM, removes its lease, and deletes its disk file.
func (*Driver) DeleteNetwork ¶
DeleteNetwork destroys and undefines the libvirt virtual network.
func (*Driver) Description ¶
Description returns a short description of the driver.
func (*Driver) GetImage ¶
func (d *Driver) GetImage(k8sversion string) (drivercore.Image, error)
GetImage returns an image corresponding to a Kubernetes version, or an error.
func (*Driver) GetMachine ¶
GetMachine returns a Machine instance if defined in libvirt.
func (*Driver) K8sVersions ¶
K8sVersions returns all Kubernetes versions currently supported by kutti.
func (*Driver) ListImages ¶
func (d *Driver) ListImages() ([]drivercore.Image, error)
ListImages lists the currently available Images.
func (*Driver) NewMachine ¶
func (d *Driver) NewMachine(machinename string, clustername string, k8sversion string) (drivercore.Machine, error)
NewMachine defines a new QEMU VM in libvirt and configures its static DHCP lease.
func (*Driver) NewNetwork ¶
func (d *Driver) NewNetwork(clustername string) (drivercore.Network, error)
NewNetwork creates a new libvirt NAT-based bridge network with an unused IP subnet.
func (*Driver) QualifiedMachineName ¶
QualifiedMachineName returns the qualified name of a machine.
func (*Driver) QualifiedNetworkName ¶
QualifiedNetworkName returns the name of the libvirt network for the given cluster.
func (*Driver) UpdateImageList ¶
UpdateImageList fetches the latest list of VM images from the driver source URL.
func (*Driver) UsesNATNetworking ¶
UsesNATNetworking returns false. The host bridge directly routes traffic to guest IPs without port forwarding.
func (*Driver) UsesPerClusterNetworking ¶
UsesPerClusterNetworking returns true as we build dedicated networks.
func (*Driver) ValidK8sVersion ¶
ValidK8sVersion returns true if the specified Kubernetes version is available.
type Image ¶
Image implements the drivercore.Image interface for QEMU. It is the image of the imagecore package, which the qemu driver shares with the other drivers.
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Machine implements the drivercore.Machine interface.
func (*Machine) ExecuteCommand ¶
func (m *Machine) ExecuteCommand(command drivercore.PredefinedCommand, params ...string) error
ExecuteCommand runs a predefined command in the VM guest.
func (*Machine) ForwardPort ¶
ForwardPort is a no-op as direct routing is used.
func (*Machine) ForwardSSHPort ¶
ForwardSSHPort is a no-op as direct routing is used.
func (*Machine) ImplementsCommand ¶
func (m *Machine) ImplementsCommand(command drivercore.PredefinedCommand) bool
ImplementsCommand returns true if the predefined command is supported.
func (*Machine) SSHAddress ¶
SSHAddress returns the SSH host and port.
func (*Machine) Status ¶
func (m *Machine) Status() drivercore.MachineStatus
Status returns the current running status of the machine.
func (*Machine) UnforwardPort ¶
UnforwardPort is a no-op as direct routing is used.
func (*Machine) WaitForStateChange ¶
WaitForStateChange polls status until it changes or timeout.