Documentation
¶
Overview ¶
Package containment binds workers and payloads to one job service cgroup.
Index ¶
Constants ¶
const WorkerUnitPattern = workerUnitPrefix + "*.service"
WorkerUnitPattern selects only the host-reserved worker instance namespace.
Variables ¶
var ( // ErrAbsent reports an absent service cgroup, not a fence against future starts. ErrAbsent = errors.New("cortex: sandbox service cgroup absent") // ErrChanged reports a cgroup appearing after an absent kill target. ErrChanged = errors.New("cortex: sandbox containment changed during cleanup") )
Functions ¶
func CheckMembership ¶
CheckMembership verifies the exact cgroup-v2 worker subgroup. A payload, sibling job, descendant subgroup or legacy hierarchy is not equivalent.
func JobFromUnit ¶
JobFromUnit accepts only the canonical service name generated by ForJob. Aliases, paths and identities belonging to other entity types are refused.
func VerifyCurrent ¶
VerifyCurrent requires a root worker in the exact delegated service subgroup. The procfs and cgroup-v2 mounts are checked before any runtime invocation.
Types ¶
type Layout ¶
type Layout struct{ Unit, Parent, Worker, Payload string }
Layout is the fixed service hierarchy. The service manager must delegate controllers and place its worker in supervisor; runsc creates payload below the same parent. The outer service's kill policy must cover every descendant.
type Observation ¶
type Observation struct{ Empty, Absent bool }
Observation distinguishes an empty hierarchy from an absent hierarchy. Neither proves that the service manager cannot launch a queued worker later. Establish a durable start fence separately before recording workerstore.Reaped.
func KillAndWait ¶
KillAndWait uses cgroup.kill and waits for the complete hierarchy to empty. It requires a root-run Linux reaper outside the target group. Supply an independent cleanup context; waits are capped at ten seconds. No PID walk, process-group fallback or cgroup deletion is performed.