oci

package
v0.0.0-...-a1340a4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0, Apache-2.0, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateCreated represents a container that has been created and is
	// ready to be run.
	StateCreated = "created"

	// StateRunning represents a container that's currently running.
	StateRunning = "running"

	// StateStopped represents a container that has been stopped.
	StateStopped = "stopped"

	// StatePaused represents a container that has been paused.
	StatePaused = "paused"
)
View Source
const KernelModulesSeparator = ";"

Variables

View Source
var (
	// ErrNoLinux is an error for missing Linux sections in the OCI configuration file.
	ErrNoLinux = errors.New("missing Linux section")

	// CRIContainerTypeKeyList lists all the CRI keys that could define
	// the container type from annotations in the config.json.
	CRIContainerTypeKeyList = []string{criContainerdAnnotations.ContainerType, crioAnnotations.ContainerType, dockershimAnnotations.ContainerTypeLabelKey}

	// CRISandboxNameKeyList lists all the CRI keys that could define
	// the sandbox ID (sandbox ID) from annotations in the config.json.
	CRISandboxNameKeyList = []string{criContainerdAnnotations.SandboxID, crioAnnotations.SandboxID, dockershimAnnotations.SandboxIDLabelKey}

	// CRIContainerTypeList lists all the maps from CRI ContainerTypes annotations
	// to a virtcontainers ContainerType.
	CRIContainerTypeList = []annotationContainerType{
		{crioAnnotations.ContainerTypeSandbox, vc.PodSandbox},
		{crioAnnotations.ContainerTypeContainer, vc.PodContainer},
		{criContainerdAnnotations.ContainerTypeSandbox, vc.PodSandbox},
		{criContainerdAnnotations.ContainerTypeContainer, vc.PodContainer},
		{dockershimAnnotations.ContainerTypeLabelSandbox, vc.PodSandbox},
		{dockershimAnnotations.ContainerTypeLabelContainer, vc.PodContainer},
	}
)

Functions

func ContainerConfig

func ContainerConfig(ocispec specs.Spec, bundlePath, cid, console string, detach bool) (vc.ContainerConfig, error)

ContainerConfig converts an OCI compatible runtime configuration file to a virtcontainers container configuration structure.

func ContainerType

func ContainerType(spec specs.Spec) (vc.ContainerType, error)

ContainerType returns the type of container and if the container type was found from CRI servers annotations.

func EnvVars

func EnvVars(envs []string) ([]types.EnvVar, error)

EnvVars converts an OCI process environment variables slice into a virtcontainers EnvVar slice.

func GetContainerType

func GetContainerType(annotations map[string]string) (vc.ContainerType, error)

GetContainerType determines which type of container matches the annotations table provided.

func GetOCIConfig

func GetOCIConfig(status vc.ContainerStatus) (specs.Spec, error)

GetOCIConfig returns an OCI spec configuration from the annotation stored into the container status.

func GetSandboxConfigPath

func GetSandboxConfigPath(annotations map[string]string) string

func SandboxConfig

func SandboxConfig(ocispec specs.Spec, runtime RuntimeConfig, bundlePath, cid, console string, detach, systemdCgroup bool) (vc.SandboxConfig, error)

SandboxConfig converts an OCI compatible runtime configuration file to a virtcontainers sandbox configuration structure.

func SandboxID

func SandboxID(spec specs.Spec) (string, error)

SandboxID determines the sandbox ID related to an OCI configuration. This function is expected to be called only when the container type is "PodContainer".

func SetLogger

func SetLogger(ctx context.Context, logger *logrus.Entry)

SetLogger sets the logger for oci package.

func StateToOCIState

func StateToOCIState(state types.StateString) string

StateToOCIState translates a virtcontainers container state into an OCI one.

func StatusToOCIState

func StatusToOCIState(status vc.ContainerStatus) specs.State

StatusToOCIState translates a virtcontainers container status into an OCI state.

Types

type FactoryConfig

type FactoryConfig struct {
	// Template enables VM templating support in VM factory.
	Template bool

	// TemplatePath specifies the path of template.
	TemplatePath string

	// VMCacheNumber specifies the the number of caches of VMCache.
	VMCacheNumber uint

	// VMCacheEndpoint specifies the endpoint of transport VM from the VM cache server to runtime.
	VMCacheEndpoint string
}

FactoryConfig is a structure to set the VM factory configuration.

type RuntimeConfig

type RuntimeConfig struct {
	HypervisorType   vc.HypervisorType
	HypervisorConfig vc.HypervisorConfig

	NetmonConfig vc.NetmonConfig

	AgentType   vc.AgentType
	AgentConfig interface{}

	ProxyType   vc.ProxyType
	ProxyConfig vc.ProxyConfig

	ShimType   vc.ShimType
	ShimConfig interface{}

	Console string

	//Determines how the VM should be connected to the
	//the container network interface
	InterNetworkModel vc.NetInterworkingModel
	FactoryConfig     FactoryConfig
	Debug             bool
	Trace             bool

	//Determines if seccomp should be applied inside guest
	DisableGuestSeccomp bool

	//Determines if create a netns for hypervisor process
	DisableNewNetNs bool

	//Determines kata processes are managed only in sandbox cgroup
	SandboxCgroupOnly bool

	//Determines if containers are allowed to join the pid namespace of the kata agent
	EnableAgentPidNs bool

	//Experimental features enabled
	Experimental []exp.Feature
}

RuntimeConfig aggregates all runtime specific settings

func (*RuntimeConfig) AddKernelParam

func (config *RuntimeConfig) AddKernelParam(p vc.Param) error

AddKernelParam allows the addition of new kernel parameters to an existing hypervisor configuration stored inside the current runtime configuration.

Jump to

Keyboard shortcuts

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