Documentation
¶
Overview ¶
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
Functions ¶
func FindECSTaskID ¶ added in v0.86.0
FindECSTaskID extracts the ECS task ID from the innermost task cgroup found in s.
The ECS agent creates a cgroup per task when task CPU and memory limits are enabled (the default), with cgroup v1:
/ecs/<task-id>/<container-id>
and with cgroup v2:
/ecstasks.slice/ecstasks-<task-id>.slice/docker-<container-id>.scope
The returned task ID is normalized to lowercase.
func FindPodUID ¶ added in v0.85.0
FindPodUID extracts the Kubernetes pod UID from a kubelet cgroup path.
It supports both cgroupfs paths such as:
/kubepods/besteffort/pod48d25824-cbe2-4fdc-9928-5bb49e05473d/...
and systemd paths such as:
/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod48d25824_cbe2_4fdc_9928_5bb49e05473d.slice/...
The returned UID is normalized to the canonical dashed, lowercase form.
Types ¶
type ContainerID ¶
type ContainerID string
ContainerID represents a container ID
func FindContainerID ¶
func FindContainerID(s CGroupID) ContainerID
FindContainerID returns the last container ID found in s, which is the innermost container of a nested cgroup path.
type WorkloadID ¶ added in v0.72.0
type WorkloadID interface{}
WorkloadID represents a workload identifier that can be either a container ID or cgroup ID