Documentation ¶
Index ¶
- Constants
- func AddFlexvolumeSource(fvType string, source FlexvolumeSource)
- func ImageNameToVolumeName(imageName string) (string, error)
- type CloudInitGenerator
- type Connection
- type DiskDriver
- type FlexvolumeSource
- type ImageManager
- type ImageTool
- func (i *ImageTool) GetImageVolume(imageName string) (virt.VirtStorageVolume, error)
- func (i *ImageTool) ImageAsVolume(volumeName string) (virt.VirtStorageVolume, error)
- func (i *ImageTool) ListVolumes() ([]virt.VirtStorageVolume, error)
- func (i *ImageTool) PullRemoteImageToVolume(imageName, volumeName string) (virt.VirtStorageVolume, error)
- func (i *ImageTool) RemoveImage(volumeName string) error
- type LibvirtDomain
- func (domain *LibvirtDomain) Create() error
- func (domain *LibvirtDomain) Destroy() error
- func (domain *LibvirtDomain) Name() (string, error)
- func (domain *LibvirtDomain) Shutdown() error
- func (domain *LibvirtDomain) State() (virt.DomainState, error)
- func (domain *LibvirtDomain) UUIDString() (string, error)
- func (domain *LibvirtDomain) Undefine() error
- type LibvirtDomainConnection
- func (dc *LibvirtDomainConnection) DefineDomain(def *libvirtxml.Domain) (virt.VirtDomain, error)
- func (dc *LibvirtDomainConnection) DefineSecret(def *libvirtxml.Secret) (virt.VirtSecret, error)
- func (dc *LibvirtDomainConnection) ListDomains() ([]virt.VirtDomain, error)
- func (dc *LibvirtDomainConnection) LookupDomainByName(name string) (virt.VirtDomain, error)
- func (dc *LibvirtDomainConnection) LookupDomainByUUIDString(uuid string) (virt.VirtDomain, error)
- func (dc *LibvirtDomainConnection) LookupSecretByUUIDString(uuid string) (virt.VirtSecret, error)
- func (dc *LibvirtDomainConnection) LookupSecretByUsageName(usageType string, usageName string) (virt.VirtSecret, error)
- type LibvirtSecret
- type LibvirtStorageConnection
- type LibvirtStoragePool
- func (pool *LibvirtStoragePool) CreateStorageVol(def *libvirtxml.StorageVolume) (virt.VirtStorageVolume, error)
- func (pool *LibvirtStoragePool) CreateStorageVolClone(def *libvirtxml.StorageVolume, from virt.VirtStorageVolume) (virt.VirtStorageVolume, error)
- func (pool *LibvirtStoragePool) ImageToVolume(def *libvirtxml.StorageVolume, sourcePath string) (virt.VirtStorageVolume, error)
- func (pool *LibvirtStoragePool) ListAllVolumes() ([]virt.VirtStorageVolume, error)
- func (pool *LibvirtStoragePool) LookupVolumeByName(name string) (virt.VirtStorageVolume, error)
- func (pool *LibvirtStoragePool) RemoveVolumeByName(name string) error
- type LibvirtStorageVolume
- type VMConfig
- type VMKeyValue
- type VMMount
- type VMVolume
- type VMVolumeSource
- type VirtletAnnotations
- type VirtualizationTool
- func (v *VirtualizationTool) ContainerStatus(containerId string) (*kubeapi.ContainerStatus, error)
- func (v *VirtualizationTool) CreateContainer(config *VMConfig, netNSPath, cniConfig string) (string, error)
- func (v *VirtualizationTool) DomainConnection() virt.VirtDomainConnection
- func (v *VirtualizationTool) GarbageCollect() (allErrors []error)
- func (v *VirtualizationTool) ImageManager() ImageManager
- func (v *VirtualizationTool) KubeletRootDir() string
- func (v *VirtualizationTool) ListContainers(filter *kubeapi.ContainerFilter) ([]*kubeapi.Container, error)
- func (v *VirtualizationTool) RawDevices() []string
- func (v *VirtualizationTool) RemoveContainer(containerId string) error
- func (v *VirtualizationTool) RemoveLibvirtSandboxLog(sandboxId string) error
- func (v *VirtualizationTool) SetClock(clock clockwork.Clock)
- func (v *VirtualizationTool) SetForceKVM(forceKVM bool)
- func (v *VirtualizationTool) SetKubeletRootDir(kubeletRootDir string)
- func (v *VirtualizationTool) StartContainer(containerId string) error
- func (v *VirtualizationTool) StopContainer(containerId string, timeout time.Duration) error
- func (v *VirtualizationTool) StoragePool() virt.VirtStoragePool
- type VolumeOwner
- type WriteFilesManipulator
Constants ¶
const ( VCPUCountAnnotationKeyName = "VirtletVCPUCount" CloudInitMetaDataKeyName = "VirtletCloudInitMetaData" CloudInitUserDataKeyName = "VirtletCloudInitUserData" CloudInitUserDataOverwriteKeyName = "VirtletCloudInitUserDataOverwrite" CloudInitUserDataScriptKeyName = "VirtletCloudInitUserDataScript" SSHKeysKeyName = "VirtletSSHKeys" DiskDriverKeyName = "VirtletDiskDriver" DiskDriverVirtio DiskDriver = "virtio" DiskDriverScsi DiskDriver = "scsi" )
const (
ContainerNsUuid = "67b7fb47-7735-4b64-86d2-6d062d121966"
)
const (
EnvFileLocation = "/etc/cloud/environment"
)
Variables ¶
This section is empty.
Functions ¶
func AddFlexvolumeSource ¶
func AddFlexvolumeSource(fvType string, source FlexvolumeSource)
func ImageNameToVolumeName ¶
Types ¶
type CloudInitGenerator ¶
type CloudInitGenerator struct {
// contains filtered or unexported fields
}
func NewCloudInitGenerator ¶
func NewCloudInitGenerator(config *VMConfig, volumeMap map[string]string, isoDir string) *CloudInitGenerator
func (*CloudInitGenerator) GenerateDisk ¶
func (g *CloudInitGenerator) GenerateDisk() (*libvirtxml.DomainDisk, error)
func (*CloudInitGenerator) IsoPath ¶
func (g *CloudInitGenerator) IsoPath() string
type Connection ¶
type Connection struct { *LibvirtDomainConnection *LibvirtStorageConnection }
func NewConnection ¶
func NewConnection(uri string) (*Connection, error)
type DiskDriver ¶
type DiskDriver string
type FlexvolumeSource ¶
type FlexvolumeSource func(volumeName, configPath string, config *VMConfig, owner VolumeOwner) (VMVolume, error)
type ImageManager ¶
type ImageManager interface {
GetImageVolume(imageName string) (virt.VirtStorageVolume, error)
}
type ImageTool ¶
type ImageTool struct {
// contains filtered or unexported fields
}
func NewImageTool ¶
func NewImageTool(conn virt.VirtStorageConnection, downloader utils.Downloader, poolName string) (*ImageTool, error)
func (*ImageTool) GetImageVolume ¶
func (i *ImageTool) GetImageVolume(imageName string) (virt.VirtStorageVolume, error)
func (*ImageTool) ImageAsVolume ¶
func (i *ImageTool) ImageAsVolume(volumeName string) (virt.VirtStorageVolume, error)
func (*ImageTool) ListVolumes ¶
func (i *ImageTool) ListVolumes() ([]virt.VirtStorageVolume, error)
func (*ImageTool) PullRemoteImageToVolume ¶
func (i *ImageTool) PullRemoteImageToVolume(imageName, volumeName string) (virt.VirtStorageVolume, error)
func (*ImageTool) RemoveImage ¶
type LibvirtDomain ¶
type LibvirtDomain struct {
// contains filtered or unexported fields
}
func (*LibvirtDomain) Create ¶
func (domain *LibvirtDomain) Create() error
func (*LibvirtDomain) Destroy ¶
func (domain *LibvirtDomain) Destroy() error
func (*LibvirtDomain) Name ¶ added in v0.8.1
func (domain *LibvirtDomain) Name() (string, error)
func (*LibvirtDomain) Shutdown ¶
func (domain *LibvirtDomain) Shutdown() error
func (*LibvirtDomain) State ¶
func (domain *LibvirtDomain) State() (virt.DomainState, error)
func (*LibvirtDomain) UUIDString ¶
func (domain *LibvirtDomain) UUIDString() (string, error)
func (*LibvirtDomain) Undefine ¶
func (domain *LibvirtDomain) Undefine() error
type LibvirtDomainConnection ¶
type LibvirtDomainConnection struct {
// contains filtered or unexported fields
}
func (*LibvirtDomainConnection) DefineDomain ¶
func (dc *LibvirtDomainConnection) DefineDomain(def *libvirtxml.Domain) (virt.VirtDomain, error)
func (*LibvirtDomainConnection) DefineSecret ¶
func (dc *LibvirtDomainConnection) DefineSecret(def *libvirtxml.Secret) (virt.VirtSecret, error)
func (*LibvirtDomainConnection) ListDomains ¶
func (dc *LibvirtDomainConnection) ListDomains() ([]virt.VirtDomain, error)
func (*LibvirtDomainConnection) LookupDomainByName ¶
func (dc *LibvirtDomainConnection) LookupDomainByName(name string) (virt.VirtDomain, error)
func (*LibvirtDomainConnection) LookupDomainByUUIDString ¶
func (dc *LibvirtDomainConnection) LookupDomainByUUIDString(uuid string) (virt.VirtDomain, error)
func (*LibvirtDomainConnection) LookupSecretByUUIDString ¶
func (dc *LibvirtDomainConnection) LookupSecretByUUIDString(uuid string) (virt.VirtSecret, error)
func (*LibvirtDomainConnection) LookupSecretByUsageName ¶ added in v0.8.0
func (dc *LibvirtDomainConnection) LookupSecretByUsageName(usageType string, usageName string) (virt.VirtSecret, error)
type LibvirtSecret ¶
type LibvirtSecret struct {
// contains filtered or unexported fields
}
func (*LibvirtSecret) Remove ¶
func (secret *LibvirtSecret) Remove() error
func (*LibvirtSecret) SetValue ¶
func (secret *LibvirtSecret) SetValue(value []byte) error
type LibvirtStorageConnection ¶
type LibvirtStorageConnection struct {
// contains filtered or unexported fields
}
func (*LibvirtStorageConnection) CreateStoragePool ¶
func (sc *LibvirtStorageConnection) CreateStoragePool(def *libvirtxml.StoragePool) (virt.VirtStoragePool, error)
func (*LibvirtStorageConnection) LookupStoragePoolByName ¶
func (sc *LibvirtStorageConnection) LookupStoragePoolByName(name string) (virt.VirtStoragePool, error)
type LibvirtStoragePool ¶
type LibvirtStoragePool struct {
// contains filtered or unexported fields
}
func (*LibvirtStoragePool) CreateStorageVol ¶
func (pool *LibvirtStoragePool) CreateStorageVol(def *libvirtxml.StorageVolume) (virt.VirtStorageVolume, error)
func (*LibvirtStoragePool) CreateStorageVolClone ¶
func (pool *LibvirtStoragePool) CreateStorageVolClone(def *libvirtxml.StorageVolume, from virt.VirtStorageVolume) (virt.VirtStorageVolume, error)
func (*LibvirtStoragePool) ImageToVolume ¶
func (pool *LibvirtStoragePool) ImageToVolume(def *libvirtxml.StorageVolume, sourcePath string) (virt.VirtStorageVolume, error)
func (*LibvirtStoragePool) ListAllVolumes ¶
func (pool *LibvirtStoragePool) ListAllVolumes() ([]virt.VirtStorageVolume, error)
func (*LibvirtStoragePool) LookupVolumeByName ¶
func (pool *LibvirtStoragePool) LookupVolumeByName(name string) (virt.VirtStorageVolume, error)
func (*LibvirtStoragePool) RemoveVolumeByName ¶
func (pool *LibvirtStoragePool) RemoveVolumeByName(name string) error
type LibvirtStorageVolume ¶
type LibvirtStorageVolume struct {
// contains filtered or unexported fields
}
func (*LibvirtStorageVolume) Format ¶
func (volume *LibvirtStorageVolume) Format() error
func (*LibvirtStorageVolume) Name ¶
func (volume *LibvirtStorageVolume) Name() string
func (*LibvirtStorageVolume) Path ¶
func (volume *LibvirtStorageVolume) Path() (string, error)
func (*LibvirtStorageVolume) Remove ¶
func (volume *LibvirtStorageVolume) Remove() error
func (*LibvirtStorageVolume) Size ¶
func (volume *LibvirtStorageVolume) Size() (uint64, error)
type VMConfig ¶
type VMConfig struct { // Id of the containing pod sandbox PodSandboxId string // Name of the containing pod sandbox PodName string // Namespace of the containing pod sandbox PodNamespace string // Name of the container (VM) Name string // Image to use for the VM Image string // Attempt is the number of container creation attempts before this one Attempt uint32 // Memory limit in bytes. Default: 0 (not specified) MemoryLimitInBytes int64 CpuShares int64 // CPU CFS (Completely Fair Scheduler) period. Default: 0 (not specified) CpuPeriod int64 // CPU CFS (Completely Fair Scheduler) quota. Default: 0 (not specified) CpuQuota int64 // Annotations for the containing pod PodAnnotations map[string]string // Annotations for the container ContainerAnnotations map[string]string // Labels for the container ContainerLabels map[string]string // Parsed representation of pod annotations. Populated by LoadAnnotations() call ParsedAnnotations *VirtletAnnotations // Domain UUID (set by the CreateContainer) // TODO: this field should be moved to VMStatus DomainUUID string // Environment variables to set in the VM Environment []*VMKeyValue // Host directories corresponding to the volumes which are to // be mounted inside the VM Mounts []*VMMount }
VMConfig contains the information needed to start create a VM TODO: use this struct to store VM metadata
func GetVMConfig ¶
func GetVMConfig(in *kubeapi.CreateContainerRequest) (*VMConfig, error)
GetVMConfig translates CRI's CreateContainerRequest to a VMConfig
func (*VMConfig) LoadAnnotations ¶
LoadAnnotations parses pod annotations in the VM config an populates the ParsedAnnotations field.
type VMKeyValue ¶
VMKeyValue denotes a key-value pair
type VMMount ¶
VMMount denotes a host directory corresponding to a volume which is to be mounted inside the VM
type VMVolume ¶
type VMVolume interface { Uuid() string Setup(volumeMap map[string]string) (*libvirtxml.DomainDisk, error) Teardown() error }
func GetNocloudVolume ¶
func GetNocloudVolume(config *VMConfig, owner VolumeOwner) ([]VMVolume, error)
func GetRootVolume ¶
func GetRootVolume(config *VMConfig, owner VolumeOwner) ([]VMVolume, error)
func ScanFlexvolumes ¶
func ScanFlexvolumes(config *VMConfig, owner VolumeOwner) ([]VMVolume, error)
type VMVolumeSource ¶
type VMVolumeSource func(config *VMConfig, owner VolumeOwner) ([]VMVolume, error)
VMVolumeSource is a function that provides `VMVolume`s for VMs
func CombineVMVolumeSources ¶
func CombineVMVolumeSources(srcs ...VMVolumeSource) VMVolumeSource
type VirtletAnnotations ¶
type VirtletAnnotations struct { VCPUCount int MetaData map[string]interface{} UserData map[string]interface{} UserDataOverwrite bool UserDataScript string SSHKeys []string DiskDriver DiskDriver }
func LoadAnnotations ¶
func LoadAnnotations(podAnnotations map[string]string) (*VirtletAnnotations, error)
type VirtualizationTool ¶
type VirtualizationTool struct {
// contains filtered or unexported fields
}
func NewVirtualizationTool ¶
func NewVirtualizationTool(domainConn virt.VirtDomainConnection, storageConn virt.VirtStorageConnection, imageManager ImageManager, metadataStore metadata.MetadataStore, volumePoolName, rawDevices string, volumeSource VMVolumeSource) (*VirtualizationTool, error)
func (*VirtualizationTool) ContainerStatus ¶
func (v *VirtualizationTool) ContainerStatus(containerId string) (*kubeapi.ContainerStatus, error)
func (*VirtualizationTool) CreateContainer ¶
func (v *VirtualizationTool) CreateContainer(config *VMConfig, netNSPath, cniConfig string) (string, error)
func (*VirtualizationTool) DomainConnection ¶
func (v *VirtualizationTool) DomainConnection() virt.VirtDomainConnection
func (*VirtualizationTool) GarbageCollect ¶ added in v0.8.1
func (v *VirtualizationTool) GarbageCollect() (allErrors []error)
GarbageCollect retrieves from metadata store list of container ids, passes it to all GC submodules, collecting from them list of possible errors, which is returned to outer scope
func (*VirtualizationTool) ImageManager ¶
func (v *VirtualizationTool) ImageManager() ImageManager
func (*VirtualizationTool) KubeletRootDir ¶
func (v *VirtualizationTool) KubeletRootDir() string
func (*VirtualizationTool) ListContainers ¶
func (v *VirtualizationTool) ListContainers(filter *kubeapi.ContainerFilter) ([]*kubeapi.Container, error)
func (*VirtualizationTool) RawDevices ¶
func (v *VirtualizationTool) RawDevices() []string
func (*VirtualizationTool) RemoveContainer ¶
func (v *VirtualizationTool) RemoveContainer(containerId string) error
RemoveContainer tries to gracefully stop domain, then forcibly removes it even if it's still running it waits up to 5 sec for doing the job by libvirt
func (*VirtualizationTool) RemoveLibvirtSandboxLog ¶
func (v *VirtualizationTool) RemoveLibvirtSandboxLog(sandboxId string) error
func (*VirtualizationTool) SetClock ¶
func (v *VirtualizationTool) SetClock(clock clockwork.Clock)
func (*VirtualizationTool) SetForceKVM ¶
func (v *VirtualizationTool) SetForceKVM(forceKVM bool)
func (*VirtualizationTool) SetKubeletRootDir ¶
func (v *VirtualizationTool) SetKubeletRootDir(kubeletRootDir string)
func (*VirtualizationTool) StartContainer ¶
func (v *VirtualizationTool) StartContainer(containerId string) error
func (*VirtualizationTool) StopContainer ¶
func (v *VirtualizationTool) StopContainer(containerId string, timeout time.Duration) error
func (*VirtualizationTool) StoragePool ¶
func (v *VirtualizationTool) StoragePool() virt.VirtStoragePool
type VolumeOwner ¶
type VolumeOwner interface { StoragePool() virt.VirtStoragePool DomainConnection() virt.VirtDomainConnection ImageManager() ImageManager RawDevices() []string KubeletRootDir() string }
type WriteFilesManipulator ¶
type WriteFilesManipulator struct {
// contains filtered or unexported fields
}
func NewWriteFilesManipulator ¶
func NewWriteFilesManipulator(userData map[string]interface{}, mounts []*VMMount) *WriteFilesManipulator
func (*WriteFilesManipulator) AddConfigMapEntries ¶
func (m *WriteFilesManipulator) AddConfigMapEntries()
func (*WriteFilesManipulator) AddFileLikeMounts ¶ added in v0.8.0
func (m *WriteFilesManipulator) AddFileLikeMounts()
func (*WriteFilesManipulator) AddSecrets ¶
func (m *WriteFilesManipulator) AddSecrets()
Source Files ¶
- annotations.go
- ceph_flexvolume.go
- cloudinit.go
- connection.go
- diskdriver.go
- flexvolume_volumesource.go
- gc.go
- image.go
- kubeapi.go
- libvirt_domain.go
- libvirt_storage.go
- nocloud_volumesource.go
- qcow2_flexvolume.go
- raw_flexvolume.go
- root_volumesource.go
- storage_utils.go
- virtualization.go
- vmconfig.go
- volumes.go