containerutils

package
v0.86.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 3 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func FindECSTaskID(s CGroupID) string

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

func FindPodUID(s CGroupID) string

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 CGroupID

type CGroupID string

CGroupID represents a cgroup ID

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL