dockershim

package
v1.23.17 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Overview

Package dockershim implements a container runtime interface Docker integration using k8s.io/cri-api/pkg/apis/runtime/v1/api.pb.go

Index

Constants

View Source
const (

	// DockerImageIDPrefix is the prefix of image id in container status.
	DockerImageIDPrefix = "docker://"
	// DockerPullableImageIDPrefix is the prefix of pullable image id in container status.
	DockerPullableImageIDPrefix = "docker-pullable://"
)

Variables

View Source
var ErrNotImplemented = errors.New("Not implemented")

Functions

func DefaultMemorySwap added in v1.7.0

func DefaultMemorySwap() int64

DefaultMemorySwap always returns 0 for no memory swap in a sandbox

func NewDockerClientFromConfig added in v1.9.0

func NewDockerClientFromConfig(config *ClientConfig) libdocker.Interface

NewDockerClientFromConfig create a docker client from given configure return nil if nil configure is given.

Types

type CRIService added in v1.10.0

type CRIService interface {
	runtimeapi.RuntimeServiceServer
	runtimeapi.ImageServiceServer
	Start() error
}

CRIService includes all methods necessary for a CRI server.

type CheckpointData added in v1.6.0

type CheckpointData struct {
	PortMappings []*PortMapping `json:"port_mappings,omitempty"`
	HostNetwork  bool           `json:"host_network,omitempty"`
}

CheckpointData contains all types of data that can be stored in the checkpoint.

type ClientConfig added in v1.9.0

type ClientConfig struct {
	DockerEndpoint            string
	RuntimeRequestTimeout     time.Duration
	ImagePullProgressDeadline time.Duration

	// Configuration for fake docker client
	EnableSleep       bool
	WithTraceDisabled bool
}

ClientConfig is parameters used to initialize docker client

type ContainerCheckpoint added in v1.20.0

type ContainerCheckpoint interface {
	checkpointmanager.Checkpoint
	GetData() (string, string, string, []*PortMapping, bool)
}

ContainerCheckpoint provides the interface for process container's checkpoint data

func NewPodSandboxCheckpoint added in v1.6.0

func NewPodSandboxCheckpoint(namespace, name string, data *CheckpointData) ContainerCheckpoint

NewPodSandboxCheckpoint inits a PodSandboxCheckpoint with the given args

type DockerService added in v1.5.0

type DockerService interface {
	CRIService

	// For serving streaming calls.
	http.Handler

	// For supporting legacy features.
	legacy.DockerLegacyService
}

DockerService is an interface that embeds the new RuntimeService and ImageService interfaces.

func NewDockerService added in v1.5.0

func NewDockerService(config *ClientConfig, podSandboxImage string, streamingConfig *streaming.Config, pluginSettings *NetworkPluginSettings,
	cgroupsName string, kubeCgroupDriver string, dockershimRootDir string) (DockerService, error)

NewDockerService creates a new `DockerService` struct. NOTE: Anything passed to DockerService should be eventually handled in another way when we switch to running the shim as a different process.

type ExecHandler added in v1.7.0

type ExecHandler interface {
	ExecInContainer(ctx context.Context, client libdocker.Interface, container *dockertypes.ContainerJSON, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error
}

ExecHandler knows how to execute a command in a running Docker container.

type NativeExecHandler added in v1.7.0

type NativeExecHandler struct{}

NativeExecHandler executes commands in Docker containers using Docker's exec API.

func (*NativeExecHandler) ExecInContainer added in v1.7.0

func (*NativeExecHandler) ExecInContainer(ctx context.Context, client libdocker.Interface, container *dockertypes.ContainerJSON, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error

ExecInContainer executes the cmd in container using the Docker's exec API

type NetworkPluginSettings added in v1.5.0

type NetworkPluginSettings struct {
	// HairpinMode is best described by comments surrounding the kubelet arg
	HairpinMode kubeletconfig.HairpinMode
	// NonMasqueradeCIDR is the range of ips which should *not* be included
	// in any MASQUERADE rules applied by the plugin
	NonMasqueradeCIDR string
	// PluginName is the name of the plugin, runtime shim probes for
	PluginName string
	// PluginBinDirString is a list of directiores delimited by commas, in
	// which the binaries for the plugin with PluginName may be found.
	PluginBinDirString string
	// PluginBinDirs is an array of directories in which the binaries for
	// the plugin with PluginName may be found. The admin is responsible for
	// provisioning these binaries before-hand.
	PluginBinDirs []string
	// PluginConfDir is the directory in which the admin places a CNI conf.
	// Depending on the plugin, this may be an optional field, eg: kubenet
	// generates its own plugin conf.
	PluginConfDir string
	// PluginCacheDir is the directory in which CNI should store cache files.
	PluginCacheDir string
	// MTU is the desired MTU for network devices created by the plugin.
	MTU int
}

NetworkPluginSettings is the subset of kubelet runtime args we pass to the container runtime shim so it can probe for network plugins. In the future we will feed these directly to a standalone container runtime process.

type PodSandboxCheckpoint added in v1.6.0

type PodSandboxCheckpoint struct {
	// Version of the pod sandbox checkpoint schema.
	Version string `json:"version"`
	// Pod name of the sandbox. Same as the pod name in the Pod ObjectMeta.
	Name string `json:"name"`
	// Pod namespace of the sandbox. Same as the pod namespace in the Pod ObjectMeta.
	Namespace string `json:"namespace"`
	// Data to checkpoint for pod sandbox.
	Data *CheckpointData `json:"data,omitempty"`
	// Checksum is calculated with fnv hash of the checkpoint object with checksum field set to be zero
	Checksum checksum.Checksum `json:"checksum"`
}

PodSandboxCheckpoint is the checkpoint structure for a sandbox

func (*PodSandboxCheckpoint) GetData added in v1.11.0

func (cp *PodSandboxCheckpoint) GetData() (string, string, string, []*PortMapping, bool)

GetData gets the PodSandboxCheckpoint's version and some net information

func (*PodSandboxCheckpoint) MarshalCheckpoint added in v1.11.0

func (cp *PodSandboxCheckpoint) MarshalCheckpoint() ([]byte, error)

MarshalCheckpoint encodes the PodSandboxCheckpoint instance to a json object

func (*PodSandboxCheckpoint) UnmarshalCheckpoint added in v1.11.0

func (cp *PodSandboxCheckpoint) UnmarshalCheckpoint(blob []byte) error

UnmarshalCheckpoint decodes the blob data to the PodSandboxCheckpoint instance

func (*PodSandboxCheckpoint) VerifyChecksum added in v1.11.0

func (cp *PodSandboxCheckpoint) VerifyChecksum() error

VerifyChecksum verifies whether the PodSandboxCheckpoint's data checksum is the same as calculated checksum

type PortMapping added in v1.6.0

type PortMapping struct {
	// Protocol of the port mapping.
	Protocol *Protocol `json:"protocol,omitempty"`
	// Port number within the container.
	ContainerPort *int32 `json:"container_port,omitempty"`
	// Port number on the host.
	HostPort *int32 `json:"host_port,omitempty"`
	// Host ip to expose.
	HostIP string `json:"host_ip,omitempty"`
}

PortMapping is the port mapping configurations of a sandbox.

type Protocol added in v1.6.0

type Protocol string

Protocol is the type of port mapping protocol

Directories

Path Synopsis
testing
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.
cni
cni/testing
mock_cni is a mock of the `libcni.CNI` interface.
mock_cni is a mock of the `libcni.CNI` interface.
testing
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.

Jump to

Keyboard shortcuts

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