ctr

package
v0.1.0-M1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: EPL-2.0 Imports: 59 Imported by: 0

Documentation

Overview

Package ctr is a generated GoMock package.

Package ctr is a generated GoMock package.

Index

Constants

View Source
const (
	// RuntimeTypeV2runscV1 is the runtime type name for gVisor containerd shim implement the shim v2 api.
	RuntimeTypeV2runscV1 = "io.containerd.runsc.v1"
	// RuntimeTypeV2kataV2 is the runtime type name for kata-runtime containerd shim implement the shim v2 api.
	RuntimeTypeV2kataV2 = "io.containerd.kata.v2"
	// RuntimeTypeV2runcV1 is the runtime type name for runc containerd shim implement the shim v2 api.
	RuntimeTypeV2runcV1 = "io.containerd.runc.v1"
)
View Source
const (
	// ContainerdClientServiceLocalID sets service local ID for containerd client.
	ContainerdClientServiceLocalID = "container-management.service.local.v1.service-containerd-client"
)

Variables

View Source
var (
	// RuntimeTypeV1 is the runtime type name for containerd shim interface v1 version.
	RuntimeTypeV1 = fmt.Sprintf("io.containerd.runtime.v1.%s", runtime.GOOS)
	// CtrdRuntimes contains all runtime type names
	CtrdRuntimes = map[string]string{
		RuntimeTypeV1:        "runc",
		RuntimeTypeV2runscV1: "runhcs",
		RuntimeTypeV2kataV2:  "kata",
		RuntimeTypeV2runcV1:  "runc",
	}
)

Functions

func WithCommonOptions

func WithCommonOptions(c *types.Container) crtdoci.SpecOpts

WithCommonOptions sets common options: - hostname

func WithDevices

func WithDevices(c *types.Container) crtdoci.SpecOpts

WithDevices sets the available USB devices Package name changed also removed not needed logic and added custom code to handle the specific use case, Bosch.IO GmbH, 2020

func WithHooks

func WithHooks(container *types.Container, execRoot string) crtdoci.SpecOpts

WithHooks sets the desired OCI hooks for the provided container instance.

func WithMounts

func WithMounts(container *types.Container) crtdoci.SpecOpts

WithMounts sets the network resolution files generated e.g. c.getRootResourceDir("resolv.conf"), "hostname", "hosts"

func WithNamespaces

func WithNamespaces(container *types.Container) crtdoci.SpecOpts

WithNamespaces sets the enabled and desired namespaces to be used for the container's isolation.

func WithProcessOptions

func WithProcessOptions(c *types.Container) crtdoci.SpecOpts

WithProcessOptions sets the container's root process configuration - env variables - etc.

func WithResources

func WithResources(c *types.Container) crtdoci.SpecOpts

WithResources sets container resource limitation:

func WithRuntimeOpts

func WithRuntimeOpts(container *types.Container, runtimeRootPath string) containerd.NewContainerOpts

WithRuntimeOpts sets the runtime configuration for the container to be created.

func WithSnapshotOpts

func WithSnapshotOpts(snapshotID string, snapshotterType string) []containerd.NewContainerOpts

WithSnapshotOpts sets the snapshotting configuration for the container to be created.

func WithSpecOpts

func WithSpecOpts(container *types.Container, image containerd.Image, execRoot string) containerd.NewContainerOpts

WithSpecOpts sets the OCI specification configuration options for the container to be created.

Types

type AuthCredentials

type AuthCredentials struct {
	UserID   string
	Password string
}

AuthCredentials represents credentials for accessing container registries secured via Basic Auth.

type ContainerAPIClient

type ContainerAPIClient interface {
	// DestroyContainer kill container and delete it
	DestroyContainer(ctx context.Context, container *types.Container, stopOpts *types.StopOpts, clearIOs bool) (int64, time.Time, error)

	// CreateContainer creates all resources needed in the underlying container management so that a container can be successfully started
	CreateContainer(ctx context.Context, container *types.Container, checkpointDir string) error

	// StartContainer starts the underlying container
	StartContainer(ctx context.Context, container *types.Container, checkpointDir string) (int64, error)

	// AttachContainer attaches to the container's IO
	AttachContainer(ctx context.Context, container *types.Container, attachConfig *streams.AttachConfig) error

	// PauseContainer pauses a container
	PauseContainer(ctx context.Context, container *types.Container) error

	// UnpauseContainer unpauses a container
	UnpauseContainer(ctx context.Context, container *types.Container) error

	// RestoreContainer restores the container information from the underlying container management client along with initialization of all needed resources - streams, etc.
	RestoreContainer(ctx context.Context, container *types.Container) error

	// Dispose manages stop and dispose the containers client
	Dispose(ctx context.Context) error

	// ListContainers lists all created containers
	ListContainers(ctx context.Context) ([]*types.Container, error)

	// GetContainerInfo provides detailed information about a container
	GetContainerInfo(ctx context.Context, id string) (*types.Container, error)

	// ReleaseContainerResources releases all locally allocated resources for the container by the client implementation - e.g. streams, etc.
	ReleaseContainerResources(ctx context.Context, container *types.Container) error

	// SetContainerExitHooks provides access for hooking a clearing logic to the containers resources management on exit
	SetContainerExitHooks(hooks ...ContainerExitHook)

	//UpdateContainer updates container resource limits
	UpdateContainer(ctx context.Context, container *types.Container, resources *types.Resources) error
}

ContainerAPIClient provides access to containerd container features

type ContainerExitHook

type ContainerExitHook func(*types.Container, int64, error, bool, func() error) error

ContainerExitHook represents a hook for clearing logic to the containers resources management on exit

type ContainerOpts

type ContainerOpts func(ctrOptions *ctrOpts) error

ContainerOpts represents container engine client's configuration options.

func WithCtrdConnectionPath

func WithCtrdConnectionPath(conPath string) ContainerOpts

WithCtrdConnectionPath sets the address path to the containerd service communication endpoint (e.g. a local UNIX socket).

func WithCtrdMetaPath

func WithCtrdMetaPath(metaPath string) ContainerOpts

WithCtrdMetaPath sets meta path for the container client service to use for its storage.

func WithCtrdNamespace

func WithCtrdNamespace(namespace string) ContainerOpts

WithCtrdNamespace sets the namespace that the container client instance will use within containerd.

func WithCtrdRegistryConfigs

func WithCtrdRegistryConfigs(configs map[string]*RegistryConfig) ContainerOpts

WithCtrdRegistryConfigs sets the configurations for accessing the provided container registries.

func WithCtrdRootExec

func WithCtrdRootExec(rootExecDir string) ContainerOpts

WithCtrdRootExec sets root executable directory that the client will use.

type IO

type IO interface {
	// InitContainerIO will start logger and coping data from fifo
	InitContainerIO(dio *cio.DirectIO) (cio.IO, error)
	// SetLogDriver sets log driver to the IO
	SetLogDriver(logDriver logger.LogDriver)
	// SetMaxBufferSize set the max size of buffer.
	SetMaxBufferSize(maxBufferSize int64)
	// SetNonBlock whether to cache the container's logs with buffer
	SetNonBlock(nonBlock bool)
	// Stream is used to export the stream field
	Stream() streams.Stream
	// UseStdin returns whether the STDIN stream should also be attached
	UseStdin() bool
	// Wait wait for coping-data job
	Wait()
	// Close closes the stream and the logger
	Close() error
	// Reset resets the allocated streams
	Reset()
}

IO represents the streams and logger per identifiable process

type MockIO

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

MockIO is a mock of IO interface.

func NewMockIO

func NewMockIO(ctrl *gomock.Controller) *MockIO

NewMockIO creates a new mock instance.

func (*MockIO) Close

func (m *MockIO) Close() error

Close mocks base method.

func (*MockIO) EXPECT

func (m *MockIO) EXPECT() *MockIOMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIO) InitContainerIO

func (m *MockIO) InitContainerIO(dio *cio.DirectIO) (cio.IO, error)

InitContainerIO mocks base method.

func (*MockIO) Reset

func (m *MockIO) Reset()

Reset mocks base method.

func (*MockIO) SetLogDriver

func (m *MockIO) SetLogDriver(logDriver logger.LogDriver)

SetLogDriver mocks base method.

func (*MockIO) SetMaxBufferSize

func (m *MockIO) SetMaxBufferSize(maxBufferSize int64)

SetMaxBufferSize mocks base method.

func (*MockIO) SetNonBlock

func (m *MockIO) SetNonBlock(nonBlock bool)

SetNonBlock mocks base method.

func (*MockIO) Stream

func (m *MockIO) Stream() streams.Stream

Stream mocks base method.

func (*MockIO) UseStdin

func (m *MockIO) UseStdin() bool

UseStdin mocks base method.

func (*MockIO) Wait

func (m *MockIO) Wait()

Wait mocks base method.

type MockIOMockRecorder

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

MockIOMockRecorder is the mock recorder for MockIO.

func (*MockIOMockRecorder) Close

func (mr *MockIOMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockIOMockRecorder) InitContainerIO

func (mr *MockIOMockRecorder) InitContainerIO(dio interface{}) *gomock.Call

InitContainerIO indicates an expected call of InitContainerIO.

func (*MockIOMockRecorder) Reset

func (mr *MockIOMockRecorder) Reset() *gomock.Call

Reset indicates an expected call of Reset.

func (*MockIOMockRecorder) SetLogDriver

func (mr *MockIOMockRecorder) SetLogDriver(logDriver interface{}) *gomock.Call

SetLogDriver indicates an expected call of SetLogDriver.

func (*MockIOMockRecorder) SetMaxBufferSize

func (mr *MockIOMockRecorder) SetMaxBufferSize(maxBufferSize interface{}) *gomock.Call

SetMaxBufferSize indicates an expected call of SetMaxBufferSize.

func (*MockIOMockRecorder) SetNonBlock

func (mr *MockIOMockRecorder) SetNonBlock(nonBlock interface{}) *gomock.Call

SetNonBlock indicates an expected call of SetNonBlock.

func (*MockIOMockRecorder) Stream

func (mr *MockIOMockRecorder) Stream() *gomock.Call

Stream indicates an expected call of Stream.

func (*MockIOMockRecorder) UseStdin

func (mr *MockIOMockRecorder) UseStdin() *gomock.Call

UseStdin indicates an expected call of UseStdin.

func (*MockIOMockRecorder) Wait

func (mr *MockIOMockRecorder) Wait() *gomock.Call

Wait indicates an expected call of Wait.

type MockcontainerIOManager

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

MockcontainerIOManager is a mock of containerIOManager interface.

func NewMockcontainerIOManager

func NewMockcontainerIOManager(ctrl *gomock.Controller) *MockcontainerIOManager

NewMockcontainerIOManager creates a new mock instance.

func (*MockcontainerIOManager) ClearIO

func (m *MockcontainerIOManager) ClearIO(id string) error

ClearIO mocks base method.

func (*MockcontainerIOManager) CloseIO

func (m *MockcontainerIOManager) CloseIO(id string) error

CloseIO mocks base method.

func (*MockcontainerIOManager) ConfigureIO

func (m *MockcontainerIOManager) ConfigureIO(id string, logDriver logger.LogDriver, logModeCfg *types.LogModeConfiguration) error

ConfigureIO mocks base method.

func (*MockcontainerIOManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockcontainerIOManager) ExistsIO

func (m *MockcontainerIOManager) ExistsIO(id string) bool

ExistsIO mocks base method.

func (*MockcontainerIOManager) GetIO

func (m *MockcontainerIOManager) GetIO(id string) IO

GetIO mocks base method.

func (*MockcontainerIOManager) InitIO

func (m *MockcontainerIOManager) InitIO(id string, withStdin bool) (IO, error)

InitIO mocks base method.

func (*MockcontainerIOManager) NewCioAttach

func (m *MockcontainerIOManager) NewCioAttach(id string) cio.Attach

NewCioAttach mocks base method.

func (*MockcontainerIOManager) NewCioCreator

func (m *MockcontainerIOManager) NewCioCreator(withTerminal bool) cio.Creator

NewCioCreator mocks base method.

func (*MockcontainerIOManager) ResetIO

func (m *MockcontainerIOManager) ResetIO(id string)

ResetIO mocks base method.

type MockcontainerIOManagerMockRecorder

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

MockcontainerIOManagerMockRecorder is the mock recorder for MockcontainerIOManager.

func (*MockcontainerIOManagerMockRecorder) ClearIO

func (mr *MockcontainerIOManagerMockRecorder) ClearIO(id interface{}) *gomock.Call

ClearIO indicates an expected call of ClearIO.

func (*MockcontainerIOManagerMockRecorder) CloseIO

func (mr *MockcontainerIOManagerMockRecorder) CloseIO(id interface{}) *gomock.Call

CloseIO indicates an expected call of CloseIO.

func (*MockcontainerIOManagerMockRecorder) ConfigureIO

func (mr *MockcontainerIOManagerMockRecorder) ConfigureIO(id, logDriver, logModeCfg interface{}) *gomock.Call

ConfigureIO indicates an expected call of ConfigureIO.

func (*MockcontainerIOManagerMockRecorder) ExistsIO

func (mr *MockcontainerIOManagerMockRecorder) ExistsIO(id interface{}) *gomock.Call

ExistsIO indicates an expected call of ExistsIO.

func (*MockcontainerIOManagerMockRecorder) GetIO

func (mr *MockcontainerIOManagerMockRecorder) GetIO(id interface{}) *gomock.Call

GetIO indicates an expected call of GetIO.

func (*MockcontainerIOManagerMockRecorder) InitIO

func (mr *MockcontainerIOManagerMockRecorder) InitIO(id, withStdin interface{}) *gomock.Call

InitIO indicates an expected call of InitIO.

func (*MockcontainerIOManagerMockRecorder) NewCioAttach

func (mr *MockcontainerIOManagerMockRecorder) NewCioAttach(id interface{}) *gomock.Call

NewCioAttach indicates an expected call of NewCioAttach.

func (*MockcontainerIOManagerMockRecorder) NewCioCreator

func (mr *MockcontainerIOManagerMockRecorder) NewCioCreator(withTerminal interface{}) *gomock.Call

NewCioCreator indicates an expected call of NewCioCreator.

func (*MockcontainerIOManagerMockRecorder) ResetIO

func (mr *MockcontainerIOManagerMockRecorder) ResetIO(id interface{}) *gomock.Call

ResetIO indicates an expected call of ResetIO.

type RegistryConfig

type RegistryConfig struct {
	IsInsecure  bool
	Credentials *AuthCredentials
	Transport   *TLSConfig
}

RegistryConfig represents a single registry's access configuration.

type TLSConfig

type TLSConfig struct {
	RootCA     string
	ClientCert string
	ClientKey  string
}

TLSConfig represents TLS configuration.

Jump to

Keyboard shortcuts

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