Documentation ¶
Index ¶
- Constants
- func MemLimitGivenSystem(cgroupLimit uint64) uint64
- func UpdateWithMemoryStatsFromFile(memoryStatPath, inactiveFileSearchString string, memory *types.MemoryUsage, ...) error
- func VerifyMemoryIsEnough(memoryLimit int64) error
- type CgroupManager
- type CgroupfsManager
- func (m *CgroupfsManager) ContainerCgroupAbsolutePath(sbParent, containerID string) (string, error)
- func (*CgroupfsManager) ContainerCgroupPath(sbParent, containerID string) string
- func (m *CgroupfsManager) CreateSandboxCgroup(sbParent, containerID string) error
- func (*CgroupfsManager) IsSystemd() bool
- func (*CgroupfsManager) MoveConmonToCgroup(cid, cgroupParent, conmonCgroup string, pid int, ...) (cgroupPathToClean string, _ error)
- func (*CgroupfsManager) Name() string
- func (m *CgroupfsManager) PopulateContainerCgroupStats(sbParent, containerID string, stats *types.ContainerStats) error
- func (m *CgroupfsManager) PopulateSandboxCgroupStats(sbParent string, stats *types.PodSandboxStats) error
- func (m *CgroupfsManager) SandboxCgroupPath(sbParent, sbID string) (cgParent, cgPath string, _ error)
- type SystemdManager
- func (m *SystemdManager) ContainerCgroupAbsolutePath(sbParent, containerID string) (string, error)
- func (*SystemdManager) ContainerCgroupPath(sbParent, containerID string) string
- func (m *SystemdManager) CreateSandboxCgroup(sbParent, containerID string) error
- func (*SystemdManager) IsSystemd() bool
- func (m *SystemdManager) MoveConmonToCgroup(cid, cgroupParent, conmonCgroup string, pid int, ...) (cgroupPathToClean string, _ error)
- func (*SystemdManager) Name() string
- func (m *SystemdManager) PopulateContainerCgroupStats(sbParent, containerID string, stats *types.ContainerStats) error
- func (m *SystemdManager) PopulateSandboxCgroupStats(sbParent string, stats *types.PodSandboxStats) error
- func (m *SystemdManager) SandboxCgroupPath(sbParent, sbID string) (cgParent, cgPath string, _ error)
Constants ¶
const (
DefaultCgroupManager = systemdCgroupManager
)
Variables ¶
This section is empty.
Functions ¶
func MemLimitGivenSystem ¶ added in v1.23.0
MemLimitGivenSystem limit returns the memory limit for a given cgroup If the configured memory limit is larger than the total memory on the sys, the physical system memory size is returned
func UpdateWithMemoryStatsFromFile ¶ added in v1.23.0
func UpdateWithMemoryStatsFromFile(memoryStatPath, inactiveFileSearchString string, memory *types.MemoryUsage, usage uint64) error
func VerifyMemoryIsEnough ¶
VerifyMemoryIsEnough verifies that the cgroup memory limit is above a specified minimum memory limit.
Types ¶
type CgroupManager ¶
type CgroupManager interface { // String returns the name of the cgroup manager (either cgroupfs or systemd) Name() string // IsSystemd returns whether it is a systemd cgroup manager IsSystemd() bool // ContainerCgroupPath takes arguments sandbox parent cgroup and container ID and returns // the cgroup path for that containerID. If parentCgroup is empty, it // uses the default parent for that particular manager ContainerCgroupPath(string, string) string // ContainerCgroupAbsolutePath takes arguments sandbox parent cgroup and container ID and // returns the cgroup path on disk for that containerID. If parentCgroup is empty, it // uses the default parent for that particular manager ContainerCgroupAbsolutePath(string, string) (string, error) // PopulateContainerCgroupStats fills the stats object with information from the cgroup found // given a cgroup parent and container ID. PopulateContainerCgroupStats(sbParent, containerID string, stats *types.ContainerStats) error // SandboxCgroupPath takes the sandbox parent, and sandbox ID. It // returns the cgroup parent, cgroup path, and error. For systemd cgroups, // it also checks there is enough memory in the given cgroup SandboxCgroupPath(string, string) (string, string, error) // PopulateContainerCgroupStats takes arguments sandbox parent cgroup, and sandbox stats object. // It fills the object with information from the cgroup found given that parent. PopulateSandboxCgroupStats(sbParent string, stats *types.PodSandboxStats) error // MoveConmonToCgroup takes the container ID, cgroup parent, conmon's cgroup (from the config), conmon's PID, and some customized resources // It attempts to move conmon to the correct cgroup, and set the resources for that cgroup. // It returns the cgroupfs parent that conmon was put into // so that CRI-O can clean the parent cgroup of the newly added conmon once the process terminates (systemd handles this for us) MoveConmonToCgroup(cid, cgroupParent, conmonCgroup string, pid int, resources *rspec.LinuxResources) (string, error) // CreateSandboxCgroup takes the sandbox parent, and sandbox ID. // It creates a new cgroup for that sandbox, which is useful when spoofing an infra container. CreateSandboxCgroup(sbParent, containerID string) error }
CgroupManager is an interface to interact with cgroups on a node. CRI-O is configured at startup to either use systemd or cgroupfs, and the node itself is booted with cgroup v1, or cgroup v2. CgroupManager is an interface for the CRI-O server to use cgroups, regardless of how it or the node was configured.
func SetCgroupManager ¶
func SetCgroupManager(cgroupManager string) (CgroupManager, error)
SetCgroupManager takes a string and branches on it to return the type of cgroup manager configured
type CgroupfsManager ¶
type CgroupfsManager struct {
// contains filtered or unexported fields
}
CgroupfsManager defines functionality whrn **** TODO: Update this
func (*CgroupfsManager) ContainerCgroupAbsolutePath ¶
func (m *CgroupfsManager) ContainerCgroupAbsolutePath(sbParent, containerID string) (string, error)
ContainerCgroupAbsolutePath just calls ContainerCgroupPath, because they both return the absolute path
func (*CgroupfsManager) ContainerCgroupPath ¶
func (*CgroupfsManager) ContainerCgroupPath(sbParent, containerID string) string
ContainerCgroupPath takes arguments sandbox parent cgroup and container ID and returns the cgroup path for that containerID. If parentCgroup is empty, it uses the default parent /crio
func (*CgroupfsManager) CreateSandboxCgroup ¶ added in v1.21.0
func (m *CgroupfsManager) CreateSandboxCgroup(sbParent, containerID string) error
CreateSandboxCgroup calls the helper function createSandboxCgroup for this manager.
func (*CgroupfsManager) IsSystemd ¶
func (*CgroupfsManager) IsSystemd() bool
IsSystemd returns that this is not a systemd cgroup manager
func (*CgroupfsManager) MoveConmonToCgroup ¶
func (*CgroupfsManager) MoveConmonToCgroup(cid, cgroupParent, conmonCgroup string, pid int, resources *rspec.LinuxResources) (cgroupPathToClean string, _ error)
MoveConmonToCgroup takes the container ID, cgroup parent, conmon's cgroup (from the config) and conmon's PID It attempts to move conmon to the correct cgroup. It returns the cgroupfs parent that conmon was put into so that CRI-O can clean the cgroup path of the newly added conmon once the process terminates (systemd handles this for us)
func (*CgroupfsManager) Name ¶
func (*CgroupfsManager) Name() string
Name returns the name of the cgroup manager (cgroupfs)
func (*CgroupfsManager) PopulateContainerCgroupStats ¶ added in v1.23.0
func (m *CgroupfsManager) PopulateContainerCgroupStats(sbParent, containerID string, stats *types.ContainerStats) error
PopulateContainerCgroupStats takes arguments sandbox parent cgroup, container ID, and containers stats object. It fills the object with information from the cgroup found given that parent and ID
func (*CgroupfsManager) PopulateSandboxCgroupStats ¶ added in v1.23.0
func (m *CgroupfsManager) PopulateSandboxCgroupStats(sbParent string, stats *types.PodSandboxStats) error
PopulateSandboxCgroupStats takes arguments sandbox parent cgroup and sandbox stats object It fills the object with information from the cgroup found given that cgroup
func (*CgroupfsManager) SandboxCgroupPath ¶
func (m *CgroupfsManager) SandboxCgroupPath(sbParent, sbID string) (cgParent, cgPath string, _ error)
SandboxCgroupPath takes the sandbox parent, and sandbox ID. It returns the cgroup parent, cgroup path, and error.
type SystemdManager ¶
type SystemdManager struct {
// contains filtered or unexported fields
}
SystemdManager is the parent type of SystemdV{1,2}Manager. it defines all of the common functionality between V1 and V2
func NewSystemdManager ¶ added in v1.19.3
func NewSystemdManager() *SystemdManager
func (*SystemdManager) ContainerCgroupAbsolutePath ¶
func (m *SystemdManager) ContainerCgroupAbsolutePath(sbParent, containerID string) (string, error)
func (*SystemdManager) ContainerCgroupPath ¶
func (*SystemdManager) ContainerCgroupPath(sbParent, containerID string) string
ContainerCgroupPath takes arguments sandbox parent cgroup and container ID and returns the cgroup path for that containerID. If parentCgroup is empty, it uses the default parent system.slice
func (*SystemdManager) CreateSandboxCgroup ¶ added in v1.21.0
func (m *SystemdManager) CreateSandboxCgroup(sbParent, containerID string) error
CreateSandboxCgroup calls the helper function createSandboxCgroup for this manager.
func (*SystemdManager) IsSystemd ¶
func (*SystemdManager) IsSystemd() bool
IsSystemd returns that it is a systemd cgroup manager
func (*SystemdManager) MoveConmonToCgroup ¶
func (m *SystemdManager) MoveConmonToCgroup(cid, cgroupParent, conmonCgroup string, pid int, resources *rspec.LinuxResources) (cgroupPathToClean string, _ error)
MoveConmonToCgroup takes the container ID, cgroup parent, conmon's cgroup (from the config) and conmon's PID It attempts to move conmon to the correct cgroup. cgroupPathToClean should always be returned empty. It is part of the interface to return the cgroup path that cri-o is responsible for cleaning up upon the container's death. Systemd takes care of this cleaning for us, so return an empty string
func (*SystemdManager) Name ¶
func (*SystemdManager) Name() string
Name returns the name of the cgroup manager (systemd)
func (*SystemdManager) PopulateContainerCgroupStats ¶ added in v1.23.0
func (m *SystemdManager) PopulateContainerCgroupStats(sbParent, containerID string, stats *types.ContainerStats) error
PopulateContainerCgroupStats takes arguments sandbox parent cgroup, container ID, and containers stats object. It fills the object with information from the cgroup found given that parent and ID
func (*SystemdManager) PopulateSandboxCgroupStats ¶ added in v1.23.0
func (m *SystemdManager) PopulateSandboxCgroupStats(sbParent string, stats *types.PodSandboxStats) error
PopulateSandboxCgroupStats takes arguments sandbox parent cgroup and sandbox stats object It fills the object with information from the cgroup found given that cgroup
func (*SystemdManager) SandboxCgroupPath ¶
func (m *SystemdManager) SandboxCgroupPath(sbParent, sbID string) (cgParent, cgPath string, _ error)
SandboxCgroupPath takes the sandbox parent, and sandbox ID. It returns the cgroup parent, cgroup path, and error. It also checks there is enough memory in the given cgroup