Documentation
¶
Overview ¶
Package cgroups provides cgroup management for containers.
Index ¶
- type Config
- type Manager
- func (m *Manager) AddProcess(containerID string, pid int) error
- func (m *Manager) CgroupPath(containerID string) string
- func (m *Manager) Create(containerID string, cfg *Config) (string, error)
- func (m *Manager) Destroy(containerID string) error
- func (m *Manager) Freeze(containerID string) error
- func (m *Manager) GetStats(containerID string) (map[string]interface{}, error)
- func (m *Manager) GetStatsFull(containerID string) (map[string]interface{}, error)
- func (m *Manager) IsAvailable() bool
- func (m *Manager) KillAll(containerID string) error
- func (m *Manager) Pressure(containerID, file string) (PSIStats, error)
- func (m *Manager) Thaw(containerID string) error
- func (m *Manager) Update(containerID string, cfg *Config) error
- type PSIStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
CPUPeriod uint64
CPUQuota int64
CpusetCpus string
CpusetMems string
Memory int64
MemorySwap int64
MemorySwappiness *uint64
PidsLimit int64
BlkioWeight uint16
NanoCpus int64
OomKillDisable bool
}
Config holds cgroup configuration.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages cgroups v2 for containers.
func (*Manager) AddProcess ¶
AddProcess adds a process to the cgroup.
func (*Manager) CgroupPath ¶ added in v0.12.0
CgroupPath returns the absolute cgroup v2 path for a container.
func (*Manager) GetStatsFull ¶ added in v0.12.0
GetStatsFull returns full cgroup statistics for a container, including PSI for cpu/memory/io.
func (*Manager) IsAvailable ¶
IsAvailable checks if cgroups v2 is available.
func (*Manager) Pressure ¶ added in v0.12.0
Pressure reads a cgroup v2 pressure file (e.g. cpu.pressure).
func (*Manager) Update ¶ added in v0.12.0
Update atomically updates a subset of cgroup limits. Implements CRI UpdateContainerResources semantics: rollback on any failure.
Returns the per-controller set of errors so the caller can surface them in CRI/ContainerStats. The bool indicates whether at least one resource was updated.