Documentation
¶
Overview ¶
Package runtime provides an interface for container runtime environments as well as some builtin implementations such as containerd.
Index ¶
- Constants
- type ContainerdRuntime
- func (c *ContainerdRuntime) Cleanup(ctx context.Context, id string) error
- func (c *ContainerdRuntime) Delete(ctx context.Context, t *tasksv1.Task) error
- func (c *ContainerdRuntime) Get(ctx context.Context, id string) (*tasksv1.Task, error)
- func (c *ContainerdRuntime) ID(ctx context.Context, id string) (string, error)
- func (c *ContainerdRuntime) IO(ctx context.Context, id string) (*TaskIO, error)
- func (c *ContainerdRuntime) Kill(ctx context.Context, t *tasksv1.Task) error
- func (c *ContainerdRuntime) Labels(ctx context.Context, id string) (labels.Label, error)
- func (c *ContainerdRuntime) List(ctx context.Context) ([]*tasksv1.Task, error)
- func (c *ContainerdRuntime) Name(ctx context.Context, id string) (string, error)
- func (c *ContainerdRuntime) Namespace() string
- func (c *ContainerdRuntime) Pull(ctx context.Context, task *tasksv1.Task) error
- func (c *ContainerdRuntime) Run(ctx context.Context, t *tasksv1.Task) error
- func (c *ContainerdRuntime) Stop(ctx context.Context, t *tasksv1.Task) error
- func (c *ContainerdRuntime) Version(ctx context.Context) (string, error)
- type ID
- type NewContainerdRuntimeOption
- type Runtime
- type TaskIO
Constants ¶
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 ¶
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) 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) Namespace ¶
func (c *ContainerdRuntime) Namespace() string
Namespace returns the namespace used for runnning workload. If supported by the runtime
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()
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 WithLogger ¶
func WithLogger(l logger.Logger) NewContainerdRuntimeOption
func WithNamespace ¶
func WithNamespace(ns string) NewContainerdRuntimeOption
type Runtime ¶
type Runtime interface {
List(context.Context) ([]*taskv1.Task, error)
Get(context.Context, string) (*taskv1.Task, error)
Delete(context.Context, *taskv1.Task) error
Kill(context.Context, *taskv1.Task) error
Stop(context.Context, *taskv1.Task) error
Run(context.Context, *taskv1.Task) error
Cleanup(context.Context, string) error
Pull(context.Context, *taskv1.Task) error
Labels(context.Context, string) (labels.Label, error)
IO(context.Context, string) (*TaskIO, error)
Namespace() string
Version(context.Context) (string, error)
ID(context.Context, string) (string, error)
Name(context.Context, string) (string, error)
}
type TaskIO ¶ added in v0.0.11
type TaskIO struct {
Stdout io.ReadCloser
Stderr io.ReadCloser
}