cri

package
v0.0.0-...-30d97dc Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package cri contains the container runtime interface abstraction. This exists to abstract Docker and Docker-in-Docker away from the main worker implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRI

type CRI interface {
	ImagePull(ctx context.Context, log logr.Logger, image string) error
	ContainerCreate(ctx context.Context, spec *ContainerSpec) (Container, error)
}

CRI is an implementation of a container runtime.

type Container

type Container interface {
	ID() string
	Status(ctx context.Context) (*ContainerStatus, error)
	Run(ctx context.Context, stdout, stderr io.Writer) (int, error)
	Remove(ctx context.Context) error

	ReadFiles(ctx context.Context, path string) (io.ReadCloser, fs.FileInfo, error)
}

Container represents a single container managed by a CRI.

type ContainerSpec

type ContainerSpec struct {
	Name string

	Image      string
	Entrypoint []string
	Command    []string
	Env        map[string]string
	WorkingDir string
	Volumes    map[string]struct{}
	Binds      []string

	Privileged bool
	PodWith    Container
}

ContainerSpec contains a container specification.

type ContainerStatus

type ContainerStatus struct {
	StartedAt  *time.Time
	FinishedAt *time.Time
	IPAddress  string
}

ContainerStatus contains information about the current state of a container.

type Docker

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

Docker is a Docker CRI implementation.

func NewDocker

func NewDocker(client client.APIClient, config *configfile.ConfigFile) *Docker

NewDocker wraps a Docker client and config file as a CRI.

func (*Docker) ContainerCreate

func (d *Docker) ContainerCreate(ctx context.Context, spec *ContainerSpec) (Container, error)

ContainerCreate creates a new Docker container.

func (*Docker) ImagePull

func (d *Docker) ImagePull(ctx context.Context, log logr.Logger, image string) (err error)

ImagePull fetches a remote image into the local Docker instance.

type Sandbox

type Sandbox interface {
	io.Closer
	CRI
}

Sandbox represents a CRI which can be deleted.

type SandboxFactory

type SandboxFactory interface {
	SandboxCreate(ctx context.Context, log logr.Logger, name string) (Sandbox, error)
}

SandboxFactory is a factory which can create Sandboxes.

func NewDockerInDockerSandbox

func NewDockerInDockerSandbox(cri CRI, config *configfile.ConfigFile, image string) SandboxFactory

NewDockerInDockerSandbox creates a SandboxFactory which uses an existing CRI to run docker-in-docker.

Jump to

Keyboard shortcuts

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