oci

package
v0.0.0-...-2393a11 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnnotationContainerMemorySizeInMB overrides the container memory size set
	// via the OCI spec.
	//
	// Note: This annotation is in MB. OCI is in Bytes. When using this override
	// the caller MUST use MB or sizing will be wrong.
	//
	// Note: This is only present because CRI does not (currently) have a
	// `WindowsPodSandboxConfig` for setting this correctly. It should not be
	// used via OCI runtimes and rather use
	// `spec.Windows.Resources.Memory.Limit`.
	AnnotationContainerMemorySizeInMB = "io.microsoft.container.memory.sizeinmb"
	// AnnotationContainerProcessorCount overrides the container processor count
	// set via the OCI spec.
	//
	// Note: For Windows Process Containers CPU Count/Limit/Weight are mutually
	// exclusive and the caller MUST only set one of the values.
	//
	// Note: This is only present because CRI does not (currently) have a
	// `WindowsPodSandboxConfig` for setting this correctly. It should not be
	// used via OCI runtimes and rather use `spec.Windows.Resources.CPU.Count`.
	AnnotationContainerProcessorCount = "io.microsoft.container.processor.count"
	// AnnotationContainerProcessorLimit overrides the container processor limit
	// set via the OCI spec.
	//
	// Limit allows values 1 - 10,000 where 10,000 means 100% CPU. (And is the
	// default if omitted)
	//
	// Note: For Windows Process Containers CPU Count/Limit/Weight are mutually
	// exclusive and the caller MUST only set one of the values.
	//
	// Note: This is only present because CRI does not (currently) have a
	// `WindowsPodSandboxConfig` for setting this correctly. It should not be
	// used via OCI runtimes and rather use
	// `spec.Windows.Resources.CPU.Maximum`.
	AnnotationContainerProcessorLimit = "io.microsoft.container.processor.limit"
	// AnnotationContainerProcessorWeight overrides the container processor
	// weight set via the OCI spec.
	//
	// Weight allows values 0 - 10,000. (100 is the default)
	//
	// Note: For Windows Process Containers CPU Count/Limit/Weight are mutually
	// exclusive and the caller MUST only set one of the values.
	//
	// Note: This is only present because CRI does not (currently) have a
	// `WindowsPodSandboxConfig` for setting this correctly. It should not be
	// used via OCI runtimes and rather use `spec.Windows.Resources.CPU.Shares`.
	AnnotationContainerProcessorWeight = "io.microsoft.container.processor.weight"
	// AnnotationContainerStorageQoSBandwidthMaximum overrides the container
	// storage bandwidth per second set via the OCI spec.
	//
	// Note: This is only present because CRI does not (currently) have a
	// `WindowsPodSandboxConfig` for setting this correctly. It should not be
	// used via OCI runtimes and rather use
	// `spec.Windows.Resources.Storage.Bps`.
	AnnotationContainerStorageQoSBandwidthMaximum = "io.microsoft.container.storage.qos.bandwidthmaximum"
	// AnnotationContainerStorageQoSIopsMaximum overrides the container storage
	// maximum iops set via the OCI spec.
	//
	// Note: This is only present because CRI does not (currently) have a
	// `WindowsPodSandboxConfig` for setting this correctly. It should not be
	// used via OCI runtimes and rather use
	// `spec.Windows.Resources.Storage.Iops`.
	AnnotationContainerStorageQoSIopsMaximum = "io.microsoft.container.storage.qos.iopsmaximum"
	// AnnotationGPUVHDPath overrides the default path to search for the gpu vhd
	AnnotationGPUVHDPath = "io.microsoft.lcow.gpuvhdpath"
	// AnnotationAssignedDeviceKernelDrivers indicates what drivers to install in the pod during device
	// assignment. This value should contain a list of comma separated directories containing all
	// files and information needed to install given driver(s). This may include .sys,
	// .inf, .cer, and/or other files used during standard installation with pnputil.
	AnnotationAssignedDeviceKernelDrivers = "io.microsoft.assigneddevice.kerneldrivers"
)
View Source
const KubernetesContainerTypeAnnotation = "io.kubernetes.cri.container-type"

KubernetesContainerTypeAnnotation is the annotation used by CRI to define the `ContainerType`.

View Source
const KubernetesSandboxIDAnnotation = "io.kubernetes.cri.sandbox-id"

KubernetesSandboxIDAnnotation is the annotation used by CRI to define the KubernetesContainerTypeAnnotation == "sandbox"` ID.

Variables

This section is empty.

Functions

func IsIsolated

func IsIsolated(s *specs.Spec) bool

IsIsolated checks if `s` is hypervisor isolated.

func IsLCOW

func IsLCOW(s *specs.Spec) bool

IsLCOW checks if `s` is a LCOW config.

func IsWCOW

func IsWCOW(s *specs.Spec) bool

IsWCOW checks if `s` is a WCOW config (argon OR isolated).

func ParseAnnotationsCPUCount

func ParseAnnotationsCPUCount(ctx context.Context, s *specs.Spec, annotation string, def int32) int32

ParseAnnotationsCPUCount searches `s.Annotations` for the CPU annotation. If not found searches `s` for the Windows CPU section. If neither are found returns `def`.

func ParseAnnotationsCPULimit

func ParseAnnotationsCPULimit(ctx context.Context, s *specs.Spec, annotation string, def int32) int32

ParseAnnotationsCPULimit searches `s.Annotations` for the CPU annotation. If not found searches `s` for the Windows CPU section. If neither are found returns `def`.

func ParseAnnotationsCPUWeight

func ParseAnnotationsCPUWeight(ctx context.Context, s *specs.Spec, annotation string, def int32) int32

ParseAnnotationsCPUWeight searches `s.Annotations` for the CPU annotation. If not found searches `s` for the Windows CPU section. If neither are found returns `def`.

func ParseAnnotationsMemory

func ParseAnnotationsMemory(ctx context.Context, s *specs.Spec, annotation string, def uint64) uint64

ParseAnnotationsMemory searches `s.Annotations` for the memory annotation. If not found searches `s` for the Windows memory section. If neither are found returns `def`.

Note: The returned value is in `MB`.

func ParseAnnotationsStorageBps

func ParseAnnotationsStorageBps(ctx context.Context, s *specs.Spec, annotation string, def int32) int32

ParseAnnotationsStorageBps searches `s.Annotations` for the `Bps` annotation. If not found searches `s` for the Windows Storage section. If neither are found returns `def`.

func ParseAnnotationsStorageIops

func ParseAnnotationsStorageIops(ctx context.Context, s *specs.Spec, annotation string, def int32) int32

ParseAnnotationsStorageIops searches `s.Annotations` for the `Iops` annotation. If not found searches `s` for the Windows Storage section. If neither are found returns `def`.

func SpecToUVMCreateOpts

func SpecToUVMCreateOpts(ctx context.Context, s *specs.Spec, id, owner string) (interface{}, error)

SpecToUVMCreateOpts parses `s` and returns either `*uvm.OptionsLCOW` or `*uvm.OptionsWCOW`.

func UpdateSpecFromOptions

func UpdateSpecFromOptions(s specs.Spec, opts *runhcsopts.Options) specs.Spec

UpdateSpecFromOptions sets extra annotations on the OCI spec based on the `opts` struct.

Types

type KubernetesContainerType

type KubernetesContainerType string

KubernetesContainerType defines the valid types of the `KubernetesContainerTypeAnnotation` annotation.

const (
	// KubernetesContainerTypeNone is only valid when
	// `KubernetesContainerTypeAnnotation` is not set.
	KubernetesContainerTypeNone KubernetesContainerType = ""
	// KubernetesContainerTypeContainer is valid when
	// `KubernetesContainerTypeAnnotation == "container"`.
	KubernetesContainerTypeContainer KubernetesContainerType = "container"
	// KubernetesContainerTypeSandbox is valid when
	// `KubernetesContainerTypeAnnotation == "sandbox"`.
	KubernetesContainerTypeSandbox KubernetesContainerType = "sandbox"
)

func GetSandboxTypeAndID

func GetSandboxTypeAndID(specAnnotations map[string]string) (KubernetesContainerType, string, error)

GetSandboxTypeAndID parses `specAnnotations` searching for the `KubernetesContainerTypeAnnotation` and `KubernetesSandboxIDAnnotation` annotations and if found validates the set before returning.

Jump to

Keyboard shortcuts

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