types

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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 the files to be injected into the rootfs.
	FilesFromDSKeyName = "VirtletFilesFromDataSource"
)

Variables

This section is empty.

Functions

func SetExternalDataLoader

func SetExternalDataLoader(loader ExternalDataLoader)

SetExternalDataLoader sets the ExternalDataLoader to use

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 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 ExternalDataLoader

type ExternalDataLoader interface {
	// LoadCloudInitData loads cloud-init userdata and ssh keys
	// from the data sources specified in the pod annotations.
	LoadCloudInitData(va *VirtletAnnotations, namespace string, podAnnotations map[string]string) error
	// LoadFileMap loads a set of files from the data sources.
	LoadFileMap(namespace, dsSpec string) (map[string][]byte, error)
}

ExternalDataLoader is used to load extra pod data from Kubernetes ConfigMaps and secrets.

func GetExternalDataLoader added in v1.5.0

func GetExternalDataLoader() ExternalDataLoader

GetExternalDataLoader returns the current ExternalDataLoader

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 Protocol

type Protocol int32

Protocol specifies the protocol for a port mapping.

const (
	// Protocol_TCP specifies TCP protocol.
	Protocol_TCP Protocol = 0
	// Protocol_TCP specifies UDP protocol.
	Protocol_UDP Protocol = 1
)

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
	// CPU shares (relative weight vs. other containers). Default: 0 (not specified).
	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

func (c *VMConfig) LoadAnnotations() error

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
	// InjectedFiles specifies the files to be injected into VM's
	// rootfs before booting the VM.
	InjectedFiles map[string][]byte
	// SystemUUID specifies fixed SMBIOS UUID to be used for the domain.
	// If not set, the SMBIOS UUID will be automatically generated from the Pod ID.
	SystemUUID *uuid.UUID
	// ForceDHCPNetworkConfig prevents Virtlet from using Cloud-Init based network
	// configuration and makes it only provide DHCP. Note that this will
	// not work for multi-CNI configuration.
	ForceDHCPNetworkConfig bool
}

VirtletAnnotations contains parsed values for pod annotations supported by Virtlet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL