containerd

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package containerd implements the containerd EngineClient.

Notes

containerd's task states of pausing and paused are both mapped to a paused container from the perspective of the whalewatcher module.

This engine client by default ignores the "moby" and "k8s.io" namespaces.

Index

Constants

View Source
const ComposerProjectLabel = "com.docker.compose.project"

ComposerProjectLabel is the name of an optional container label identifying the composer project a container is part of. We don't import the definition from the moby package in order to not having to rely on that dependency.

View Source
const NerdctlLabelPrefix = "nerdctl/"

NerdctlLabelPrefix is the label key prefix used to namespace (oh no, not another "namespace") nertctl-related labels. On purpose, we don't import nerdctl's definitions in order to avoid even more dependencies.

View Source
const NerdctlNameLabel = NerdctlLabelPrefix + "name"

NerdctlNameLabel stores a container's name, as opposed to the ID.

View Source
const Type = "containerd.io"

Type specifies this container engine's type identifier.

Variables

View Source
var IgnoredNamespaces = []string{
	"moby",
	"k8s.io",
}

IgnoredNamespaces defines the default configuration of containerd namespaces ignored by this engine client. Use the IgnoreNamespace option to set a different set when creating a new engine client.

Functions

This section is empty.

Types

type ContainerdWatcher

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

ContainerdWatcher is a containerd EngineClient for interfacing the generic whale watching with containerd daemons.

func NewContainerdWatcher

func NewContainerdWatcher(client *containerd.Client, opts ...NewOption) *ContainerdWatcher

NewContainerdWatcher returns a new ContainerdWatcher using the specified containerd engine client; normally, you would want to use this lower-level constructor only in unit tests.

func (*ContainerdWatcher) API added in v0.4.0

func (cw *ContainerdWatcher) API() string

API returns the container engine API path.

func (*ContainerdWatcher) Client added in v0.4.3

func (cw *ContainerdWatcher) Client() interface{}

Client returns the underlying engine client (engine-specific).

func (*ContainerdWatcher) Close

func (cw *ContainerdWatcher) Close()

Close cleans up and release any engine client resources, if necessary.

func (*ContainerdWatcher) ID

ID returns the (more or less) unique engine identifier; the exact format is engine-specific.

func (*ContainerdWatcher) Inspect

func (cw *ContainerdWatcher) Inspect(ctx context.Context, nameorid string) (*whalewatcher.Container, error)

Inspect (only) those container details of interest to us, given the name or ID of a container.

func (*ContainerdWatcher) LifecycleEvents

func (cw *ContainerdWatcher) LifecycleEvents(ctx context.Context) (
	<-chan engineclient.ContainerEvent, <-chan error,
)

LifecycleEvents streams container engine events, limited just to those events in the lifecycle of containers getting born (=alive, as opposed to, say, "conceived") and die.

func (*ContainerdWatcher) List

List all the currently alive and kicking containers, but do not list any containers without any processes.

func (*ContainerdWatcher) PID added in v0.4.0

func (cw *ContainerdWatcher) PID() int

PID returns the container engine PID, when known.

func (*ContainerdWatcher) Type added in v0.4.0

func (cw *ContainerdWatcher) Type() string

Type returns the type identifier for this container engine.

func (*ContainerdWatcher) Version added in v0.6.0

func (cw *ContainerdWatcher) Version(ctx context.Context) string

Version information about the engine.

type InspectionDetails added in v0.7.0

type InspectionDetails struct {
	*containers.Container
	*task.Process
}

InspectionDetails combines the container inspection details with its task process details. InspectionDetails gets passed to Rucksack packers where registered in order to pick additional inspection information beyond the generic staple data maintained by the whalewatcher module.

type NewOption added in v0.4.0

type NewOption func(*ContainerdWatcher)

NewOption represents options to NewContainerdWatcher when creating new watchers keeping eyes on containerd engines.

func WithIgnoredNamespaces added in v0.9.0

func WithIgnoredNamespaces(ignores []string) NewOption

func WithPID added in v0.4.0

func WithPID(pid int) NewOption

WithPID sets the engine's PID when known.

func WithRucksackPacker added in v0.7.0

func WithRucksackPacker(packer engineclient.RucksackPacker) NewOption

WithRucksackPacker sets the Rucksack packer that adds application-specific container information based on the inspected container data. The specified Rucksack packer gets passed the inspection data in form of a InspectionDetails.

Directories

Path Synopsis
test
img

Jump to

Keyboard shortcuts

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