containerd

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: Apache-2.0 Imports: 11 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.

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 DockerNamespace = "moby"

DockerNamespace is the name of the containerd namespace used by Docker for its own containers (and tasks). As the whalewatcher module has a dedicated Docker engine client, we need to skip this namespace -- the rationale is that especially the container name is missing at the containerd engine level, but only available via the docker/moby API.

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

This section is empty.

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 ontainerdWatcher 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.

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 WithPID added in v0.4.0

func WithPID(pid int) NewOption

WithPID sets the engine's PID when known.

Jump to

Keyboard shortcuts

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