Documentation ¶
Index ¶
- Constants
- func SetExternalDataLoaders(userDataLoader ExternalUserDataLoader, dsLoader DSLoader)
- type CPUModelType
- type CloudInitImageType
- type ContainerFilter
- type ContainerInfo
- type ContainerState
- type DNSConfig
- type DSLoader
- type DiskDriverName
- type ExternalUserDataLoader
- type FilesystemStats
- type NamespaceOption
- type PodSandboxConfig
- type PodSandboxFilter
- type PodSandboxInfo
- type PodSandboxState
- type PortMapping
- type Protocol
- type VMConfig
- type VMKeyValue
- type VMMount
- type VMStats
- type VMStatsFilter
- type VMVolumeDevice
- type VirtletAnnotations
Constants ¶
const ( // CloudInitUserDataSourceKeyName is the name of user data source key in the pod annotations. CloudInitUserDataSourceKeyName = "VirtletCloudInitUserDataSource" // SSHKeySourceKeyName is the name of ssh key source key in the pod annotations. SSHKeySourceKeyName = "VirtletSSHKeySource" // FilesFromDSKeyName is the name of data source key in the pod annotations // for files to be written on rootfs. FilesFromDSKeyName = "VirtletFilesFromDataSource" )
Variables ¶
This section is empty.
Functions ¶
func SetExternalDataLoaders ¶ added in v1.4.2
func SetExternalDataLoaders(userDataLoader ExternalUserDataLoader, dsLoader DSLoader)
SetExternalDataLoaders sets the external data loader functions that loads external data that's specified in the pod annotations and pointed by them data source.
Types ¶
type CPUModelType ¶ added in v1.1.1
type CPUModelType string
CPUModelType specifies cpu model in libvirt domain definition
type CloudInitImageType ¶
type CloudInitImageType string
CloudInitImageType specifies the image type used for cloud-init
const ( // CloudInitImageTypeNoCloud specified nocloud cloud-init image type. CloudInitImageTypeNoCloud CloudInitImageType = "nocloud" // CloudInitImageTypeConfigDrive specified configdrive cloud-init image type. CloudInitImageTypeConfigDrive CloudInitImageType = "configdrive" // CPUModelHostModel specifies cpu model needed for nested virtualization CPUModelHostModel = "host-model" )
type ContainerFilter ¶
type ContainerFilter struct { // ID of the container. Id string // State of the container. State *ContainerState // ID of the PodSandbox. PodSandboxID string // LabelSelector to select matches. // Only api.MatchLabels is supported for now and the requirements // are ANDed. MatchExpressions is not supported yet. LabelSelector map[string]string }
ContainerFilter is used to filter containers. All those fields are combined with 'AND'
type ContainerInfo ¶
type ContainerInfo struct { // Container ID Id string // Container name Name string // Container creation timestamp CreatedAt int64 // Container startup timestamp StartedAt int64 // Current state of the container State ContainerState // Container configuration Config VMConfig }
ContainerInfo contains metadata information about container instance
type ContainerState ¶
type ContainerState int32
ContainerState specifies the state of a container
const ( // ContainerState_CONTAINER_CREATED means that the container is just created. ContainerState_CONTAINER_CREATED ContainerState = 0 // ContainerState_CONTAINER_CREATED means that the container is running. ContainerState_CONTAINER_RUNNING ContainerState = 1 // ContainerState_CONTAINER_CREATED means that the container has exited. ContainerState_CONTAINER_EXITED ContainerState = 2 // ContainerState_CONTAINER_CREATED means that the container state is not known. ContainerState_CONTAINER_UNKNOWN ContainerState = 3 )
type DNSConfig ¶
type DNSConfig struct { // List of DNS servers of the cluster. Servers []string // List of DNS search domains of the cluster. Searches []string // List of DNS options. See https://linux.die.net/man/5/resolv.conf // for all available options. Options []string }
DNSConfig specifies the DNS servers and search domains of a sandbox.
type DSLoader ¶ added in v1.4.2
DSLoader is a function that loads files from config map or secret to write on rootfs
type DiskDriverName ¶
type DiskDriverName string
DiskDriverName specifies disk driver name supported by Virtlet.
const ( // DiskDriverVirtio specifies virtio disk driver. DiskDriverVirtio DiskDriverName = "virtio" // DiskDriverScsi specifies scsi disk driver. DiskDriverScsi DiskDriverName = "scsi" )
type ExternalUserDataLoader ¶ added in v1.4.2
type ExternalUserDataLoader func(va *VirtletAnnotations, Namespace string, podAnnotations map[string]string) error
ExternalUserDataLoader is a function that loads external user data that's specified in the pod annotations.
type FilesystemStats ¶ added in v1.4.0
type FilesystemStats struct { // Mountpoint denotes the filesystem mount point Mountpoint string // UsedBytes is the number of bytes used by images UsedBytes uint64 // UsedInodes is the number of inodes used by images UsedInodes uint64 }
FilesystemStats contains info about filesystem mountpoint and space/inodes used by images on it
type NamespaceOption ¶
type NamespaceOption struct { // If set, use the host's network namespace. HostNetwork bool // If set, use the host's PID namespace. HostPid bool // If set, use the host's IPC namespace. HostIpc bool }
NamespaceOption provides options for Linux namespaces.
type PodSandboxConfig ¶
type PodSandboxConfig struct { // Pod name of the sandbox. Name string // Pod UID of the sandbox. Uid string // Pod namespace of the sandbox. Namespace string // Attempt number of creating the sandbox. Default: 0. Attempt uint32 // Hostname of the sandbox. Hostname string // Path to the directory on the host in which container log files are // stored. LogDirectory string // DNS config for the sandbox. DnsConfig *DNSConfig // Port mappings for the sandbox. PortMappings []*PortMapping // Key-value pairs that may be used to scope and select individual resources. Labels map[string]string // Unstructured key-value map that may be set by the kubelet to store and // retrieve arbitrary metadata. This will include any annotations set on a // pod through the Kubernetes API. Annotations map[string]string // Optional configurations specific to Linux hosts. CgroupParent string }
PodSandboxConfig holds all the required and optional fields for creating a sandbox.
type PodSandboxFilter ¶
type PodSandboxFilter struct { // ID of the sandbox. Id string // State of the sandbox. State *PodSandboxState // LabelSelector to select matches. // Only api.MatchLabels is supported for now and the requirements // are ANDed. MatchExpressions is not supported yet. LabelSelector map[string]string }
PodSandboxFilter is used to filter a list of PodSandboxes. All those fields are combined with 'AND'
type PodSandboxInfo ¶
type PodSandboxInfo struct { // Pod ID. PodID string // Sandbox configuration information. Config *PodSandboxConfig // Creation timestamp. CreatedAt int64 // Sandbox state. State PodSandboxState // Sandbox network state. ContainerSideNetwork *network.ContainerSideNetwork }
PodSandboxInfo contains metadata information about pod sandbox instance
type PodSandboxState ¶
type PodSandboxState int32
PodSandboxState specifies the state of the sandbox
const ( // PodSandboxState_SANDBOX_READY specifies that the pod is ready. PodSandboxState_SANDBOX_READY PodSandboxState = 0 // PodSandboxState_SANDBOX_READY specifies that the pod is not ready. // This includes errors during RunPodSandbox. PodSandboxState_SANDBOX_NOTREADY PodSandboxState = 1 )
type PortMapping ¶
type PortMapping struct { // Protocol of the port mapping. Protocol Protocol // Port number within the container. Default: 0 (not specified). ContainerPort int32 // Port number on the host. Default: 0 (not specified). HostPort int32 // Host IP. HostIp string }
PortMapping specifies the port mapping configurations of a sandbox.
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 // Host block devices that should be made available inside the VM. // This is used for block PVs. VolumeDevices []VMVolumeDevice // ContainerSideNetwork stores info about container side network configuration. ContainerSideNetwork *network.ContainerSideNetwork // Path to the directory on the host in which container log files are // stored. LogDirectory string // Path relative to LogDirectory for container to store the // log (STDOUT and STDERR) on the host. LogPath string }
VMConfig contains the information needed to start create a VM TODO: use this struct to store VM metadata.
func (*VMConfig) LoadAnnotations ¶
LoadAnnotations parses pod annotations in the VM config an populates the ParsedAnnotations field.
func (*VMConfig) RootVolumeDevice ¶ added in v1.4.1
func (c *VMConfig) RootVolumeDevice() *VMVolumeDevice
RootVolumeDevice returns the volume device that should be used for a persistent root filesystem, that is, its DevicePath is "/"
type VMKeyValue ¶
type VMKeyValue struct { // Key contains the key part of the pair. Key string // Value contains the value part of the pair. Value string }
VMKeyValue denotes a key-value pair.
type VMMount ¶
type VMMount struct { // ContainerPath specifies the mount path in the container namespace. ContainerPath string // HostPath specifies the mount path in the host namespace. HostPath string // If set, the mount is read-only. Readonly bool }
VMMount denotes a host directory corresponding to a volume which is to be mounted inside the VM.
type VMStats ¶ added in v1.4.0
type VMStats struct { // ContainerID holds identifier of container for which these statistics // were collected ContainerID string // Name holds name of the container Name string // Timestatmp holds an unix timestamp (including nanoseconds) // for stats collection Timestamp int64 // CpuUsage in nano seconds per cpu CpuUsage uint64 // MemoryUsage is expected to contain the amount of working set memory // in bytes what in our case will be returned using RSS value MemoryUsage uint64 // FsBytes represents current size of rootfs in bytes FsBytes uint64 }
VMStats contains cpu/memory/disk usage for VM.
type VMStatsFilter ¶ added in v1.4.0
type VMStatsFilter struct { // ID holds of the container. Id string // PodSandboxID holds id of podsandbox. PodSandboxID string // LabelSelector to select matches. Requirementes should be ANDed. // Match Expressions is not supported. LabelSelector map[string]string }
VMStatsFilter is used to filter set of container stats All those fields are combined with 'AND'
type VMVolumeDevice ¶ added in v1.4.0
type VMVolumeDevice struct { // DevicePath specifies the path to the device inside the VM. DevicePath string // HostPath specifies the mount path in the host namespace. HostPath string }
VMVolumeDevice denotes a raw block device mapping within a VM which is used for block PVs.
func (VMVolumeDevice) IsRoot ¶ added in v1.4.1
func (d VMVolumeDevice) IsRoot() bool
IsRoot returns true if this volume device should be used for a persistent root filesystem, that is, its DevicePath is "/"
func (VMVolumeDevice) UUID ¶ added in v1.4.0
func (dev VMVolumeDevice) UUID() string
UUID returns an uuid that uniquely identifies the block device on the host.
type VirtletAnnotations ¶
type VirtletAnnotations struct { // Number of virtual CPUs. VCPUCount int // CPU model. CPUModel CPUModelType // Cloud-Init image type to use. CDImageType CloudInitImageType // Cloud-Init metadata. MetaData map[string]interface{} // Cloud-Init userdata UserData map[string]interface{} // True if the userdata is overridden. UserDataOverwrite bool // UserDataScript specifies the script to be used as userdata. UserDataScript string // SSHKets specifies ssh public keys to use. SSHKeys []string // DiskDriver specifies the disk driver to use. DiskDriver DiskDriverName // CPUSetting directly specifies the cpu to use for libvirt. CPUSetting *libvirtxml.DomainCPU // Root volume size in bytes. Defaults to 0 which means using // the size of QCOW2 image). If the value is less then the // size of the QCOW2 image, the size of the QCOW2 image is // used instead. RootVolumeSize int64 // VirtletChown9pfsMounts indicates if chown is enabled for 9pfs mounts. VirtletChown9pfsMounts bool // FilesForRootfs specifies files to be put on rootfs using libguestfs. FilesForRootfs map[string][]byte }
VirtletAnnotations contains parsed values for pod annotations supported by Virtlet.