Documentation
¶
Index ¶
- Constants
- func CreateDriver(config *conftypes.Config, clusterConfig *conftypes.ClusterConfig) (driver.ClusterDriver, error)
- func CreateStoragePool(l *libvirt.Libvirt, name string, path string) (*libvirt.StoragePool, error)
- func DoesBaseImageExist(l *libvirt.Libvirt, pool *libvirt.StoragePool, bootVolumeName string) bool
- func FindOrCreateStoragePool(l *libvirt.Libvirt, uri *url.URL, storagePool string) (*libvirt.StoragePool, error)
- func FindStoragePool(l *libvirt.Libvirt, storagePool, poolPath string) (*libvirt.StoragePool, error)
- func GetStoragePoolPath(l *libvirt.Libvirt, pool *libvirt.StoragePool) (string, error)
- func StartStoragePool(l *libvirt.Libvirt, pool *libvirt.StoragePool) error
- func TransferBaseImage(l *libvirt.Libvirt, imageName string, pool *libvirt.StoragePool, ...) error
- func TransferToPool(l *libvirt.Libvirt, in io.Reader, pool *libvirt.StoragePool, volumeName string, ...) error
- type ClusterData
- type Domain
- type HostData
- type LibvirtDriver
- func (ld *LibvirtDriver) Close() error
- func (ld *LibvirtDriver) DefaultCNIInterfaces() []string
- func (ld *LibvirtDriver) Delete() error
- func (ld *LibvirtDriver) GetKubeAPIServerAddress() string
- func (ld *LibvirtDriver) GetKubeconfigPath() string
- func (ld *LibvirtDriver) Join(kubeconfigPath string, controlPlaneNodes int, workerNodes int) error
- func (ld *LibvirtDriver) PostInstallHelpStanza() string
- func (ld *LibvirtDriver) PostStart() error
- func (ld *LibvirtDriver) Stage(version string) (string, string, bool, error)
- func (ld *LibvirtDriver) Start() (bool, bool, error)
- func (ld *LibvirtDriver) Stop() error
- type LibvirtNetwork
- type Network
- type NetworkInformation
- type Pool
- type PortForward
- type StoragePool
- type StoragePoolDir
- type StoragePoolPermissions
- type StoragePoolSource
- type StoragePoolTarget
- type UsedIPs
- type UsedPorts
- type Volume
Constants ¶
const ( DriverName = "libvirt" // Manually specify the PCI bus/port for the bridge network // interface. This ensures that the device name within Linux // can be calculated and fed into any configuration that gets // set within a VM. BridgeBus = 1 BridgeSlot = 0 // Manually specify the PCI bus/port for user network interface // for the same reasons as the bridge network. UserBus = 0 UserSlot = 2 // Calculate the bridge network device name from the bus/port // used to create it, following the Linux consistent network // device naming convention. 'en' stands for ethernet, 'p<num>' // stands for PCI port number (read: bus), 's<num>' stands for // the slot. BridgeNicPattern = "enp%ds%d" )
Variables ¶
This section is empty.
Functions ¶
func CreateDriver ¶
func CreateDriver(config *conftypes.Config, clusterConfig *conftypes.ClusterConfig) (driver.ClusterDriver, error)
func CreateStoragePool ¶
CreateStoagePool creates a storage pool and returns the libvirt object
func DoesBaseImageExist ¶
DoesBaseImageExist returns if the base image has been previously downloaded or manually placed in the default images pool
func FindOrCreateStoragePool ¶
func FindOrCreateStoragePool(l *libvirt.Libvirt, uri *url.URL, storagePool string) (*libvirt.StoragePool, error)
FindOrCreateStoragePool gives back a reasonable place to locate volumes. First it checks to see if a storage pool is specified. If specified, then it proceeds to use it. Otherwise, it checks to see if a pool that matches the default configuration already exists. If so, that one is used. If not, it will scan all pools for something that looks acceptable. "Acceptable" is intentionally not defined. If an acceptable option does not exist, a new pool will be created with useful defaults.
func FindStoragePool ¶
func FindStoragePool(l *libvirt.Libvirt, storagePool, poolPath string) (*libvirt.StoragePool, error)
FindStoragePool gives back a reasonable place to locate volumes. First it checks to see if a storage pool is specified. If specified, then it proceeds to use it. Otherwise, it checks to see if a pool that matches the default configuration already exists. If so, that one is used. If not, it will scan all pools for something that looks acceptable. "Acceptable" is intentionally not defined. If an acceptable option does not exist, no volume is returned
func GetStoragePoolPath ¶
GetStoragePoolPath gives back the path for a storage pool. If the storage pool is not backed by a path, an empty string is returned along with an error.
func StartStoragePool ¶
func StartStoragePool(l *libvirt.Libvirt, pool *libvirt.StoragePool) error
StartStoragePool starts a storage pool if it is not already started.
func TransferBaseImage ¶
func TransferBaseImage(l *libvirt.Libvirt, imageName string, pool *libvirt.StoragePool, volumeName string, arch string) error
TransferBaseImage uses the libvirt API to upload the boot.qcow2 from a container image to the target libvirtd instance, locating in the given Pool and assigning in the given name.
func TransferToPool ¶
func TransferToPool(l *libvirt.Libvirt, in io.Reader, pool *libvirt.StoragePool, volumeName string, volType string, reupload bool, size uint64) error
TransferToPool uses the libvirt API to upload a stream to the target libvirtd instance, locating it in the given pool and assigning it the given name. This function does not create the pool if it does not already exist.
If reupload is false, the image is not re-transferred if it already exists on the target libvirt instance.
If size is non-zero, the volume is resized after upload to the given value.
Types ¶
type ClusterData ¶
type Domain ¶
type Domain struct { Name string Description string VolumePool string Volume string IgnitionPath string Hypervisor string Networks []Network Memory int MemoryCapacityUnit string CPUs int CPUArch string }
Domain defines a VM
type LibvirtDriver ¶
type LibvirtDriver struct { Name string // Name is the name of the cluster Config conftypes.ClusterConfig // Basic connection information Connection *libvirt.Libvirt // Connection is the connection to libvirt URI *url.URL // URI is the URI of the libvirt target Local bool // Local indicates if the libvirt target is a local or remote system TargetIP string // TargetIP is the IP address of the libvirt target KubeAPIServerIP string // KubeAPIServerIP is the IP address of Kubernetes from the perspective of the cluster nodes TunnelPort uint16 // TunnelPort is a port on the target host that is used to tunnel connections to the Kubernetes API Server in the VM from the host LocalKubeconfigName string LocalKubeconfigPath string VMKubeconfigName string VMKubeconfigPath string PKIInfo *kubepki.PKIInfo NetworkName string BridgeNetworking bool NetworkingResolved bool KubeVersion string BootVolumeContainerImage string CPUArch string Info func(...interface{}) Infof func(string, ...interface{}) UploadCertificateKey string }
LibvirtDriver manages resource creation and cluster management for libvirt targets.
func (*LibvirtDriver) Close ¶
func (ld *LibvirtDriver) Close() error
func (*LibvirtDriver) DefaultCNIInterfaces ¶
func (ld *LibvirtDriver) DefaultCNIInterfaces() []string
func (*LibvirtDriver) Delete ¶
func (ld *LibvirtDriver) Delete() error
func (*LibvirtDriver) GetKubeAPIServerAddress ¶
func (ld *LibvirtDriver) GetKubeAPIServerAddress() string
func (*LibvirtDriver) GetKubeconfigPath ¶
func (ld *LibvirtDriver) GetKubeconfigPath() string
func (*LibvirtDriver) Join ¶
func (ld *LibvirtDriver) Join(kubeconfigPath string, controlPlaneNodes int, workerNodes int) error
func (*LibvirtDriver) PostInstallHelpStanza ¶
func (ld *LibvirtDriver) PostInstallHelpStanza() string
func (*LibvirtDriver) PostStart ¶
func (ld *LibvirtDriver) PostStart() error
func (*LibvirtDriver) Stop ¶
func (ld *LibvirtDriver) Stop() error
type LibvirtNetwork ¶
type Network ¶
type Network struct { Type string Network string Bus string Slot string PortForwards []PortForward }
Network defines a network for a VM
type NetworkInformation ¶
type NetworkInformation struct { Hosts map[string]*HostData Clusters map[string]*ClusterData }
type PortForward ¶
PortForward defines a pair of ports. From is forwarded to To. Listen is the IP to listen on.
type StoragePool ¶
type StoragePool struct { XMLName xml.Name `xml:"pool"` Name string `xml:"name"` Type string `xml:"type,attr"` Target StoragePoolTarget `xml:"target"` Source StoragePoolSource `xml:"source"` }
type StoragePoolDir ¶
type StoragePoolDir struct {
Path string `xml:"path,attr"`
}
type StoragePoolPermissions ¶
type StoragePoolPermissions struct {
Mode string `xml:"mode"`
}
type StoragePoolSource ¶
type StoragePoolSource struct { }
type StoragePoolTarget ¶
type StoragePoolTarget struct { Path string `xml:"path"` Permissions StoragePoolPermissions `xml:"permissions"` }