driver

package
v0.0.0-...-033c845 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultTag defines the default tag used when performing images related actions and no tag or digest is specified
	DefaultTag = "latest"
	// DefaultHostname is the default built-in hostname
	DefaultHostname = "docker.io"
	// DefaultRepoPrefix is the prefix used for default repositories in default host
	DefaultRepoPrefix = "library/"
)

much of this code is copied from docker/docker/reference.go

View Source
const ContainerNamePrefix = "bb-ctr"

ContainerNamePrefix represents containers name prefix

Variables

This section is empty.

Functions

This section is empty.

Types

type CRIContainer

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

CRIContainer is an implementation of the container metadata needed for CRI implementation

func (*CRIContainer) Command

func (ctr *CRIContainer) Command() string

Command returns an optional command that overrides the default image "CMD" or "ENTRYPOINT" for the Docker and Containerd (gRPC) drivers

func (*CRIContainer) Detached

func (ctr *CRIContainer) Detached() bool

Detached returns whether the container is to be started in detached state

func (*CRIContainer) GetPodID

func (ctr *CRIContainer) GetPodID() string

GetPodID return pod-id associated with container.

func (*CRIContainer) Image

func (ctr *CRIContainer) Image() string

Image returns either a bundle path (used by runc, containerd) or image name (used by Docker) that will be used by the container runtime to know what image to run/execute

func (*CRIContainer) Name

func (ctr *CRIContainer) Name() string

Name returns the name of the container

func (*CRIContainer) Trace

func (ctr *CRIContainer) Trace() bool

Trace returns whether the container should be traced (using any tracing supported by the container runtime)

type CRIDriver

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

CRIDriver is an implementation of the driver interface for using k8s Container Runtime Interface. This uses the provided client library which abstracts using the gRPC APIs directly.

func (CRIDriver) Clean

func (c CRIDriver) Clean(ctx context.Context) error

Clean will clean the operating environment of a specific driver

func (*CRIDriver) Close

func (c *CRIDriver) Close() error

Close allows the driver to free any resources/close any connections

func (*CRIDriver) Create

func (c *CRIDriver) Create(ctx context.Context, name, image, cmdOverride string, _ bool, trace bool) (Container, error)

Create will create a container instance matching the specific needs of a driver

func (*CRIDriver) Info

func (c *CRIDriver) Info(ctx context.Context) (string, error)

Info returns a string with information about the container engine/runtime details

func (*CRIDriver) PID

func (c *CRIDriver) PID() (int, error)

PID returns daemon process id

func (*CRIDriver) Path

func (c *CRIDriver) Path() string

Path returns the binary (or socket) path related to the runtime in use

func (*CRIDriver) Pause

Pause will pause a container not supported in CRI API

func (*CRIDriver) ProcNames

func (c *CRIDriver) ProcNames() []string

ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark

func (*CRIDriver) Remove

func (c *CRIDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)

Remove will remove a container

func (*CRIDriver) Run

func (c *CRIDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)

Run will execute a container using the driver

func (*CRIDriver) Stats

func (c *CRIDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)

Stats returns stats data from daemon for container

func (*CRIDriver) Stop

func (c *CRIDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)

Stop will stop/kill a container

func (*CRIDriver) Type

func (c *CRIDriver) Type() Type

Type returns a driver type to identify the driver

func (*CRIDriver) Unpause

func (c *CRIDriver) Unpause(_ context.Context, _ Container) (string, time.Duration, error)

Unpause will unpause/resume a container not supported in CRI API

func (*CRIDriver) Wait

Wait blocks thread until container stop

type CRunContainer

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

CRunContainer is an implementation of the container metadata needed for crun

func (*CRunContainer) Command

func (c *CRunContainer) Command() string

Command is not implemented for the crun driver type as the command is embedded in the config.json of the rootfs

func (*CRunContainer) Detached

func (c *CRunContainer) Detached() bool

Detached returns whether the container should be started in detached mode

func (*CRunContainer) GetPodID

func (c *CRunContainer) GetPodID() string

GetPodID return pod-id associated with container. only used by CRI-based drivers

func (*CRunContainer) Image

func (c *CRunContainer) Image() string

Image returns the bundle path that crun will use

func (*CRunContainer) Name

func (c *CRunContainer) Name() string

Name returns the name of the container

func (*CRunContainer) Pid

func (c *CRunContainer) Pid() string

Pid returns the process ID in cases where this container instance is wrapping a potentially running container

func (*CRunContainer) State

func (c *CRunContainer) State() string

State returns the queried state of the container (if available)

func (*CRunContainer) Trace

func (c *CRunContainer) Trace() bool

Trace returns whether the container should be started with tracing enabled

type CRunDriver

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

CRunDriver is an implementation of the driver interface for CRun. IMPORTANT: This implementation does not protect instance metadata for thread safely. At this time there is no understood use case for multi-threaded use of this implementation.

func (*CRunDriver) Clean

func (r *CRunDriver) Clean(ctx context.Context) error

Clean will clean the environment; removing any remaining containers in the crun metadata

func (*CRunDriver) Close

func (r *CRunDriver) Close() error

Close allows the driver to handle any resource free/connection closing as necessary. CRun has no need to perform any actions on close.

func (*CRunDriver) Create

func (r *CRunDriver) Create(_ context.Context, name, image, _ string, detached bool, _ bool) (Container, error)

Create will create a container instance matching the specific needs of a driver

func (*CRunDriver) Info

func (r *CRunDriver) Info(ctx context.Context) (string, error)

Info returns

func (*CRunDriver) PID

func (r *CRunDriver) PID() (int, error)

PID returns daemon process id

func (*CRunDriver) Path

func (r *CRunDriver) Path() string

Path returns the binary path of the crun binary in use

func (*CRunDriver) Pause

func (r *CRunDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)

Pause will pause a container

func (*CRunDriver) ProcNames

func (r *CRunDriver) ProcNames() []string

ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark

func (*CRunDriver) Remove

func (r *CRunDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)

Remove will remove a container

func (*CRunDriver) Run

Run will execute a container using the driver. Note that if the container is specified to run detached, but the config.json for the bundle specifies a "tty" allocation, this crun invocation will fail due to the fact we cannot detach without providing a "--console" device to crun. Detached daemon/server bundles should not need a tty; stdin/out/err of the container will be ignored given this is for benchmarking not validating container operation.

func (*CRunDriver) Stats

Stats returns stats data from daemon for container

func (*CRunDriver) Stop

func (r *CRunDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)

Stop will stop/kill a container

func (*CRunDriver) Type

func (r *CRunDriver) Type() Type

Type returns a driver.Type to indentify the driver implementation

func (*CRunDriver) Unpause

func (r *CRunDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)

Unpause will unpause/resume a container

func (*CRunDriver) Wait

Wait will block until container stop

type Config

type Config struct {
	DriverType    Type
	Path          string
	LogDriver     string
	LogOpts       map[string]string
	StreamStats   bool
	StatsInterval time.Duration
}

Config represents various configuration flags for driver

type Container

type Container interface {
	// Name returns the name of the container
	Name() string

	// Detached returns whether the container is to be started in detached state
	Detached() bool

	// Trace returns whether the container should be traced (using any tracing supported
	// by the container runtime)
	Trace() bool

	// Image returns either a bundle path (used by runc, containerd) or image name (used by Docker)
	// that will be used by the container runtime to know what image to run/execute
	Image() string

	// Command returns an optional command that overrides the default image
	// "CMD" or "ENTRYPOINT" for the Docker and Containerd (gRPC) drivers
	Command() string

	//GetPodID returns podid associated with the container
	//only used by CRI-based drivers
	GetPodID() string
}

Container represents a generic container instance on any container engine

type ContainerdContainer

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

ContainerdContainer is an implementation of the container metadata needed for containerd

func (*ContainerdContainer) Command

func (c *ContainerdContainer) Command() string

Command returns the override command that will be executed instead of the default image-specified command

func (*ContainerdContainer) Detached

func (c *ContainerdContainer) Detached() bool

Detached always returns true for containerd as IO streams are always detached

func (*ContainerdContainer) GetPodID

func (c *ContainerdContainer) GetPodID() string

GetPodID return pod-id associated with container. only used by CRI-based drivers

func (*ContainerdContainer) Image

func (c *ContainerdContainer) Image() string

Image returns the bundle path that runc will use

func (*ContainerdContainer) Name

func (c *ContainerdContainer) Name() string

Name returns the name of the container

func (*ContainerdContainer) Process

func (c *ContainerdContainer) Process() string

Process returns the process name in cases where this container instance is wrapping a potentially running container

func (*ContainerdContainer) State

func (c *ContainerdContainer) State() string

State returns the queried state of the container (if available)

func (*ContainerdContainer) Trace

func (c *ContainerdContainer) Trace() bool

Trace returns whether the container should be started with tracing enabled

type ContainerdDriver

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

ContainerdDriver is an implementation of the driver interface for using Containerd. This uses the provided client library which abstracts using the gRPC APIs directly. IMPORTANT: This implementation does not protect instance metadata for thread safely. At this time there is no understood use case for multi-threaded use of this implementation.

func NewContainerdDriver

func NewContainerdDriver(config *Config) (*ContainerdDriver, error)

NewContainerdDriver creates an instance of the containerd driver, providing a path to the ctr client

func (*ContainerdDriver) Clean

func (r *ContainerdDriver) Clean(ctx context.Context) error

Clean will clean the environment; removing any remaining containers in the runc metadata

func (*ContainerdDriver) Close

func (r *ContainerdDriver) Close() error

Close allows the driver to handle any resource free/connection closing as necessary.

func (*ContainerdDriver) Create

func (r *ContainerdDriver) Create(ctx context.Context, name, image, cmdOverride string, _ bool, trace bool) (Container, error)

Create will create a container instance matching the specific needs of a driver

func (*ContainerdDriver) Info

func (r *ContainerdDriver) Info(ctx context.Context) (string, error)

Info returns

func (*ContainerdDriver) PID

func (r *ContainerdDriver) PID() (int, error)

PID returns containerd process id

func (*ContainerdDriver) Path

func (r *ContainerdDriver) Path() string

Path returns the address (socket path) of the gRPC containerd API endpoint

func (*ContainerdDriver) Pause

Pause will pause a container

func (*ContainerdDriver) ProcNames

func (r *ContainerdDriver) ProcNames() []string

ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark

func (*ContainerdDriver) Remove

Remove will remove a container; in the containerd case we simply call kill which will remove any container metadata if it was running

func (*ContainerdDriver) Run

Run will execute a container using the containerd driver.

func (*ContainerdDriver) Stats

Stats returns stats data from daemon for container

func (*ContainerdDriver) Stop

Stop will stop/kill a container (specifically, the tasks [processes] running in the container)

func (*ContainerdDriver) Type

func (r *ContainerdDriver) Type() Type

Type returns a driver.Type to indentify the driver implementation

func (*ContainerdDriver) Unpause

Unpause will unpause/resume a container

func (*ContainerdDriver) Wait

Wait blocks thread until container stop

type CtrContainer

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

CtrContainer is an implementation of the container metadata needed for containerd

func (*CtrContainer) Command

func (c *CtrContainer) Command() string

Command is not implemented for the legacy `ctr` driver type as the command is embedded in the config.json of the rootfs

func (*CtrContainer) Detached

func (c *CtrContainer) Detached() bool

Detached always returns true for containerd as IO streams are always detached

func (*CtrContainer) GetPodID

func (c *CtrContainer) GetPodID() string

GetPodID return pod-id associated with container. only used by CRI-based drivers

func (*CtrContainer) Image

func (c *CtrContainer) Image() string

Image returns the bundle path that runc will use

func (*CtrContainer) Name

func (c *CtrContainer) Name() string

Name returns the name of the container

func (*CtrContainer) Process

func (c *CtrContainer) Process() string

Process returns the process name in cases where this container instance is wrapping a potentially running container

func (*CtrContainer) State

func (c *CtrContainer) State() string

State returns the queried state of the container (if available)

func (*CtrContainer) Trace

func (c *CtrContainer) Trace() bool

Trace returns whether the container should be started with tracing enabled

type CtrDriver

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

CtrDriver is an implementation of the driver interface for using Containerd in "legacy" mode via the `ctr` client binary (meant for testing purposes only). IMPORTANT: This implementation does not protect instance metadata for thread safely. At this time there is no understood use case for multi-threaded use of this implementation.

func (*CtrDriver) Clean

func (r *CtrDriver) Clean(ctx context.Context) error

Clean will clean the environment; removing any remaining containers in the runc metadata

func (*CtrDriver) Close

func (r *CtrDriver) Close() error

Close allows the driver to handle any resource free/connection closing as necessary. Ctr has no need to perform any actions on close.

func (*CtrDriver) Create

func (r *CtrDriver) Create(_ context.Context, name, image, _ string, _ bool, trace bool) (Container, error)

Create will create a container instance matching the specific needs of a driver

func (*CtrDriver) Info

func (r *CtrDriver) Info(ctx context.Context) (string, error)

Info returns

func (*CtrDriver) PID

func (r *CtrDriver) PID() (int, error)

PID returns containerd process id

func (*CtrDriver) Path

func (r *CtrDriver) Path() string

Path returns the binary path of the ctr binary in use

func (*CtrDriver) Pause

func (r *CtrDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)

Pause will pause a container

func (*CtrDriver) ProcNames

func (r *CtrDriver) ProcNames() []string

ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark

func (*CtrDriver) Remove

func (r *CtrDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)

Remove will remove a container; in the containerd case we simply call kill which will remove any container metadata if it was running

func (*CtrDriver) Run

func (r *CtrDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)

Run will execute a container using the containerd driver.

func (*CtrDriver) Stats

func (r *CtrDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)

Stats returns stats data from daemon for container

func (*CtrDriver) Stop

func (r *CtrDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)

Stop will stop/kill a container

func (*CtrDriver) Type

func (r *CtrDriver) Type() Type

Type returns a driver.Type to indentify the driver implementation

func (*CtrDriver) Unpause

func (r *CtrDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)

Unpause will unpause/resume a container

func (*CtrDriver) Wait

Wait blocks thread until container stop

type DockerCLIDriver

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

DockerCLIDriver is an implementation of the driver interface for the Docker engine. IMPORTANT: This implementation does not protect instance metadata for thread safely. At this time there is no understood use case for multi-threaded use of this implementation.

func (*DockerCLIDriver) Clean

func (d *DockerCLIDriver) Clean(ctx context.Context) error

Clean will clean the environment; removing any exited containers

func (*DockerCLIDriver) Close

func (d *DockerCLIDriver) Close() error

Close allows the driver to handle any resource free/connection closing as necessary. Docker CLI has no need to perform any actions on close.

func (*DockerCLIDriver) Create

func (d *DockerCLIDriver) Create(_ context.Context, name, image, cmdOverride string, detached bool, trace bool) (Container, error)

Create will create a container instance matching the specific needs of a driver

func (*DockerCLIDriver) Info

func (d *DockerCLIDriver) Info(ctx context.Context) (string, error)

Info returns

func (*DockerCLIDriver) PID

func (d *DockerCLIDriver) PID() (int, error)

PID returns a process ID of Docker daemon

func (*DockerCLIDriver) Path

func (d *DockerCLIDriver) Path() string

Path returns the binary path of the docker binary in use

func (*DockerCLIDriver) Pause

Pause will pause a container

func (*DockerCLIDriver) ProcNames

func (d *DockerCLIDriver) ProcNames() []string

ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark

func (*DockerCLIDriver) Remove

Remove will remove a container

func (*DockerCLIDriver) Run

Run will execute a container using the driver

func (*DockerCLIDriver) Stats

func (d *DockerCLIDriver) Stats(ctx context.Context, ctr Container) (io.ReadCloser, error)

Stats returns stats data from daemon for container

func (*DockerCLIDriver) Stop

Stop will stop a container

func (*DockerCLIDriver) Type

func (d *DockerCLIDriver) Type() Type

Type returns a driver.Type to indentify the driver implementation

func (*DockerCLIDriver) Unpause

func (d *DockerCLIDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)

Unpause will unpause/resume a container

func (*DockerCLIDriver) Wait

Wait will block until container stop

type DockerContainer

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

DockerContainer is an implementation of the container metadata needed for docker

func (*DockerContainer) Command

func (c *DockerContainer) Command() string

Command returns the optional overriding command that Docker will use when executing a container based on this container's image

func (*DockerContainer) Detached

func (c *DockerContainer) Detached() bool

Detached returns whether the container should be started in detached mode

func (*DockerContainer) GetPodID

func (c *DockerContainer) GetPodID() string

GetPodID return pod-id associated with container. only used by CRI-based drivers

func (*DockerContainer) Image

func (c *DockerContainer) Image() string

Image returns the image name that Docker will use

func (*DockerContainer) Name

func (c *DockerContainer) Name() string

Name returns the name of the container

func (*DockerContainer) Trace

func (c *DockerContainer) Trace() bool

Trace returns whether the container should be started with tracing enabled

type DockerDriver

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

DockerDriver is an implementation of the driver interface for the Docker engine using API

func NewDockerDriver

func NewDockerDriver(ctx context.Context, config *Config) (*DockerDriver, error)

NewDockerDriver creates an instance of Docker API driver.

func (*DockerDriver) Clean

func (d *DockerDriver) Clean(ctx context.Context) error

Clean removes used Docker containers

func (*DockerDriver) Close

func (d *DockerDriver) Close() error

Close closes the transport used by Docker client

func (*DockerDriver) Create

func (d *DockerDriver) Create(ctx context.Context, name, image, cmdOverride string, detached bool, trace bool) (Container, error)

Create will pull and create a container instance matching the specific needs of a driver

func (*DockerDriver) Info

func (d *DockerDriver) Info(ctx context.Context) (string, error)

Info returns a short description about the docker server

func (*DockerDriver) PID

func (d *DockerDriver) PID() (int, error)

PID returns a process ID of Docker daemon

func (*DockerDriver) Path

func (d *DockerDriver) Path() string

Path returns the binary (or socket) path related to the runtime in use

func (*DockerDriver) Pause

func (d *DockerDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)

Pause pauses a container

func (*DockerDriver) ProcNames

func (d *DockerDriver) ProcNames() []string

ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark

func (*DockerDriver) Remove

func (d *DockerDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)

Remove kills and removes a container

func (*DockerDriver) Run

Run creates a new Docker container and sends a request to the daemon to start it

func (*DockerDriver) Stats

func (d *DockerDriver) Stats(ctx context.Context, ctr Container) (io.ReadCloser, error)

Stats returns stats data from daemon for container

func (*DockerDriver) Stop

Stop stops a container

func (*DockerDriver) Type

func (d *DockerDriver) Type() Type

Type returns a driver.Type to indentify the driver implementation

func (*DockerDriver) Unpause

func (d *DockerDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)

Unpause unpauses a container

func (*DockerDriver) Wait

Wait will block until container stop

type Driver

type Driver interface {

	// Type returns a driver type to identify the driver
	Type() Type

	// Info returns a string with information about the container engine/runtime details
	Info(ctx context.Context) (string, error)

	// Path returns the binary (or socket) path related to the runtime in use
	Path() string

	// Create will create a container instance matching the specific needs
	// of a driver
	Create(ctx context.Context, name, image, cmdOverride string, detached bool, trace bool) (Container, error)

	// Clean will clean the operating environment of a specific driver
	Clean(ctx context.Context) error

	// Run will execute a container using the driver
	Run(ctx context.Context, ctr Container) (string, time.Duration, error)

	// Stop will stop/kill a container
	Stop(ctx context.Context, ctr Container) (string, time.Duration, error)

	// Remove will remove a container
	Remove(ctx context.Context, ctr Container) (string, time.Duration, error)

	// Pause will pause a container
	Pause(ctx context.Context, ctr Container) (string, time.Duration, error)

	// Unpause will unpause/resume a container
	Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)

	// Wait blocks thread until container stop
	Wait(ctx context.Context, ctr Container) (string, time.Duration, error)

	// Close allows the driver to free any resources/close any
	// connections
	Close() error

	// PID returns daemon process id
	PID() (int, error)

	// ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark
	ProcNames() []string

	// Stats returns a reader with streaming data output
	Stats(ctx context.Context, ctr Container) (io.ReadCloser, error)
}

Driver is an interface for various container engines. The integer returned from container operations is the milliseconds elapsed for any command

func New

func New(ctx context.Context, config *Config) (Driver, error)

New creates a driver instance of a specific type

func NewCRIDriver

func NewCRIDriver(path string) (Driver, error)

NewCRIDriver creates an instance of the CRI driver

func NewCRunDriver

func NewCRunDriver(binaryPath string) (Driver, error)

NewCRunDriver creates an instance of the crun driver, providing a path to crun

func NewCtrDriver

func NewCtrDriver(binaryPath string) (Driver, error)

NewCtrDriver creates an instance of the containerd driver, providing a path to the ctr client

func NewDockerCLIDriver

func NewDockerCLIDriver(ctx context.Context, config *Config) (Driver, error)

NewDockerCLIDriver creates an instance of the docker driver, providing a path to the docker client binary

func NewRuncDriver

func NewRuncDriver(binaryPath string) (Driver, error)

NewRuncDriver creates an instance of the runc driver, providing a path to runc

func NewYoukiDriver

func NewYoukiDriver(binaryPath string) (Driver, error)

NewYoukiDriver creates an instance of the youki driver, providing a path to youki

type RuncContainer

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

RuncContainer is an implementation of the container metadata needed for runc

func (*RuncContainer) Command

func (c *RuncContainer) Command() string

Command is not implemented for the runc driver type as the command is embedded in the config.json of the rootfs

func (*RuncContainer) Detached

func (c *RuncContainer) Detached() bool

Detached returns whether the container should be started in detached mode

func (*RuncContainer) GetPodID

func (c *RuncContainer) GetPodID() string

GetPodID return pod-id associated with container. only used by CRI-based drivers

func (*RuncContainer) Image

func (c *RuncContainer) Image() string

Image returns the bundle path that runc will use

func (*RuncContainer) Name

func (c *RuncContainer) Name() string

Name returns the name of the container

func (*RuncContainer) Pid

func (c *RuncContainer) Pid() string

Pid returns the process ID in cases where this container instance is wrapping a potentially running container

func (*RuncContainer) State

func (c *RuncContainer) State() string

State returns the queried state of the container (if available)

func (*RuncContainer) Trace

func (c *RuncContainer) Trace() bool

Trace returns whether the container should be started with tracing enabled

type RuncDriver

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

RuncDriver is an implementation of the driver interface for Runc. IMPORTANT: This implementation does not protect instance metadata for thread safely. At this time there is no understood use case for multi-threaded use of this implementation.

func (*RuncDriver) Clean

func (r *RuncDriver) Clean(ctx context.Context) error

Clean will clean the environment; removing any remaining containers in the runc metadata

func (*RuncDriver) Close

func (r *RuncDriver) Close() error

Close allows the driver to handle any resource free/connection closing as necessary. Runc has no need to perform any actions on close.

func (*RuncDriver) Create

func (r *RuncDriver) Create(_ context.Context, name, image, _ string, detached bool, trace bool) (Container, error)

Create will create a container instance matching the specific needs of a driver

func (*RuncDriver) Info

func (r *RuncDriver) Info(ctx context.Context) (string, error)

Info returns

func (*RuncDriver) PID

func (r *RuncDriver) PID() (int, error)

PID returns daemon process id

func (*RuncDriver) Path

func (r *RuncDriver) Path() string

Path returns the binary path of the runc binary in use

func (*RuncDriver) Pause

func (r *RuncDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)

Pause will pause a container

func (*RuncDriver) ProcNames

func (r *RuncDriver) ProcNames() []string

ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark

func (*RuncDriver) Remove

func (r *RuncDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)

Remove will remove a container

func (*RuncDriver) Run

Run will execute a container using the driver. Note that if the container is specified to run detached, but the config.json for the bundle specifies a "tty" allocation, this runc invocation will fail due to the fact we cannot detach without providing a "--console" device to runc. Detached daemon/server bundles should not need a tty; stdin/out/err of the container will be ignored given this is for benchmarking not validating container operation.

func (*RuncDriver) Stats

Stats returns stats data from daemon for container

func (*RuncDriver) Stop

func (r *RuncDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)

Stop will stop/kill a container

func (*RuncDriver) Type

func (r *RuncDriver) Type() Type

Type returns a driver.Type to indentify the driver implementation

func (*RuncDriver) Unpause

func (r *RuncDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)

Unpause will unpause/resume a container

func (*RuncDriver) Wait

Wait will block until container stop

type Type

type Type int

Type represents the know implementations of the driver interface

const (
	// DockerCLI represents the Docker CLI driver implementation
	DockerCLI Type = iota
	// Docker represents the Docker API driver implementation
	Docker
	// Runc represents the runc-based driver implementation
	Runc
	// Containerd represents the containerd-based driver implementation
	// using the GRPC API via the containerd client library
	Containerd
	// Ctr represents the containerd legacy driver using the `ctr`
	// binary to drive containerd operations
	Ctr
	// CRI driver represents k8s Container Runtime Interface
	CRI
	// Null driver represents an empty driver for use by benchmarks that
	// require no driver
	Null
	// CRun represents the crun-based(c++) driver implementation
	CRun
	// Youki represents the youki-based(rust) driver information
	Youki
)

func StringToType

func StringToType(dtype string) Type

StringToType converts a driver stringified typename into its Type

func (Type) String

func (driverType Type) String() string

String converts a driver Type into its string representation

type YoukiContainer

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

YoukiContainer is an implementation of the container metadata needed for youki

func (*YoukiContainer) Command

func (c *YoukiContainer) Command() string

Command is not implemented for the youki driver type as the command is embedded in the config.json of the rootfs

func (*YoukiContainer) Detached

func (c *YoukiContainer) Detached() bool

Detached returns whether the container should be started in detached mode

func (*YoukiContainer) GetPodID

func (c *YoukiContainer) GetPodID() string

GetPodID return pod-id associated with container. only used by CRI-based drivers

func (*YoukiContainer) Image

func (c *YoukiContainer) Image() string

Image returns the bundle path that youki will use

func (*YoukiContainer) Name

func (c *YoukiContainer) Name() string

Name returns the name of the container

func (*YoukiContainer) Pid

func (c *YoukiContainer) Pid() string

Pid returns the process ID in cases where this container instance is wrapping a potentially running container

func (*YoukiContainer) State

func (c *YoukiContainer) State() string

State returns the queried state of the container (if available)

func (*YoukiContainer) Trace

func (c *YoukiContainer) Trace() bool

Trace returns whether the container should be started with tracing enabled

type YoukiDriver

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

YoukiDriver is an implementation of the driver interface for Youki. IMPORTANT: This implementation does not protect instance metadata for thread safely. At this time there is no understood use case for multi-threaded use of this implementation.

func (*YoukiDriver) Clean

func (r *YoukiDriver) Clean(ctx context.Context) error

Clean will clean the environment; removing any remaining containers in the youki metadata

func (*YoukiDriver) Close

func (r *YoukiDriver) Close() error

Close allows the driver to handle any resource free/connection closing as necessary. youki has no need to perform any actions on close.

func (*YoukiDriver) Create

func (r *YoukiDriver) Create(_ context.Context, name, image, _ string, _ bool, _ bool) (Container, error)

Create will create a container instance matching the specific needs of a driver

func (*YoukiDriver) Info

func (r *YoukiDriver) Info(ctx context.Context) (string, error)

Info returns

func (*YoukiDriver) PID

func (r *YoukiDriver) PID() (int, error)

PID returns daemon process id

func (*YoukiDriver) Path

func (r *YoukiDriver) Path() string

Path returns the binary path of the youki binary in use

func (*YoukiDriver) Pause

func (r *YoukiDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)

Pause will pause a container

func (*YoukiDriver) ProcNames

func (r *YoukiDriver) ProcNames() []string

ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark

func (*YoukiDriver) Remove

func (r *YoukiDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)

Remove will remove a container

func (*YoukiDriver) Run

Run will execute a container using the driver.Youki automatically uses detach mode.

func (*YoukiDriver) Stats

Stats returns stats data from daemon for container

func (*YoukiDriver) Stop

func (r *YoukiDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)

Stop will stop/kill a container

func (*YoukiDriver) Type

func (r *YoukiDriver) Type() Type

Type returns a driver.Type to indentify the driver implementation

func (*YoukiDriver) Unpause

func (r *YoukiDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)

Unpause will unpause/resume a container

func (*YoukiDriver) Wait

Wait will block until container stop

Jump to

Keyboard shortcuts

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