Documentation
¶
Overview ¶
Package sizing right-sizes a sandbox to the actor's declared resource limits. The actor's limits arrive over the ateom RPCs (RunWorkload / RestoreWorkload) as a SandboxSize. ateom-gvisor calls ApplyToOCISpec to write them into the sandbox container's OCI spec, which runsc then applies to the host cgroup leaf. ateom-microvm does not call ApplyToOCISpec: it uses SandboxSize only to size the VM itself (VCPUs, and MemoryBytes via resolveGuestMemMiB). A micro-VM container's own cgroup limit comes instead from that container's declared `spec.containers[].resources`, written into its OCI spec by atelet.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SandboxSize ¶
type SandboxSize struct {
// MilliCPU is the CPU limit in millicores (1000 = one core), or 0 if unset.
MilliCPU int64
// MemoryBytes is the memory limit in bytes, or 0 if unset.
MemoryBytes int64
}
SandboxSize is the sandbox's target size, derived from the actor's declared resource limits. A zero field means "unset": the caller keeps its own default (the kata config for the micro-VM, unlimited for gVisor).
func FromLimits ¶
func FromLimits(milliCPU, memoryBytes int64) SandboxSize
FromLimits builds a SandboxSize from an actor's declared limits (millicores and bytes) as carried on the ateom RPCs. It is runtime-agnostic; both ateom-gvisor and ateom-microvm call it. Negative values are clamped to zero ("unset").
func (SandboxSize) ApplyToOCISpec ¶
func (s SandboxSize) ApplyToOCISpec(spec *specs.Spec)
ApplyToOCISpec writes the pod's CPU/memory limits into the container OCI spec's linux.resources so the sandbox cgroup is created with the right values. This is the gVisor sandbox-cgroup path: only ateom-gvisor calls it, so runsc applies the result to the host cgroup leaf. Fields that are unset in SandboxSize are left untouched, preserving any existing values on the spec.
func (SandboxSize) VCPUs ¶
func (s SandboxSize) VCPUs() int
VCPUs converts the CPU limit to a whole vCPU count for the micro-VM, rounding up so a fractional limit still yields a usable core (minimum 1 when a limit is set). Returns 0 when the CPU limit is unset, letting the caller keep its default.