containermetadata

package
v0.0.0-...-3b12f0d Latest Latest
Warning

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

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

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerMetadata

type ContainerMetadata struct {
	PodName       string
	ContainerName string
	// contains filtered or unexported fields
}

ContainerMetadata contains the container and/or pod metadata.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler does the retrieval of container metadata for a particular pid.

func GetHandler

func GetHandler(ctx context.Context, monitorInterval time.Duration) (*Handler, error)

GetHandler returns a new Handler instance used for retrieving container metadata.

func (*Handler) GetContainerMetadata

func (h *Handler) GetContainerMetadata(pid libpf.PID) (ContainerMetadata, error)

GetContainerMetadata returns the pod name and container name metadata associated with the provided pid. Returns an empty object if no container metadata exists.

Jump to

Keyboard shortcuts

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