Documentation ¶
Index ¶
- Constants
- func TypeToString(dtype Type) string
- type CRIContainer
- type CRIDriver
- func (c CRIDriver) Clean() error
- func (c *CRIDriver) Close() error
- func (c *CRIDriver) Create(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
- func (c *CRIDriver) Info() (string, error)
- func (c *CRIDriver) Path() string
- func (c *CRIDriver) Pause(ctr Container) (string, int, error)
- func (c *CRIDriver) Remove(ctr Container) (string, int, error)
- func (c *CRIDriver) Run(ctr Container) (string, int, error)
- func (c *CRIDriver) Stop(ctr Container) (string, int, error)
- func (c *CRIDriver) Type() Type
- func (c *CRIDriver) Unpause(ctr Container) (string, int, error)
- 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() error
- func (r *ContainerdDriver) Close() error
- func (r *ContainerdDriver) Create(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
- func (r *ContainerdDriver) Info() (string, error)
- func (r *ContainerdDriver) Path() string
- func (r *ContainerdDriver) Pause(ctr Container) (string, int, error)
- func (r *ContainerdDriver) Remove(ctr Container) (string, int, error)
- func (r *ContainerdDriver) Run(ctr Container) (string, int, error)
- func (r *ContainerdDriver) Stop(ctr Container) (string, int, error)
- func (r *ContainerdDriver) Type() Type
- func (r *ContainerdDriver) Unpause(ctr Container) (string, int, 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() error
- func (r *CtrDriver) Close() error
- func (r *CtrDriver) Create(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
- func (r *CtrDriver) Info() (string, error)
- func (r *CtrDriver) Path() string
- func (r *CtrDriver) Pause(ctr Container) (string, int, error)
- func (r *CtrDriver) Remove(ctr Container) (string, int, error)
- func (r *CtrDriver) Run(ctr Container) (string, int, error)
- func (r *CtrDriver) Stop(ctr Container) (string, int, error)
- func (r *CtrDriver) Type() Type
- func (r *CtrDriver) Unpause(ctr Container) (string, int, error)
- type DockerContainer
- type DockerDriver
- func (d *DockerDriver) Clean() error
- func (d *DockerDriver) Close() error
- func (d *DockerDriver) Create(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
- func (d *DockerDriver) Info() (string, error)
- func (d *DockerDriver) Path() string
- func (d *DockerDriver) Pause(ctr Container) (string, int, error)
- func (d *DockerDriver) Remove(ctr Container) (string, int, error)
- func (d *DockerDriver) Run(ctr Container) (string, int, error)
- func (d *DockerDriver) Stop(ctr Container) (string, int, error)
- func (d *DockerDriver) Type() Type
- func (d *DockerDriver) Unpause(ctr Container) (string, int, error)
- type Driver
- func New(dtype Type, path string) (Driver, error)
- func NewCRIDriver(path string) (Driver, error)
- func NewContainerdDriver(path string) (Driver, error)
- func NewCtrDriver(binaryPath string) (Driver, error)
- func NewDockerDriver(binaryPath string) (Driver, error)
- func NewRuncDriver(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() error
- func (r *RuncDriver) Close() error
- func (r *RuncDriver) Create(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
- func (r *RuncDriver) Info() (string, error)
- func (r *RuncDriver) Path() string
- func (r *RuncDriver) Pause(ctr Container) (string, int, error)
- func (r *RuncDriver) Remove(ctr Container) (string, int, error)
- func (r *RuncDriver) Run(ctr Container) (string, int, error)
- func (r *RuncDriver) Stop(ctr Container) (string, int, error)
- func (r *RuncDriver) Type() Type
- func (r *RuncDriver) Unpause(ctr Container) (string, int, error)
- type Type
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
Variables ¶
This section is empty.
Functions ¶
func TypeToString ¶
TypeToString converts a driver Type into its string representation
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(name, image, cmdOverride string, detached 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
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 (*ContainerdDriver) Clean ¶
func (r *ContainerdDriver) Clean() 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(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
Create will create a container instance matching the specific needs of a driver
func (*ContainerdDriver) Path ¶
func (r *ContainerdDriver) Path() string
Path returns the address (socket path) of the gRPC containerd API endpoint
func (*ContainerdDriver) Pause ¶
func (r *ContainerdDriver) Pause(ctr Container) (string, int, error)
Pause will pause a container
func (*ContainerdDriver) Remove ¶
func (r *ContainerdDriver) Remove(ctr Container) (string, int, 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) Run ¶
func (r *ContainerdDriver) Run(ctr Container) (string, int, error)
Run will execute a container using the containerd driver.
func (*ContainerdDriver) Stop ¶
func (r *ContainerdDriver) Stop(ctr Container) (string, int, error)
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(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
Create will create a container instance matching the specific needs of a driver
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 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. 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 (*DockerDriver) Clean ¶
func (d *DockerDriver) Clean() error
Clean will clean the environment; removing any exited containers
func (*DockerDriver) Close ¶
func (d *DockerDriver) Close() error
Close allows the driver to handle any resource free/connection closing as necessary. Docker has no need to perform any actions on close.
func (*DockerDriver) Create ¶
func (d *DockerDriver) Create(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
Create will create a container instance matching the specific needs of a driver
func (*DockerDriver) Path ¶
func (d *DockerDriver) Path() string
Path returns the binary path of the docker binary in use
func (*DockerDriver) Pause ¶
func (d *DockerDriver) Pause(ctr Container) (string, int, error)
Pause will pause a container
func (*DockerDriver) Remove ¶
func (d *DockerDriver) Remove(ctr Container) (string, int, error)
Remove will remove a container
func (*DockerDriver) Run ¶
func (d *DockerDriver) Run(ctr Container) (string, int, error)
Run will execute a container using the driver
func (*DockerDriver) Stop ¶
func (d *DockerDriver) Stop(ctr Container) (string, int, error)
Stop will stop/kill a 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() (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(name, image, cmdOverride string, detached bool, trace bool) (Container, error) // Clean will clean the operating environment of a specific driver Clean() error // Run will execute a container using the driver Run(ctr Container) (string, int, error) // Stop will stop/kill a container Stop(ctr Container) (string, int, error) // Remove will remove a container Remove(ctr Container) (string, int, error) // Pause will pause a container Pause(ctr Container) (string, int, error) // Unpause will unpause/resume a container Unpause(ctr Container) (string, int, error) // Close allows the driver to free any resources/close any // connections Close() 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 NewContainerdDriver ¶
NewContainerdDriver creates an instance of the containerd driver, providing a path to the ctr client
func NewCtrDriver ¶
NewCtrDriver creates an instance of the containerd driver, providing a path to the ctr client
func NewDockerDriver ¶
NewDockerDriver 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
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() 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(name, image, cmdOverride string, detached bool, trace bool) (Container, error)
Create will create a container instance matching the specific needs of a driver
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(ctr Container) (string, int, error)
Pause will pause a container
func (*RuncDriver) Remove ¶
func (r *RuncDriver) Remove(ctr Container) (string, int, error)
Remove will remove a container
func (*RuncDriver) Run ¶
func (r *RuncDriver) Run(ctr Container) (string, int, error)
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) Stop ¶
func (r *RuncDriver) Stop(ctr Container) (string, int, 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
type Type ¶
type Type int
Type represents the know implementations of the driver interface
const ( // Docker represents the Docker driver implementation Docker Type = iota // 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 )
func StringToType ¶
StringToType converts a driver stringified typename into its Type