Documentation ¶
Index ¶
- Constants
- func SetExternalDataLoader(loader ExternalDataLoader)
- type CloudInitImageType
- type ContainerFilter
- type ContainerInfo
- type ContainerState
- type DNSConfig
- type DiskDriverName
- type ExternalDataLoader
- type NamespaceOption
- type PodSandboxConfig
- type PodSandboxFilter
- type PodSandboxInfo
- type PodSandboxState
- type PortMapping
- type Protocol
- type VMConfig
- type VMKeyValue
- type VMMount
- 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" )
Variables ¶
This section is empty.
Functions ¶
func SetExternalDataLoader ¶
func SetExternalDataLoader(loader ExternalDataLoader)
SetExternalDataLoader sets the external data loader function that loads external data that's specified in the pod annotations.
Types ¶
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" )
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 func(va *VirtletAnnotations, Namespace string, podAnnotations map[string]string) error
ExternalDataLoader is a function that loads external data that's specified in the pod annotations.
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 // 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.
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 VirtletAnnotations ¶
type VirtletAnnotations struct { // Number of virtual CPUs. VCPUCount int // 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 }
VirtletAnnotations contains parsed values for pod annotations supported by Virtlet.