runtime

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DockerRuntime     = "docker"
	ContainerdRuntime = "containerd"
	IgniteRuntime     = "ignite"
)

Variables

View Source
var ContainerRuntimes = map[string]Initializer{}

Functions

func Register added in v0.15.0

func Register(name string, initFn Initializer)

Types

type ContainerRuntime

type ContainerRuntime interface {
	// Initializes the Container runtime struct
	Init(...RuntimeOption) error
	// Adds custom configuration items to the container runtime struct
	WithConfig(*RuntimeConfig)
	// Set the network management details (generated by the config.go)
	WithMgmtNet(*types.MgmtNet)
	// Instructs the runtime not to delete the mgmt network on destroy
	WithKeepMgmtNet()
	// Create container (bridge) network
	CreateNet(context.Context) error
	// Delete container (bridge) network
	DeleteNet(context.Context) error
	// Pull container image if not present
	PullImageIfRequired(context.Context, string) error
	// Create container returns an extra interface that can be used to receive signals
	// about the container life-cycle after it was created, e.g. for post-deploy tasks
	CreateContainer(context.Context, *types.NodeConfig) (interface{}, error)
	// Start pre-created container by its name
	StartContainer(context.Context, string) error
	// Stop running container by its name
	StopContainer(context.Context, string) error
	// List all containers matching labels
	ListContainers(context.Context, []*types.GenericFilter) ([]types.GenericContainer, error)
	// Get a netns path using the pid of a container
	GetNSPath(context.Context, string) (string, error)
	// Executes cmd on container identified with id and returns stdout, stderr bytes and an error
	Exec(context.Context, string, []string) ([]byte, []byte, error)
	// ExecNotWait executes cmd on container identified with id but doesn't wait for output nor attaches stdout/err
	ExecNotWait(context.Context, string, []string) error
	// Delete container by its name
	DeleteContainer(context.Context, string) error
	// Getter for runtime config options
	Config() RuntimeConfig
	GetName() string
}

type Initializer added in v0.15.0

type Initializer func() ContainerRuntime

type RuntimeConfig added in v0.15.0

type RuntimeConfig struct {
	Timeout          time.Duration
	GracefulShutdown bool
	Debug            bool
	KeepMgmtNet      bool
}

type RuntimeOption added in v0.15.0

type RuntimeOption func(ContainerRuntime)

func WithConfig added in v0.15.0

func WithConfig(cfg *RuntimeConfig) RuntimeOption

func WithKeepMgmtNet added in v0.15.0

func WithKeepMgmtNet() RuntimeOption

func WithMgmtNet added in v0.15.0

func WithMgmtNet(mgmt *types.MgmtNet) RuntimeOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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