cgidmap

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetContainerID

func SetContainerID(info *processapi.MsgK8sUnix)

Types

type CgroupID

type CgroupID = uint64

convinience types to make APIs more readable

type ContainerID

type ContainerID = string

type Map

type Map interface {
	// Get retrieves a container id based on a cgroup id
	Get(cgID CgroupID) (ContainerID, bool)

	// Add adds a <podID, contID, cgroupID> entry in the mapping
	Add(podID PodID, contID ContainerID, cgroupID CgroupID)

	// Update updates the state of pod and containers.
	// For example, previous container ids added for a certain pod will be removed if the
	// container ids are not in the provided list. Removing all information for a pod (e.g.,
	// when a pod is deleted) can be done by passing an empty list of container ids.
	Update(podID PodID, contIDs []ContainerID)
}

Map implements the a cgroup id to container id maping

Its intended use is to associate pod information with events by using a cgroup id defined in the low-level event (bpf or proc) to find the container ID.

The idea is:

  • Get() is called by the pod-association code
  • Add() is called to update the mapping. This can happen either in runtime hooks or by talking to the CRI
  • Update() is called to update the state of container / pods. This is called by the K8s pod watcher.

func GlobalMap

func GlobalMap() (Map, error)

GlobalMap returns a global reference to the cgidmap

type PodID

type PodID = uuid.UUID

Jump to

Keyboard shortcuts

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