Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateContainerSizing(spec *specs.Spec) (numCPU float32, memSizeMB uint32)
- func CalculateSandboxSizing(spec *specs.Spec) (numCPU float32, memSizeMB uint32)
- func ContainerConfig(ocispec specs.Spec, bundlePath, cid string, detach bool) (vc.ContainerConfig, error)
- func ContainerType(spec specs.Spec) (vc.ContainerType, error)
- func GetSandboxConfigPath(annotations map[string]string) string
- func IsCRIOContainerManager(spec *specs.Spec) bool
- func SandboxConfig(ocispec specs.Spec, runtime RuntimeConfig, bundlePath, cid string, ...) (vc.SandboxConfig, error)
- func SandboxID(spec specs.Spec) (string, error)
- func SetLogger(ctx context.Context, logger *logrus.Entry)
- type FactoryConfig
- type RuntimeConfig
Constants ¶
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" )
const KernelModulesSeparator = ";"
Variables ¶
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{ctrAnnotations.ContainerType, podmanAnnotations.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{ctrAnnotations.SandboxID, podmanAnnotations.SandboxID, dockershimAnnotations.SandboxIDLabelKey} // CRIContainerTypeList lists all the maps from CRI ContainerTypes annotations // to a virtcontainers ContainerType. CRIContainerTypeList = []annotationContainerType{ {podmanAnnotations.ContainerTypeSandbox, vc.PodSandbox}, {podmanAnnotations.ContainerTypeContainer, vc.PodContainer}, {ctrAnnotations.ContainerTypeSandbox, vc.PodSandbox}, {ctrAnnotations.ContainerTypeContainer, vc.PodContainer}, {dockershimAnnotations.ContainerTypeLabelSandbox, vc.PodSandbox}, {dockershimAnnotations.ContainerTypeLabelContainer, vc.PodContainer}, } )
Functions ¶
func CalculateContainerSizing ¶
CalculateContainerSizing will calculate the number of CPUs and amount of memory that is needed based on the provided LinuxResources
func CalculateSandboxSizing ¶
CalculateSandboxSizing will calculate the number of CPUs and amount of Memory that should be added to the VM if sandbox annotations are provided with this sizing details
func ContainerConfig ¶
func ContainerConfig(ocispec specs.Spec, bundlePath, cid 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 server's annotations in the container spec.
func GetSandboxConfigPath ¶
func IsCRIOContainerManager ¶
IsCRIOContainerManager check if a Pod is created from CRI-O
func SandboxConfig ¶
func SandboxConfig(ocispec specs.Spec, runtime RuntimeConfig, bundlePath, cid string, detach, systemdCgroup bool) (vc.SandboxConfig, error)
SandboxConfig converts an OCI compatible runtime configuration file to a virtcontainers sandbox configuration structure.
Types ¶
type FactoryConfig ¶
type FactoryConfig struct { // TemplatePath specifies the path of template. TemplatePath string // VMCacheEndpoint specifies the endpoint of transport VM from the VM cache server to runtime. VMCacheEndpoint string // VMCacheNumber specifies the the number of caches of VMCache. VMCacheNumber uint // Template enables VM templating support in VM factory. Template bool }
FactoryConfig is a structure to set the VM factory configuration.
type RuntimeConfig ¶
type RuntimeConfig struct { //Paths to be bindmounted RO into the guest. SandboxBindMounts []string //Experimental features enabled Experimental []exp.Feature JaegerEndpoint string JaegerUser string JaegerPassword string HypervisorType vc.HypervisorType FactoryConfig FactoryConfig HypervisorConfig vc.HypervisorConfig AgentConfig vc.KataAgentConfig //Determines how the VM should be connected to the //the container network interface InterNetworkModel vc.NetInterworkingModel //Determines how VFIO devices should be presented to the //container VfioMode config.VFIOModeType Debug bool Trace bool //Determines if seccomp should be applied inside guest DisableGuestSeccomp bool // EnableVCPUsPinning controls whether each vCPU thread should be scheduled to a fixed CPU EnableVCPUsPinning bool //SELinux security context applied to the container process inside guest. GuestSeLinuxLabel string // Sandbox sizing information which, if provided, indicates the size of // the sandbox needed for the workload(s) SandboxCPUs float32 SandboxMemMB uint32 // Determines if we should attempt to size the VM at boot time and skip // any later resource updates. StaticSandboxResourceMgmt bool // Determines if create a netns for hypervisor process DisableNewNetNs bool //Determines kata processes are managed only in sandbox cgroup SandboxCgroupOnly bool // Determines if enable pprof EnablePprof bool // Determines if Kata creates emptyDir on the guest DisableGuestEmptyDir bool // CreateContainer timeout which, if provided, indicates the createcontainer request timeout // needed for the workload ( Mostly used for pulling images in the guest ) CreateContainerTimeout uint64 }
RuntimeConfig aggregates all runtime specific settings nolint: govet
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.