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 ¶
const ( // ContainerRuntimeDocker is used to specify that a container is managed by Docker ContainerRuntimeDocker = "docker" // ContainerRuntimeCRI is used to specify that a container is managed by containerd ContainerRuntimeCRI = "containerd" // ContainerRuntimeCRIO is used to specify that a container is managed by CRI-O ContainerRuntimeCRIO = "cri-o" // ContainerRuntimePodman is used to specify that a container is managed by Podman ContainerRuntimePodman = "podman" )
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 RuntimePrefixes = []struct { prefix string flags CGroupManager }{ {"docker/", CGroupManagerDocker}, {"docker-", CGroupManagerDocker}, {"cri-containerd-", CGroupManagerCRI}, {"crio-", CGroupManagerCRIO}, {"libpod-", CGroupManagerPodman}, }
RuntimePrefixes holds the cgroup prefixed used by the different runtimes
Functions ¶
This section is empty.
Types ¶
type CGroupFlags ¶
type CGroupFlags uint64
CGroupFlags represents the flags of a cgroup
const ( SystemdService CGroupFlags = (0 << 8) SystemdScope CGroupFlags = (1 << 8) )
CGroup flags
const CGroupManagerMask CGroupFlags = 0b111
CGroupManagerMask holds the bitmask for the cgroup manager
func (CGroupFlags) IsContainer ¶ added in v0.58.0
func (f CGroupFlags) IsContainer() bool
IsContainer returns whether a cgroup maps to a container
type CGroupManager ¶
type CGroupManager uint64
CGroupManager holds the manager of the cgroup lifecycle
const ( CGroupManagerDocker CGroupManager = iota + 1 // docker CGroupManagerCRIO // cri-o CGroupManagerPodman // podman CGroupManagerCRI // containerd CGroupManagerSystemd // systemd )
CGroup managers
func (CGroupManager) String ¶
func (i CGroupManager) String() string
type ContainerID ¶
type ContainerID string
ContainerID represents a container ID
func FindContainerID ¶
func FindContainerID(s CGroupID) (ContainerID, uint64)
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