Documentation ¶
Overview ¶
containermetadata provides functionality for retrieving the kubernetes pod and container metadata or the docker container metadata for a particular PID. For kubernetes it uses the shared informer from the k8s client-go API (https://github.com/kubernetes/client-go/blob/master/tools/cache/shared_informer.go). Through the shared informer we are notified of changes in the state of pods in the Kubernetes cluster and can add the pod container metadata to the cache. As a backup to the kubernetes shared informer and to find the docker container metadata for each pid received (if it is not already in the container caches), it will retrieve the container id from the /proc/PID/cgroup and retrieve the metadata for the containerID.
Index ¶
- Variables
- func GetControllerOf(controllee v1.Object) *v1.OwnerReference
- type ExecInfo
- type MetadataProvider
- func NewAgentMetadataProvider(revision string) MetadataProvider
- func NewContainerMetadataProvider(ctx context.Context, nodeName string) (MetadataProvider, error)
- func NewMainExecutableMetadataProvider(executableCache *lru.SyncedLRU[libpf.FileID, ExecInfo]) MetadataProvider
- func NewProcessMetadataProvider() MetadataProvider
- func NewSystemMetadataProvider() (MetadataProvider, error)
- type Role
Constants ¶
This section is empty.
Variables ¶
var (
ErrDeferred = errors.New("lookup deferred due to previous failure")
)
var ErrFileParse = errors.New("Error Parsing File")
Functions ¶
func GetControllerOf ¶
func GetControllerOf(controllee v1.Object) *v1.OwnerReference
GetControllerOf returns a pointer to a copy of the controllerRef if controllee has a controller https://github.com/kubernetes/apimachinery/blob/cd2cae2b39fa57e8063fa1f5f13cfe9862db3d41/pkg/apis/meta/v1/controller_ref.go
Types ¶
type MetadataProvider ¶
type MetadataProvider interface { // AddMetadata adds metadata to the provided labels.Builder for the given PID. // It returns whether the metadata can be safely cached. AddMetadata(pid libpf.PID, lb *labels.Builder) bool }
MetadataProvider implementations support adding metadata to a labels.Builder.
func NewAgentMetadataProvider ¶
func NewAgentMetadataProvider(revision string) MetadataProvider
func NewContainerMetadataProvider ¶
func NewContainerMetadataProvider(ctx context.Context, nodeName string) (MetadataProvider, error)
NewContainerMetadataProvider creates a new container metadata provider.
func NewMainExecutableMetadataProvider ¶
func NewMainExecutableMetadataProvider( executableCache *lru.SyncedLRU[libpf.FileID, ExecInfo], ) MetadataProvider
NewMainExecutableMetadataProvider creates a new mainExecutableMetadataProvider.
func NewProcessMetadataProvider ¶
func NewProcessMetadataProvider() MetadataProvider
NewProcessMetadataProvider creates a new processMetadataProvider.
func NewSystemMetadataProvider ¶
func NewSystemMetadataProvider() (MetadataProvider, error)