Documentation
¶
Overview ¶
Package ocispec builds the runtime-neutral OCI spec for actor bundles, which each worker shapes for its runtime.
Index ¶
- Constants
- func Build(o Options) *specs.Spec
- func BuildSandbox(actorUID string) *specs.Spec
- func GVisorCgroupLeaf(actorUID, containerName string) string
- func GuestContainerID(name string) string
- func Save(bundlePath string, spec *specs.Spec) error
- func ShapeGVisor(spec *specs.Spec, o GVisorOptions)
- func ShapeMicroVM(spec *specs.Spec, o MicroVMOptions) error
- type GVisorOptions
- type MicroVMOptions
- type Options
Constants ¶
const ( GuestSharedDir = "/run/kata-containers/shared/containers" // ShareDurable, ShareCSI and ShareSystemInfo hold one subdirectory per // volume; ShareVolumes holds a container's image volumes at // <containerID>/volumes/<name>. )
Sub-share names inside the micro-VM virtio-fs share.
const Hostname = "actor"
Hostname is the UTS hostname for actor containers.
const SandboxID = "_sandbox"
SandboxID is the runsc ID of the sandbox. runsc creates it with -no-root-container, so it has no process and no rootfs. The underscore keeps it outside the k8s-short-name an ActorTemplate container name is drawn from, so no actor container can collide with it.
Variables ¶
This section is empty.
Functions ¶
func BuildSandbox ¶
BuildSandbox returns the OCI spec of a sandbox with no root container: the hostname and namespaces, and no process, rootfs, or mounts.
func GVisorCgroupLeaf ¶
GVisorCgroupLeaf names an actor container's cgroup relative to the pod scope.
func GuestContainerID ¶
GuestContainerID returns the kata container ID for a container name.
kata requires IDs of at least two characters, and a name can be one. '_' is not valid in a name, so the ID can't collide with another name or the Share* dirs. It must only depend on the name, since a restored guest keeps the IDs it booted with. https://github.com/kata-containers/kata-containers/blob/4.1.0/src/libs/kata-sys-util/src/validate.rs#L17-L22
func ShapeGVisor ¶
func ShapeGVisor(spec *specs.Spec, o GVisorOptions)
ShapeGVisor adds runsc CRI annotations, durable-dir mount hints, and per-container cgroups to the spec. It is idempotent.
func ShapeMicroVM ¶
func ShapeMicroVM(spec *specs.Spec, o MicroVMOptions) error
ShapeMicroVM replaces host system mounts with guest mounts, repoints volume bind mounts to guest share paths, and fills in kata's default resources. It must run on an unshaped spec, and errors on a bind it cannot place in the guest.
Types ¶
type GVisorOptions ¶
type GVisorOptions struct {
ActorUID string
ActorDirs *ateworkerpb.ActorDirs
ContainerName string
// DurableVolumes are declared on the sandbox spec only.
DurableVolumes []string
// Size sizes the container's cgroup leaf. Only gVisor applies it; a micro-VM
// container's limits come from its own declared resources (see sizing).
Size sizing.SandboxSize
}
GVisorOptions describes the gVisor-specific context of one actor container.
type MicroVMOptions ¶
type MicroVMOptions struct {
// ActorDirs are the actor's directories; volume bind sources under them are
// staged into the share.
ActorDirs *ateworkerpb.ActorDirs
ContainerName string
}
MicroVMOptions describes the micro-VM context of one actor container.
type Options ¶
type Options struct {
// ActorUID names the actor's network namespace.
ActorUID string
// ActorDirs are the actor's directories the bind mount sources are joined
// from, one subdirectory per volume name.
ActorDirs *ateworkerpb.ActorDirs
// Container carries the process and its volume mounts.
Container *ateworkerpb.Container
}
Options describes one actor container.