Documentation ¶
Index ¶
- Constants
- Variables
- func EnrichWithK8sMetadata(container *ContainerData, labels map[string]string)
- func IsEnrichedWithK8sMetadata(k8s types.BasicK8sMetadata) bool
- func IsEnrichedWithRuntimeMetadata(runtime types.BasicRuntimeMetadata) bool
- func ParseContainerID(expectedRuntime types.RuntimeName, containerID string) (string, error)
- type ContainerData
- type ContainerDetailsData
- type ContainerMountData
- type ContainerRuntimeClient
- type K8sContainerData
- type RuntimeContainerData
Constants ¶
const ( // Make sure to keep these settings in sync with pkg/resources/manifests/deploy.yaml CrioDefaultSocketPath = "/run/crio/crio.sock" PodmanDefaultSocketPath = "/run/podman/podman.sock" ContainerdDefaultSocketPath = "/run/containerd/containerd.sock" DockerDefaultSocketPath = "/run/docker.sock" CriDockerDefaultSocketPath = "/run/cri-dockerd.sock" )
const ( // Container was created but has not started running. StateCreated = "created" // Container is currently running. StateRunning = "running" // Container has stopped or exited. StateExited = "exited" // Container has an unknown or unrecognized state. StateUnknown = "unknown" )
const ( ContainerLabelK8sContainerName = "io.kubernetes.container.name" ContainerLabelK8sPodName = "io.kubernetes.pod.name" ContainerLabelK8sPodNamespace = "io.kubernetes.pod.namespace" ContainerLabelK8sPodUID = "io.kubernetes.pod.uid" )
Variables ¶
var ErrPauseContainer = errors.New("it is a pause container")
Functions ¶
func EnrichWithK8sMetadata ¶
func EnrichWithK8sMetadata(container *ContainerData, labels map[string]string)
func IsEnrichedWithK8sMetadata ¶ added in v0.19.0
func IsEnrichedWithK8sMetadata(k8s types.BasicK8sMetadata) bool
IsEnrichedWithK8sMetadata returns true if the container already contains the Kubernetes metadata a container runtime client is able to provide.
func IsEnrichedWithRuntimeMetadata ¶ added in v0.19.0
func IsEnrichedWithRuntimeMetadata(runtime types.BasicRuntimeMetadata) bool
IsEnrichedWithRuntimeMetadata returns true if the container already contains the runtime metadata a container runtime client is able to provide.
func ParseContainerID ¶
func ParseContainerID(expectedRuntime types.RuntimeName, containerID string) (string, error)
Types ¶
type ContainerData ¶
type ContainerData struct { // Runtime contains all the metadata returned by the container runtime. Runtime RuntimeContainerData // K8s contains the Kubernetes metadata of the container. K8s K8sContainerData }
ContainerData contains container information returned from the container runtime clients.
type ContainerDetailsData ¶
type ContainerDetailsData struct { // ContainerDetailsData contains all ContainerData fields. ContainerData // Process identifier. Pid int // Path for the container cgroups. CgroupsPath string // List of mounts in the container. Mounts []ContainerMountData }
ContainerDetailsData contains container extra information returned from the container runtime clients. This information might not be available when listing containers.
type ContainerMountData ¶
type ContainerMountData struct { // Source of the mount in the host file-system. Source string // Destination of the mount in the container. Destination string }
ContainerMountData contains mount information in ContainerData.
type ContainerRuntimeClient ¶
type ContainerRuntimeClient interface { // GetContainers returns a slice with the information of all the containers. GetContainers() ([]*ContainerData, error) // GetContainers returns the information of the container identified by the // provided ID. GetContainer(containerID string) (*ContainerData, error) // GetContainerDetails returns the detailed information of the container // identified by the provided ID. // The container details cannot be provided prior to container being in // running state. GetContainerDetails(containerID string) (*ContainerDetailsData, error) // Close tears down the connection with the container runtime. Close() error }
ContainerRuntimeClient defines the interface to communicate with the different container runtimes.
type K8sContainerData ¶ added in v0.19.0
type K8sContainerData struct { types.BasicK8sMetadata // Unique identifier of pod running the container. PodUID string }
type RuntimeContainerData ¶ added in v0.19.0
type RuntimeContainerData struct { // Almost like types.BasicRuntimeMetadata but don't use it because we // don't need ContainerPID RuntimeName types.RuntimeName ContainerID string ContainerName string ContainerImageName string ContainerImageDigest string ContainerStartedAt types.Time // Current state of the container. State string }