cgroups

package
v1.1.0-rc.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: EPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectMachineRoot

func DetectMachineRoot() bool

DetectMachineRoot reports LXC/VM machine-root hosts (e.g. OrbStack /.lxc layout).

func EnsureAgentSubtree

func EnsureAgentSubtree(policy *CgroupPolicy) error

EnsureAgentSubtree creates the agent cgroup and moves the current process into it.

func IsMachineRootCgroupPath

func IsMachineRootCgroupPath(unifiedPath string) bool

IsMachineRootCgroupPath reports VM/LXC machine boundary cgroups (not workload containers).

func MapRuntimeError

func MapRuntimeError(err error, policy *CgroupPolicy) error

MapRuntimeError converts common CRI/crun delegation failures into actionable errors.

func NeedsEdgeletCgroupParentPrep

func NeedsEdgeletCgroupParentPrep(policy *CgroupPolicy) bool

NeedsEdgeletCgroupParentPrep reports whether /edgelet must be prepared before agent subtrees.

func SetGlobalPolicy

func SetGlobalPolicy(p *CgroupPolicy)

SetGlobalPolicy records the active policy after bootstrap.

func ValidatePreflight

func ValidatePreflight(policy *CgroupPolicy) error

ValidatePreflight checks delegation requirements after bootstrap prep (fat runtime).

func ValidatePreflightLight

func ValidatePreflightLight(policy *CgroupPolicy) error

ValidatePreflightLight checks cgroup detectability for init start_pre hooks (no mutation).

Types

type CgroupPolicy

type CgroupPolicy struct {
	Mode                 Mode
	Driver               Driver
	Nested               bool
	MachineRoot          bool
	SystemdCgroup        bool
	UnifiedMountpoint    string
	AgentCgroupPath      string
	ContainerdCgroupPath string
	DelegatedControllers []string
	HybridWarning        string
}

CgroupPolicy is the resolved cgroup bootstrap policy for embedded edgelet.

func Bootstrap

func Bootstrap() (*CgroupPolicy, error)

Bootstrap detects policy, ensures the agent subtree, and stores it globally.

func Detect

func Detect() (*CgroupPolicy, error)

Detect inspects the host and returns a recommended cgroup policy.

func GetGlobalPolicy

func GetGlobalPolicy() *CgroupPolicy

GetGlobalPolicy returns the active policy, if bootstrap completed.

func PublishHostPolicy

func PublishHostPolicy() (*CgroupPolicy, error)

PublishHostPolicy runs Detect() and stores the result for status reporting without mutating the cgroup hierarchy. Used by the control plane when EDGELET_RUNTIME_SPLIT=1; bootstrap remains owned by runtime-bootstrap.

type Driver

type Driver string

Driver is the cgroup driver selected for embedded containerd/crun.

const (
	DriverSystemd  Driver = "systemd"
	DriverCgroupfs Driver = "cgroupfs"
)

type ErrDelegation

type ErrDelegation struct {
	Controller  string
	Nested      bool // workload container (docker/k8s dev image)
	MachineRoot bool // LXC/VM machine root without delegation
	Mode        Mode
}

ErrDelegation indicates required cgroup controllers are not delegated to edgelet.

func (*ErrDelegation) Error

func (e *ErrDelegation) Error() string

type Mode

type Mode string

Mode describes the host cgroup hierarchy layout.

const (
	ModeV1      Mode = "v1"
	ModeV2      Mode = "v2"
	ModeHybrid  Mode = "hybrid"
	ModeUnknown Mode = "unknown"
)

type Snapshot

type Snapshot struct {
	Mode                 string
	Driver               string
	Nested               bool
	DelegatedControllers string
	AgentCgroupPath      string
	ContainerdCgroupPath string
}

Snapshot exposes cgroup diagnostics for status reporting.

func GetSnapshot

func GetSnapshot() Snapshot

GetSnapshot returns diagnostics for the active policy.

func SnapshotFromPolicy

func SnapshotFromPolicy(p *CgroupPolicy) Snapshot

SnapshotFromPolicy builds a status snapshot from policy.

Jump to

Keyboard shortcuts

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