Documentation ¶
Index ¶
- Constants
- type CRIContainer
- type CRIDriver
- func (c CRIDriver) Clean(ctx context.Context) error
- func (c *CRIDriver) Close() error
- func (c *CRIDriver) Create(ctx context.Context, name, image, cmdOverride string, _ bool, trace bool) (Container, error)
- func (c *CRIDriver) Info(ctx context.Context) (string, error)
- func (c *CRIDriver) PID() (int, error)
- func (c *CRIDriver) Path() string
- func (c *CRIDriver) Pause(_ context.Context, _ Container) (string, time.Duration, error)
- func (c *CRIDriver) ProcNames() []string
- func (c *CRIDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (c *CRIDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (c *CRIDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)
- func (c *CRIDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (c *CRIDriver) Type() Type
- func (c *CRIDriver) Unpause(_ context.Context, _ Container) (string, time.Duration, error)
- func (c *CRIDriver) Wait(_ context.Context, _ Container) (string, time.Duration, error)
- type CRunContainer
- func (c *CRunContainer) Command() string
- func (c *CRunContainer) Detached() bool
- func (c *CRunContainer) GetPodID() string
- func (c *CRunContainer) Image() string
- func (c *CRunContainer) Name() string
- func (c *CRunContainer) Pid() string
- func (c *CRunContainer) State() string
- func (c *CRunContainer) Trace() bool
- type CRunDriver
- func (r *CRunDriver) Clean(ctx context.Context) error
- func (r *CRunDriver) Close() error
- func (r *CRunDriver) Create(_ context.Context, name, image, _ string, detached bool, _ bool) (Container, error)
- func (r *CRunDriver) Info(ctx context.Context) (string, error)
- func (r *CRunDriver) PID() (int, error)
- func (r *CRunDriver) Path() string
- func (r *CRunDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CRunDriver) ProcNames() []string
- func (r *CRunDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CRunDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CRunDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)
- func (r *CRunDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CRunDriver) Type() Type
- func (r *CRunDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CRunDriver) Wait(_ context.Context, _ Container) (string, time.Duration, error)
- type Config
- type Container
- type ContainerdContainer
- func (c *ContainerdContainer) Command() string
- func (c *ContainerdContainer) Detached() bool
- func (c *ContainerdContainer) GetPodID() string
- func (c *ContainerdContainer) Image() string
- func (c *ContainerdContainer) Name() string
- func (c *ContainerdContainer) Process() string
- func (c *ContainerdContainer) State() string
- func (c *ContainerdContainer) Trace() bool
- type ContainerdDriver
- func (r *ContainerdDriver) Clean(ctx context.Context) error
- func (r *ContainerdDriver) Close() error
- func (r *ContainerdDriver) Create(ctx context.Context, name, image, cmdOverride string, _ bool, trace bool) (Container, error)
- func (r *ContainerdDriver) Info(ctx context.Context) (string, error)
- func (r *ContainerdDriver) PID() (int, error)
- func (r *ContainerdDriver) Path() string
- func (r *ContainerdDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *ContainerdDriver) ProcNames() []string
- func (r *ContainerdDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *ContainerdDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *ContainerdDriver) Stats(ctx context.Context, ctr Container) (io.ReadCloser, error)
- func (r *ContainerdDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *ContainerdDriver) Type() Type
- func (r *ContainerdDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *ContainerdDriver) Wait(ctx context.Context, ctr Container) (string, time.Duration, error)
- type CtrContainer
- func (c *CtrContainer) Command() string
- func (c *CtrContainer) Detached() bool
- func (c *CtrContainer) GetPodID() string
- func (c *CtrContainer) Image() string
- func (c *CtrContainer) Name() string
- func (c *CtrContainer) Process() string
- func (c *CtrContainer) State() string
- func (c *CtrContainer) Trace() bool
- type CtrDriver
- func (r *CtrDriver) Clean(ctx context.Context) error
- func (r *CtrDriver) Close() error
- func (r *CtrDriver) Create(_ context.Context, name, image, _ string, _ bool, trace bool) (Container, error)
- func (r *CtrDriver) Info(ctx context.Context) (string, error)
- func (r *CtrDriver) PID() (int, error)
- func (r *CtrDriver) Path() string
- func (r *CtrDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CtrDriver) ProcNames() []string
- func (r *CtrDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CtrDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CtrDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)
- func (r *CtrDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CtrDriver) Type() Type
- func (r *CtrDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *CtrDriver) Wait(_ context.Context, _ Container) (string, time.Duration, error)
- type DockerCLIDriver
- func (d *DockerCLIDriver) Clean(ctx context.Context) error
- func (d *DockerCLIDriver) Close() error
- func (d *DockerCLIDriver) Create(_ context.Context, name, image, cmdOverride string, detached bool, trace bool) (Container, error)
- func (d *DockerCLIDriver) Info(ctx context.Context) (string, error)
- func (d *DockerCLIDriver) PID() (int, error)
- func (d *DockerCLIDriver) Path() string
- func (d *DockerCLIDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerCLIDriver) ProcNames() []string
- func (d *DockerCLIDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerCLIDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerCLIDriver) Stats(ctx context.Context, ctr Container) (io.ReadCloser, error)
- func (d *DockerCLIDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerCLIDriver) Type() Type
- func (d *DockerCLIDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerCLIDriver) Wait(ctx context.Context, ctr Container) (string, time.Duration, error)
- type DockerContainer
- type DockerDriver
- func (d *DockerDriver) Clean(ctx context.Context) error
- func (d *DockerDriver) Close() error
- func (d *DockerDriver) Create(ctx context.Context, name, image, cmdOverride string, detached bool, ...) (Container, error)
- func (d *DockerDriver) Info(ctx context.Context) (string, error)
- func (d *DockerDriver) PID() (int, error)
- func (d *DockerDriver) Path() string
- func (d *DockerDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerDriver) ProcNames() []string
- func (d *DockerDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerDriver) Stats(ctx context.Context, ctr Container) (io.ReadCloser, error)
- func (d *DockerDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerDriver) Type() Type
- func (d *DockerDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (d *DockerDriver) Wait(ctx context.Context, ctr Container) (string, time.Duration, error)
- type Driver
- func New(ctx context.Context, config *Config) (Driver, error)
- func NewCRIDriver(path string) (Driver, error)
- func NewCRunDriver(binaryPath string) (Driver, error)
- func NewCtrDriver(binaryPath string) (Driver, error)
- func NewDockerCLIDriver(ctx context.Context, config *Config) (Driver, error)
- func NewRuncDriver(binaryPath string) (Driver, error)
- func NewYoukiDriver(binaryPath string) (Driver, error)
- type RuncContainer
- func (c *RuncContainer) Command() string
- func (c *RuncContainer) Detached() bool
- func (c *RuncContainer) GetPodID() string
- func (c *RuncContainer) Image() string
- func (c *RuncContainer) Name() string
- func (c *RuncContainer) Pid() string
- func (c *RuncContainer) State() string
- func (c *RuncContainer) Trace() bool
- type RuncDriver
- func (r *RuncDriver) Clean(ctx context.Context) error
- func (r *RuncDriver) Close() error
- func (r *RuncDriver) Create(_ context.Context, name, image, _ string, detached bool, trace bool) (Container, error)
- func (r *RuncDriver) Info(ctx context.Context) (string, error)
- func (r *RuncDriver) PID() (int, error)
- func (r *RuncDriver) Path() string
- func (r *RuncDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *RuncDriver) ProcNames() []string
- func (r *RuncDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *RuncDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *RuncDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)
- func (r *RuncDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *RuncDriver) Type() Type
- func (r *RuncDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *RuncDriver) Wait(_ context.Context, _ Container) (string, time.Duration, error)
- type Type
- type YoukiContainer
- func (c *YoukiContainer) Command() string
- func (c *YoukiContainer) Detached() bool
- func (c *YoukiContainer) GetPodID() string
- func (c *YoukiContainer) Image() string
- func (c *YoukiContainer) Name() string
- func (c *YoukiContainer) Pid() string
- func (c *YoukiContainer) State() string
- func (c *YoukiContainer) Trace() bool
- type YoukiDriver
- func (r *YoukiDriver) Clean(ctx context.Context) error
- func (r *YoukiDriver) Close() error
- func (r *YoukiDriver) Create(_ context.Context, name, image, _ string, _ bool, _ bool) (Container, error)
- func (r *YoukiDriver) Info(ctx context.Context) (string, error)
- func (r *YoukiDriver) PID() (int, error)
- func (r *YoukiDriver) Path() string
- func (r *YoukiDriver) Pause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *YoukiDriver) ProcNames() []string
- func (r *YoukiDriver) Remove(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *YoukiDriver) Run(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *YoukiDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)
- func (r *YoukiDriver) Stop(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *YoukiDriver) Type() Type
- func (r *YoukiDriver) Unpause(ctx context.Context, ctr Container) (string, time.Duration, error)
- func (r *YoukiDriver) Wait(_ context.Context, _ Container) (string, time.Duration, error)
Constants ¶
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
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) 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 ¶
Info returns a string with information about the container engine/runtime details
func (*CRIDriver) ProcNames ¶
ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark
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) Path ¶
func (r *CRunDriver) Path() string
Path returns the binary path of the crun binary in use
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) 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 ¶
func (r *CRunDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)
Stats returns stats data from daemon for container
func (*CRunDriver) Type ¶
func (r *CRunDriver) Type() Type
Type returns a driver.Type to indentify the driver implementation
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) ProcNames ¶
func (r *ContainerdDriver) ProcNames() []string
ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark
func (*ContainerdDriver) Remove ¶
func (r *ContainerdDriver) 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 (*ContainerdDriver) Stats ¶
func (r *ContainerdDriver) Stats(ctx context.Context, ctr Container) (io.ReadCloser, error)
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
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 ¶
Clean will clean the environment; removing any remaining containers in the runc metadata
func (*CtrDriver) Close ¶
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) ProcNames ¶
ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark
func (*CtrDriver) Remove ¶
Remove will remove a container; in the containerd case we simply call kill which will remove any container metadata if it was running
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) ProcNames ¶
func (d *DockerCLIDriver) ProcNames() []string
ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark
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) Type ¶
func (d *DockerCLIDriver) Type() Type
Type returns a driver.Type to indentify the driver implementation
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) ProcNames ¶
func (d *DockerDriver) ProcNames() []string
ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark
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) Type ¶
func (d *DockerDriver) Type() Type
Type returns a driver.Type to indentify the driver implementation
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 NewCRIDriver ¶
NewCRIDriver creates an instance of the CRI driver
func NewCRunDriver ¶
NewCRunDriver creates an instance of the crun driver, providing a path to crun
func NewCtrDriver ¶
NewCtrDriver creates an instance of the containerd driver, providing a path to the ctr client
func NewDockerCLIDriver ¶
NewDockerCLIDriver creates an instance of the docker driver, providing a path to the docker client binary
func NewRuncDriver ¶
NewRuncDriver creates an instance of the runc driver, providing a path to runc
func NewYoukiDriver ¶
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) Path ¶
func (r *RuncDriver) Path() string
Path returns the binary path of the runc binary in use
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) 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 ¶
func (r *RuncDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)
Stats returns stats data from daemon for container
func (*RuncDriver) Type ¶
func (r *RuncDriver) Type() Type
Type returns a driver.Type to indentify the driver implementation
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 ¶
StringToType converts a driver stringified typename into its Type
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) Path ¶
func (r *YoukiDriver) Path() string
Path returns the binary path of the youki binary in use
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) Run ¶
Run will execute a container using the driver.Youki automatically uses detach mode.
func (*YoukiDriver) Stats ¶
func (r *YoukiDriver) Stats(_ context.Context, _ Container) (io.ReadCloser, error)
Stats returns stats data from daemon for container
func (*YoukiDriver) Type ¶
func (r *YoukiDriver) Type() Type
Type returns a driver.Type to indentify the driver implementation