Documentation
¶
Index ¶
- Constants
- Variables
- func MountSnapshot(ctx context.Context, service Service, snapshotter, key string) (string, func() error, error)
- func RemoveNetwork(ctx context.Context, task client.Task, containerID string) error
- func ResolveConfSource(dataDir string) (string, error)
- func SetupNetwork(ctx context.Context, task client.Task, containerID string) error
- type ClientFactory
- type CreateContainerRequest
- type DefaultClientFactory
- type DefaultService
- func (s *DefaultService) CommitSnapshot(ctx context.Context, snapshotter, name, key string) error
- func (s *DefaultService) CreateContainer(ctx context.Context, req CreateContainerRequest) (containerd.Container, error)
- func (s *DefaultService) CreateContainerFromSnapshot(ctx context.Context, req CreateContainerRequest) (containerd.Container, error)
- func (s *DefaultService) DeleteContainer(ctx context.Context, id string, opts *DeleteContainerOptions) error
- func (s *DefaultService) DeleteImage(ctx context.Context, ref string, opts *DeleteImageOptions) error
- func (s *DefaultService) DeleteTask(ctx context.Context, containerID string, opts *DeleteTaskOptions) error
- func (s *DefaultService) ExecTask(ctx context.Context, containerID string, req ExecTaskRequest) (ExecTaskResult, error)
- func (s *DefaultService) ExecTaskStreaming(ctx context.Context, containerID string, req ExecTaskRequest) (*ExecTaskSession, error)
- func (s *DefaultService) GetContainer(ctx context.Context, id string) (containerd.Container, error)
- func (s *DefaultService) GetImage(ctx context.Context, ref string) (containerd.Image, error)
- func (s *DefaultService) GetTask(ctx context.Context, containerID string) (containerd.Task, error)
- func (s *DefaultService) ListContainers(ctx context.Context) ([]containerd.Container, error)
- func (s *DefaultService) ListContainersByLabel(ctx context.Context, key, value string) ([]containerd.Container, error)
- func (s *DefaultService) ListImages(ctx context.Context) ([]containerd.Image, error)
- func (s *DefaultService) ListSnapshots(ctx context.Context, snapshotter string) ([]snapshots.Info, error)
- func (s *DefaultService) ListTasks(ctx context.Context, opts *ListTasksOptions) ([]TaskInfo, error)
- func (s *DefaultService) PrepareSnapshot(ctx context.Context, snapshotter, key, parent string) error
- func (s *DefaultService) PullImage(ctx context.Context, ref string, opts *PullImageOptions) (containerd.Image, error)
- func (s *DefaultService) RemoveSnapshot(ctx context.Context, snapshotter, key string) error
- func (s *DefaultService) SnapshotMounts(ctx context.Context, snapshotter, key string) ([]mount.Mount, error)
- func (s *DefaultService) StartTask(ctx context.Context, containerID string, opts *StartTaskOptions) (containerd.Task, error)
- func (s *DefaultService) StopTask(ctx context.Context, containerID string, opts *StopTaskOptions) error
- type DeleteContainerOptions
- type DeleteImageOptions
- type DeleteTaskOptions
- type ExecTaskRequest
- type ExecTaskResult
- type ExecTaskSession
- type ListTasksOptions
- type MountedSnapshot
- type PullImageOptions
- type Service
- type SnapshotCommitResult
- type StartTaskOptions
- type StopTaskOptions
- type TaskInfo
Constants ¶
View Source
const ( DefaultSocketPath = "/run/containerd/containerd.sock" DefaultNamespace = "default" )
Variables ¶
View Source
var ( ErrInvalidArgument = errors.New("invalid argument") ErrTaskStopTimeout = errors.New("timeout waiting for task to stop") )
Functions ¶
func MountSnapshot ¶
func MountSnapshot(ctx context.Context, service Service, snapshotter, key string) (string, func() error, error)
MountSnapshot mounts a snapshot by snapshotter/key without a container.
func RemoveNetwork ¶
RemoveNetwork detaches CNI networking for a running task.
func ResolveConfSource ¶
ResolveConfSource returns a host path to mount as /etc/resolv.conf. If systemd-resolved config is available, use it. Otherwise write a fallback resolv.conf under dataDir and return that path.
Types ¶
type ClientFactory ¶
type ClientFactory interface {
New(ctx context.Context) (*containerd.Client, error)
}
type CreateContainerRequest ¶
type DefaultClientFactory ¶
type DefaultClientFactory struct {
SocketPath string
}
func (DefaultClientFactory) New ¶
func (f DefaultClientFactory) New(_ context.Context) (*containerd.Client, error)
type DefaultService ¶
type DefaultService struct {
// contains filtered or unexported fields
}
func NewDefaultService ¶
func NewDefaultService(log *slog.Logger, client *containerd.Client, cfg config.Config) *DefaultService
func (*DefaultService) CommitSnapshot ¶
func (s *DefaultService) CommitSnapshot(ctx context.Context, snapshotter, name, key string) error
func (*DefaultService) CreateContainer ¶
func (s *DefaultService) CreateContainer(ctx context.Context, req CreateContainerRequest) (containerd.Container, error)
func (*DefaultService) CreateContainerFromSnapshot ¶
func (s *DefaultService) CreateContainerFromSnapshot(ctx context.Context, req CreateContainerRequest) (containerd.Container, error)
func (*DefaultService) DeleteContainer ¶
func (s *DefaultService) DeleteContainer(ctx context.Context, id string, opts *DeleteContainerOptions) error
func (*DefaultService) DeleteImage ¶
func (s *DefaultService) DeleteImage(ctx context.Context, ref string, opts *DeleteImageOptions) error
func (*DefaultService) DeleteTask ¶
func (s *DefaultService) DeleteTask(ctx context.Context, containerID string, opts *DeleteTaskOptions) error
func (*DefaultService) ExecTask ¶
func (s *DefaultService) ExecTask(ctx context.Context, containerID string, req ExecTaskRequest) (ExecTaskResult, error)
func (*DefaultService) ExecTaskStreaming ¶
func (s *DefaultService) ExecTaskStreaming(ctx context.Context, containerID string, req ExecTaskRequest) (*ExecTaskSession, error)
func (*DefaultService) GetContainer ¶
func (s *DefaultService) GetContainer(ctx context.Context, id string) (containerd.Container, error)
func (*DefaultService) GetImage ¶
func (s *DefaultService) GetImage(ctx context.Context, ref string) (containerd.Image, error)
func (*DefaultService) GetTask ¶
func (s *DefaultService) GetTask(ctx context.Context, containerID string) (containerd.Task, error)
func (*DefaultService) ListContainers ¶
func (s *DefaultService) ListContainers(ctx context.Context) ([]containerd.Container, error)
func (*DefaultService) ListContainersByLabel ¶
func (s *DefaultService) ListContainersByLabel(ctx context.Context, key, value string) ([]containerd.Container, error)
func (*DefaultService) ListImages ¶
func (s *DefaultService) ListImages(ctx context.Context) ([]containerd.Image, error)
func (*DefaultService) ListSnapshots ¶
func (*DefaultService) ListTasks ¶
func (s *DefaultService) ListTasks(ctx context.Context, opts *ListTasksOptions) ([]TaskInfo, error)
func (*DefaultService) PrepareSnapshot ¶
func (s *DefaultService) PrepareSnapshot(ctx context.Context, snapshotter, key, parent string) error
func (*DefaultService) PullImage ¶
func (s *DefaultService) PullImage(ctx context.Context, ref string, opts *PullImageOptions) (containerd.Image, error)
func (*DefaultService) RemoveSnapshot ¶
func (s *DefaultService) RemoveSnapshot(ctx context.Context, snapshotter, key string) error
func (*DefaultService) SnapshotMounts ¶
func (*DefaultService) StartTask ¶
func (s *DefaultService) StartTask(ctx context.Context, containerID string, opts *StartTaskOptions) (containerd.Task, error)
func (*DefaultService) StopTask ¶
func (s *DefaultService) StopTask(ctx context.Context, containerID string, opts *StopTaskOptions) error
type DeleteContainerOptions ¶
type DeleteContainerOptions struct {
CleanupSnapshot bool
}
type DeleteImageOptions ¶
type DeleteImageOptions struct {
Synchronous bool
}
type DeleteTaskOptions ¶
type DeleteTaskOptions struct {
Force bool
}
type ExecTaskRequest ¶
type ExecTaskResult ¶
type ExecTaskResult struct {
ExitCode uint32
}
type ExecTaskSession ¶
type ExecTaskSession struct {
Stdin io.WriteCloser
Stdout io.ReadCloser
Stderr io.ReadCloser
Wait func() (ExecTaskResult, error)
Close func() error
}
type ListTasksOptions ¶
type ListTasksOptions struct {
Filter string
}
type MountedSnapshot ¶
type MountedSnapshot struct {
Dir string
Info containers.Container
Unmount func() error
}
func MountContainerSnapshot ¶
func MountContainerSnapshot(ctx context.Context, service Service, containerID string) (*MountedSnapshot, error)
MountContainerSnapshot mounts the active snapshot for a container.
type PullImageOptions ¶
type Service ¶
type Service interface {
PullImage(ctx context.Context, ref string, opts *PullImageOptions) (containerd.Image, error)
GetImage(ctx context.Context, ref string) (containerd.Image, error)
ListImages(ctx context.Context) ([]containerd.Image, error)
DeleteImage(ctx context.Context, ref string, opts *DeleteImageOptions) error
CreateContainer(ctx context.Context, req CreateContainerRequest) (containerd.Container, error)
GetContainer(ctx context.Context, id string) (containerd.Container, error)
ListContainers(ctx context.Context) ([]containerd.Container, error)
DeleteContainer(ctx context.Context, id string, opts *DeleteContainerOptions) error
StartTask(ctx context.Context, containerID string, opts *StartTaskOptions) (containerd.Task, error)
GetTask(ctx context.Context, containerID string) (containerd.Task, error)
ListTasks(ctx context.Context, opts *ListTasksOptions) ([]TaskInfo, error)
StopTask(ctx context.Context, containerID string, opts *StopTaskOptions) error
DeleteTask(ctx context.Context, containerID string, opts *DeleteTaskOptions) error
ExecTask(ctx context.Context, containerID string, req ExecTaskRequest) (ExecTaskResult, error)
ExecTaskStreaming(ctx context.Context, containerID string, req ExecTaskRequest) (*ExecTaskSession, error)
ListContainersByLabel(ctx context.Context, key, value string) ([]containerd.Container, error)
CommitSnapshot(ctx context.Context, snapshotter, name, key string) error
ListSnapshots(ctx context.Context, snapshotter string) ([]snapshots.Info, error)
RemoveSnapshot(ctx context.Context, snapshotter, key string) error
PrepareSnapshot(ctx context.Context, snapshotter, key, parent string) error
CreateContainerFromSnapshot(ctx context.Context, req CreateContainerRequest) (containerd.Container, error)
SnapshotMounts(ctx context.Context, snapshotter, key string) ([]mount.Mount, error)
}
type SnapshotCommitResult ¶
type StartTaskOptions ¶
type StopTaskOptions ¶
Click to show internal directories.
Click to hide internal directories.