Documentation
¶
Index ¶
- func GetContainerIdFromTaskDir(taskPath string) (string, error)
- type CgroupInfo
- type Containers
- func (c *Containers) CgroupExists(cgroupId uint64) bool
- func (c *Containers) CgroupMkdir(cgroupId uint64, subPath string, hierarchyID uint32) (CgroupInfo, error)
- func (c *Containers) CgroupRemove(cgroupId uint64, hierarchyID uint32)
- func (c *Containers) CgroupUpdate(cgroupId uint64, path string, ctime time.Time) (CgroupInfo, error)
- func (c *Containers) FindContainerCgroupID32LSB(containerID string) []uint32
- func (c *Containers) GetCgroupInfo(cgroupId uint64) CgroupInfo
- func (c *Containers) GetCgroupV1HID() int
- func (c *Containers) GetContainers() []CgroupInfo
- func (c *Containers) IsCgroupV1() bool
- func (c *Containers) Populate() error
- func (c *Containers) PopulateBpfMap(bpfModule *libbpfgo.Module, mapName string) error
- func (c *Containers) RemoveFromBpfMap(bpfModule *libbpfgo.Module, cgroupId uint64, hierarchyID uint32, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContainerIdFromTaskDir ¶
gets a containerID from a given task or process directory path
Types ¶
type CgroupInfo ¶
type CgroupInfo struct {
Path string
ContainerId string
Runtime string
Ctime time.Time
// contains filtered or unexported fields
}
CgroupInfo represents a cgroup dir (might describe a container cgroup dir).
type Containers ¶
type Containers struct {
// contains filtered or unexported fields
}
Containers contains information about running containers in the host.
func InitContainers ¶
func InitContainers() (*Containers, error)
InitContainers initializes a Containers object and returns a pointer to it. User should further call "Populate" and iterate with Containers data.
func (*Containers) CgroupExists ¶
func (c *Containers) CgroupExists(cgroupId uint64) bool
CgroupExists checks if there is a cgroupInfo data of a given cgroupId.
func (*Containers) CgroupMkdir ¶
func (c *Containers) CgroupMkdir(cgroupId uint64, subPath string, hierarchyID uint32) (CgroupInfo, error)
CgroupMkdir adds cgroupInfo of a created cgroup dir to Containers struct.
func (*Containers) CgroupRemove ¶
func (c *Containers) CgroupRemove(cgroupId uint64, hierarchyID uint32)
CgroupRemove removes cgroupInfo of deleted cgroup dir from Containers struct. NOTE: Expiration logic of 5 seconds to avoid race conditions (if cgroup dir event arrives too fast and its cgroupInfo data is still needed).
func (*Containers) CgroupUpdate ¶
func (c *Containers) CgroupUpdate(cgroupId uint64, path string, ctime time.Time) (CgroupInfo, error)
CgroupUpdate checks if given path belongs to a known container runtime, saving container information in Containers CgroupInfo map. NOTE: ALL given cgroup dir paths are stored in CgroupInfo map.
func (*Containers) FindContainerCgroupID32LSB ¶
func (c *Containers) FindContainerCgroupID32LSB(containerID string) []uint32
FindContainerCgroupID32LSB returns the 32 LSB of the Cgroup ID for a given container ID
func (*Containers) GetCgroupInfo ¶
func (c *Containers) GetCgroupInfo(cgroupId uint64) CgroupInfo
GetCgroupInfo returns the Containers struct cgroupInfo data of a given cgroupId.
func (*Containers) GetCgroupV1HID ¶
func (c *Containers) GetCgroupV1HID() int
func (*Containers) GetContainers ¶
func (c *Containers) GetContainers() []CgroupInfo
GetContainers provides a list of all existing containers.
func (*Containers) IsCgroupV1 ¶
func (c *Containers) IsCgroupV1() bool
func (*Containers) Populate ¶
func (c *Containers) Populate() error
Populate populates Containers struct by reading mounted proc and cgroups fs.
func (*Containers) PopulateBpfMap ¶
func (c *Containers) PopulateBpfMap(bpfModule *libbpfgo.Module, mapName string) error