Documentation
¶
Index ¶
- func GetContainerIdFromTaskDir(taskPath string) (string, error)
- func RemoveFromBpfMap(bpfModule *libbpfgo.Module, cgroupId uint64, mapName string) error
- type CgroupInfo
- type Containers
- func (c *Containers) CgroupExists(cgroupId uint64) bool
- func (c *Containers) CgroupMkdir(cgroupId uint64, subPath string) (CgroupInfo, error)
- func (c *Containers) CgroupRemove(cgroupId uint64)
- func (c *Containers) CgroupUpdate(cgroupId uint64, path string, ctime time.Time) (CgroupInfo, error)
- func (c *Containers) GetCgroupInfo(cgroupId uint64) CgroupInfo
- func (c *Containers) GetContainers() []string
- func (c *Containers) IsCgroupV1() bool
- func (c *Containers) Populate() error
- func (c *Containers) PopulateBpfMap(bpfModule *libbpfgo.Module, mapName string) 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
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) (CgroupInfo, error)
CgroupMkdir adds cgroupInfo of a created cgroup dir to Containers struct.
func (*Containers) CgroupRemove ¶
func (c *Containers) CgroupRemove(cgroupId uint64)
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) GetCgroupInfo ¶
func (c *Containers) GetCgroupInfo(cgroupId uint64) CgroupInfo
GetCgroupInfo returns the Containers struct cgroupInfo data of a given cgroupId.
func (*Containers) GetContainers ¶
func (c *Containers) GetContainers() []string
GetContainers provides a list of all added containers by their uuid.
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