Package containerd

import "github.com/chaos-mesh/chaos-mesh/pkg/chaosdaemon/crclients/containerd"

Overview ▾


WithDefaultNamespace is an alias for the function in containerd with the same name

var WithDefaultNamespace = containerd.WithDefaultNamespace

type ContainerdClient

ContainerdClient can get information from containerd

type ContainerdClient struct {
    // contains filtered or unexported fields

func New

func New(address string, opts ...containerd.ClientOpt) (*ContainerdClient, error)

func (ContainerdClient) ContainerKillByContainerID

func (c ContainerdClient) ContainerKillByContainerID(ctx context.Context, containerID string) error

ContainerKillByContainerID kills container according to container id

func (ContainerdClient) FormatContainerID

func (c ContainerdClient) FormatContainerID(ctx context.Context, containerID string) (string, error)

FormatContainerID strips protocol prefix from the container ID

func (ContainerdClient) GetLabelsFromContainerID

func (c ContainerdClient) GetLabelsFromContainerID(ctx context.Context, containerID string) (map[string]string, error)

GetLabelsFromContainerID returns the labels according to container ID

func (ContainerdClient) GetPidFromContainerID

func (c ContainerdClient) GetPidFromContainerID(ctx context.Context, containerID string) (uint32, error)

GetPidFromContainerID fetches PID according to container id

func (ContainerdClient) ListContainerIDs

func (c ContainerdClient) ListContainerIDs(ctx context.Context) ([]string, error)

ListContainerIDs lists all container IDs

type ContainerdClientInterface

ContainerdClientInterface represents the ContainerClient, it's used to simply unit test

type ContainerdClientInterface interface {
    LoadContainer(ctx context.Context, id string) (containerd.Container, error)
    Containers(ctx context.Context, filters ...string) ([]containerd.Container, error)