runtime

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PodNameLabel                 = "io.kubernetes.pod.name"
	PodNamespaceLabel            = "io.kubernetes.pod.namespace"
	PodUIDLabel                  = "io.kubernetes.pod.uid"
	ContainerNameLabel           = "io.kubernetes.container.name"
	ContainerTypeDockerLabel     = "io.kubernetes.docker.type"
	ContainerTypeContainerdLabel = "io.cri-containerd.kind"
	ContainerTypeCrioAnnotation  = "io.kubernetes.cri-o.ContainerType"
)

These labels are injected by kubelet on container creation, we can use them to gather additional data in a k8s context

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerEnricher

type ContainerEnricher interface {
	Get(ctx context.Context, containerId string) (EnrichResult, error)
	Close() error
}

func ContainerdEnricher

func ContainerdEnricher(socket string) (ContainerEnricher, error)

func CrioEnricher

func CrioEnricher(socket string) (ContainerEnricher, error)

func DockerEnricher

func DockerEnricher(socket string) (ContainerEnricher, error)

type EnrichResult

type EnrichResult struct {
	/* CONTAINER RESULTS */
	ContName    string
	Image       string
	ImageDigest string
	/* POD RESULTS */
	PodName   string
	Namespace string
	UID       string
	Sandbox   bool
}

type RuntimeId

type RuntimeId int

Represents the internal ID of a container runtime

const (
	Unknown RuntimeId = iota
	Docker
	Containerd
	Crio
	Podman
	Garden
)

func FromString

func FromString(str string) RuntimeId

func (RuntimeId) String

func (runtime RuntimeId) String() string

type Service

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

func NewService

func NewService(sockets Sockets) Service

RuntimeInfoService initializes a service which can register enrichers for container runtimes

func (*Service) Close

func (e *Service) Close() error

Close closes the service and all its enrichers

func (*Service) Get

func (e *Service) Get(ctx context.Context, containerId string, containerRuntime RuntimeId) (EnrichResult, error)

Get calls the inner enricher's Get, based on the containerRuntime parameter if a relevant enricher was registered If an unknown runtime is received, enrichment will be attempted through all registered enrichers

func (*Service) Register

func (e *Service) Register(rtime RuntimeId, enricherBuilder func(socket string) (ContainerEnricher, error)) error

Register associates some ContainerEnricher with a runtime, the service can then use it for relevant queries

type Sockets

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

Sockets represent existing container runtime connections

func Autodiscover

func Autodiscover(onRegisterFail func(err error, runtime RuntimeId, socket string)) Sockets

check default paths for all supported container runtimes and aggregate them

func (*Sockets) Register

func (s *Sockets) Register(runtime RuntimeId, socket string) error

Register attempts to associate a file path with a container runtime, if the path doesn't exist registration will fail

func (*Sockets) Socket

func (s *Sockets) Socket(runtime RuntimeId) string

Socket returns the relevant socket for the runtime if one was registered

func (*Sockets) Supports

func (s *Sockets) Supports(runtime RuntimeId) bool

Supports check if the runtime was registered in the Sockets struct

Jump to

Keyboard shortcuts

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