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
- type ContainerdWatcher
- func (cw *ContainerdWatcher) API() string
- func (cw *ContainerdWatcher) Client() interface{}
- func (cw *ContainerdWatcher) Close()
- func (cw *ContainerdWatcher) ID(ctx context.Context) string
- func (cw *ContainerdWatcher) Inspect(ctx context.Context, nameorid string) (*whalewatcher.Container, error)
- func (cw *ContainerdWatcher) LifecycleEvents(ctx context.Context) (<-chan engineclient.ContainerEvent, <-chan error)
- func (cw *ContainerdWatcher) List(ctx context.Context) ([]*whalewatcher.Container, error)
- func (cw *ContainerdWatcher) PID() int
- func (cw *ContainerdWatcher) Type() string
- type NewOption
Constants ¶
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.
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.
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.
const NerdctlNameLabel = NerdctlLabelPrefix + "name"
NerdctlNameLabel stores a container's name, as opposed to the ID.
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 ¶
func (cw *ContainerdWatcher) ID(ctx context.Context) string
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 ¶
func (cw *ContainerdWatcher) List(ctx context.Context) ([]*whalewatcher.Container, error)
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.