runtime

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package runtime provides an interface for container runtime environments as well as some builtin implementations such as containerd.

Index

Constants

View Source
const (
	DefaultNamespace = "voiyd"
	IDMaxLen         = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerdRuntime

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

func NewContainerdRuntimeClient

func NewContainerdRuntimeClient(client *containerd.Client, cni networking.Manager, opts ...NewContainerdRuntimeOption) *ContainerdRuntime

func (*ContainerdRuntime) Cleanup

func (c *ContainerdRuntime) Cleanup(ctx context.Context, id string) error

Cleanup performs any tasks necessary to clean up the environment from danglig configuration. Such as tearing down the network.

func (*ContainerdRuntime) Delete

func (c *ContainerdRuntime) Delete(ctx context.Context, t *tasksv1.Task) error

Delete deletes the container and any tasks associated with it. Tasks will be forcefully stopped if running.

func (*ContainerdRuntime) Get

Get returns the first container from the runtime that matches the provided id

func (*ContainerdRuntime) ID

func (c *ContainerdRuntime) ID(ctx context.Context, id string) (string, error)

func (*ContainerdRuntime) IO

func (c *ContainerdRuntime) IO(ctx context.Context, id string) (*TaskIO, error)

func (*ContainerdRuntime) Kill

Kill forcefully stops the container and tasks within by sending SIGKILL to the process. Like Stop(), Kill() does not perform garbage collection. Use Gleanup() for this.

func (*ContainerdRuntime) Labels

func (c *ContainerdRuntime) Labels(ctx context.Context, id string) (labels.Label, error)

func (*ContainerdRuntime) List

func (c *ContainerdRuntime) List(ctx context.Context) ([]*tasksv1.Task, error)

func (*ContainerdRuntime) Name

func (c *ContainerdRuntime) Name(ctx context.Context, id string) (string, error)

func (*ContainerdRuntime) Namespace

func (c *ContainerdRuntime) Namespace() string

Namespace returns the namespace used for runnning workload. If supported by the runtime

func (*ContainerdRuntime) Pull

func (c *ContainerdRuntime) Pull(ctx context.Context, task *tasksv1.Task) error

func (*ContainerdRuntime) Run

func (*ContainerdRuntime) Stop

Stop stops containers associated with the name of provided container instance. Stop will attempt to gracefully stop tasks, but will eventually do it forcefully if timeout is reached. Stop does not perform any garbage colletion and it is up to the caller to call Cleanup() after calling Stop()

func (*ContainerdRuntime) Version

func (c *ContainerdRuntime) Version(ctx context.Context) (string, error)

Version returns the version of the runtime. Should be printent in the form "runtime_name/version"

type ID

type ID string

func GenerateID

func GenerateID() ID

func (ID) String

func (id ID) String() string

type NewContainerdRuntimeOption

type NewContainerdRuntimeOption func(c *ContainerdRuntime)

func WithLogDirFmt

func WithLogDirFmt(rootPath string) NewContainerdRuntimeOption

WithLogDirFmt allows for setting the root directory for container log files (stdout). For example /var/lib/voiyd/containers/%s/log which happens to be the default location.

func WithNamespace

func WithNamespace(ns string) NewContainerdRuntimeOption

type TaskIO added in v0.0.11

type TaskIO struct {
	Stdout io.ReadCloser
	Stderr io.ReadCloser
}

Jump to

Keyboard shortcuts

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