cgroups

package
v1.0.0-beta.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureAgentSubtree

func EnsureAgentSubtree(policy *CgroupPolicy) error

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

func MapRuntimeError

func MapRuntimeError(err error, policy *CgroupPolicy) error

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

func SetGlobalPolicy

func SetGlobalPolicy(p *CgroupPolicy)

SetGlobalPolicy records the active policy after bootstrap.

func ValidatePreflight

func ValidatePreflight(policy *CgroupPolicy) error

ValidatePreflight checks delegation requirements before CRI starts.

Types

type CgroupPolicy

type CgroupPolicy struct {
	Mode                 Mode
	Driver               Driver
	Nested               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
	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