Documentation
¶
Overview ¶
Package containerutils holds multiple utils functions around Container IDs and their patterns
Package containerutils holds multiple utils functions around Container IDs and their patterns ¶
Package containerutils groups multiple container utils function that can be used by the secl package
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ContainerIDPatternStr = ""
ContainerIDPatternStr defines the regexp used to match container IDs ([0-9a-fA-F]{64}) is standard container id used pretty much everywhere, length: 64 ([0-9a-fA-F]{32}-\d+) is container id used by AWS ECS, length: 43 ([0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){4}) is container id used by Garden, length: 28
var RuntimeToken = []struct { token string flags CGroupManager }{ {"docker/", CGroupManagerDocker}, {"docker-", CGroupManagerDocker}, {"cri-containerd-", CGroupManagerCRI}, {"crio-", CGroupManagerCRIO}, {"libpod-", CGroupManagerPodman}, {"ecs/", CGroupManagerECS}, {"kubepods", CGroupManagerCRI}, }
RuntimeToken holds the cgroup token used by the different runtimes
Functions ¶
func FindContainerID ¶
func FindContainerID(s CGroupID) (ContainerID, CGroupFlags)
FindContainerID extracts the first sub string that matches the pattern of a container ID along with the container flags induced from the container runtime prefix
Types ¶
type CGroupFlags ¶
type CGroupFlags uint64
CGroupFlags represents the flags of a cgroup
const ( SystemdService CGroupFlags = iota + (1 << 8) SystemdScope )
CGroup flags
const CGroupManagerMask CGroupFlags = 0xff
CGroupManagerMask holds the bitmask for the cgroup manager
func (CGroupFlags) GetCGroupManager ¶ added in v0.68.0
func (f CGroupFlags) GetCGroupManager() CGroupManager
GetCGroupManager returns the cgroup manager from the flags
func (CGroupFlags) IsContainer ¶ added in v0.58.0
func (f CGroupFlags) IsContainer() bool
IsContainer returns whether a cgroup maps to a container
func (CGroupFlags) IsSystemd ¶ added in v0.68.0
func (f CGroupFlags) IsSystemd() bool
IsSystemd returns whether a cgroup maps to a systemd cgroup
type CGroupManager ¶
type CGroupManager uint64
CGroupManager holds the manager of the cgroup lifecycle
const ( CgroupManagerUndefined CGroupManager = iota // unknown CGroupManagerDocker // docker CGroupManagerCRIO // cri-o CGroupManagerPodman // podman CGroupManagerCRI // containerd CGroupManagerSystemd // systemd CGroupManagerECS // ecs )
CGroup managers
func (CGroupManager) String ¶
func (i CGroupManager) String() string