v1alpha1

package
v0.0.0-...-7ef7dd6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CriManager

type CriManager struct {
	ContainerMgr mgr.ContainerMgr
	ImageMgr     mgr.ImageMgr
	CniMgr       cni.CniMgr

	// StreamServer is the stream server of CRI serves container streaming request.
	StreamServer Server

	// SandboxBaseDir is the directory used to store sandbox files like /etc/hosts, /etc/resolv.conf, etc.
	SandboxBaseDir string

	// SandboxImage is the image used by sandbox container.
	SandboxImage string
	// SandboxStore stores the configuration of sandboxes.
	SandboxStore *meta.Store

	// SnapshotStore stores information of all snapshots.
	SnapshotStore *mgr.SnapshotStore

	// ImageFSUUID is the device uuid of image filesystem.
	ImageFSUUID string
}

CriManager is an implementation of interface CriMgr.

func (*CriManager) Attach

Attach prepares a streaming endpoint to attach to a running container, and returns the address.

func (*CriManager) ContainerStats

ContainerStats returns stats of the container. If the container does not exist, the call returns an error.

func (*CriManager) ContainerStatus

ContainerStatus inspects the container and returns the status.

func (*CriManager) CreateContainer

CreateContainer creates a new container in the given PodSandbox.

func (*CriManager) Exec

Exec prepares a streaming endpoint to execute a command in the container, and returns the address.

func (*CriManager) ExecSync

ExecSync executes a command in the container, and returns the stdout output. If command exits with a non-zero exit code, an error is returned.

func (*CriManager) ImageFsInfo

ImageFsInfo returns information of the filesystem that is used to store images.

func (*CriManager) ImageStatus

ImageStatus returns the status of the image. If the image is not present, returns a response with ImageStatusResponse.Image set to nil.

func (*CriManager) ListContainerStats

ListContainerStats returns stats of all running containers.

func (*CriManager) ListContainers

ListContainers lists all containers matching the filter.

func (*CriManager) ListImages

ListImages lists existing images.

func (*CriManager) ListPodSandbox

ListPodSandbox returns a list of Sandbox.

func (*CriManager) PodSandboxStatus

PodSandboxStatus returns the status of the PodSandbox.

func (*CriManager) PortForward

PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.

func (*CriManager) PullImage

PullImage pulls an image with authentication config.

func (*CriManager) RemoveContainer

RemoveContainer removes the container.

func (*CriManager) RemoveImage

RemoveImage removes the image.

func (*CriManager) RemovePodSandbox

RemovePodSandbox removes the sandbox. If there are running containers in the sandbox, they should be forcibly removed.

func (*CriManager) RunPodSandbox

RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure the sandbox is in ready state.

func (*CriManager) StartContainer

StartContainer starts the container.

func (*CriManager) Status

Status returns the status of the runtime.

func (*CriManager) StopContainer

StopContainer stops a running container with a grace period (i.e., timeout).

func (*CriManager) StopPodSandbox

StopPodSandbox stops the sandbox. If there are any running containers in the sandbox, they should be forcibly terminated.

func (*CriManager) StreamServerStart

func (c *CriManager) StreamServerStart() error

StreamServerStart starts the stream server of CRI.

func (*CriManager) UpdateContainerResources

UpdateContainerResources updates ContainerConfig of the container.

func (*CriManager) UpdateRuntimeConfig

UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.

func (*CriManager) Version

Version returns the runtime name, runtime version and runtime API version.

type CriMgr

type CriMgr interface {
	// RuntimeServiceServer is interface of CRI runtime service.
	runtime.RuntimeServiceServer

	// ImageServiceServer is interface of CRI image service.
	runtime.ImageServiceServer

	// StreamServerStart starts the stream server of CRI.
	StreamServerStart() error
}

CriMgr as an interface defines all operations against CRI.

func NewCriManager

func NewCriManager(config *config.Config, ctrMgr mgr.ContainerMgr, imgMgr mgr.ImageMgr) (CriMgr, error)

NewCriManager creates a brand new cri manager.

type CriWrapper

type CriWrapper struct {
	*CriManager
}

CriWrapper wraps CriManager and logs each operation for debugging convenice.

func NewCriWrapper

func NewCriWrapper(c *CriManager) *CriWrapper

NewCriWrapper creates a brand new CriWrapper.

func (*CriWrapper) Attach

func (c *CriWrapper) Attach(ctx context.Context, r *runtime.AttachRequest) (res *runtime.AttachResponse, err error)

Attach prepares a streaming endpoint to attach to a running container, and returns the address.

func (*CriWrapper) ContainerStats

ContainerStats returns stats of the container. If the container does not exist, the call returns an error.

func (*CriWrapper) ContainerStatus

ContainerStatus inspects the container and returns the status.

func (*CriWrapper) CreateContainer

CreateContainer creates a new container in the given PodSandbox.

func (*CriWrapper) Exec

func (c *CriWrapper) Exec(ctx context.Context, r *runtime.ExecRequest) (res *runtime.ExecResponse, err error)

Exec prepares a streaming endpoint to execute a command in the container, and returns the address.

func (*CriWrapper) ExecSync

ExecSync executes a command in the container, and returns the stdout output. If command exits with a non-zero exit code, an error is returned.

func (*CriWrapper) ImageFsInfo

ImageFsInfo returns information of the filesystem that is used to store images.

func (*CriWrapper) ImageStatus

ImageStatus returns the status of the image, returns nil if the image isn't present.

func (*CriWrapper) ListContainerStats

ListContainerStats returns stats of all running containers.

func (*CriWrapper) ListContainers

ListContainers lists all containers matching the filter.

func (*CriWrapper) ListImages

ListImages lists existing images.

func (*CriWrapper) ListPodSandbox

ListPodSandbox returns a list of Sandbox.

func (*CriWrapper) PodSandboxStatus

PodSandboxStatus returns the status of the PodSandbox.

func (*CriWrapper) PortForward

PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.

func (*CriWrapper) PullImage

PullImage pulls an image with authentication config.

func (*CriWrapper) RemoveContainer

RemoveContainer removes the container.

func (*CriWrapper) RemoveImage

RemoveImage removes the image.

func (*CriWrapper) RemovePodSandbox

RemovePodSandbox removes the sandbox. If there are running containers in the sandbox, they should be forcibly removed.

func (*CriWrapper) RunPodSandbox

RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure the sandbox is in ready state.

func (*CriWrapper) StartContainer

StartContainer starts the container.

func (*CriWrapper) Status

func (c *CriWrapper) Status(ctx context.Context, r *runtime.StatusRequest) (res *runtime.StatusResponse, err error)

Status returns the status of the runtime.

func (*CriWrapper) StopContainer

StopContainer stops a running container with a grace period (i.e., timeout).

func (*CriWrapper) StopPodSandbox

StopPodSandbox stops the sandbox. If there are any running containers in the sandbox, they should be forcibly terminated.

func (*CriWrapper) StreamServerStart

func (c *CriWrapper) StreamServerStart() (err error)

StreamServerStart starts the stream server of CRI.

func (*CriWrapper) UpdateContainerResources

UpdateContainerResources updates ContainerConfig of the container.

func (*CriWrapper) UpdateRuntimeConfig

UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.

func (*CriWrapper) Version

func (c *CriWrapper) Version(ctx context.Context, r *runtime.VersionRequest) (res *runtime.VersionResponse, err error)

Version returns the runtime name, runtime version and runtime API version.

type SandboxMeta

type SandboxMeta struct {
	// ID is the id of sandbox.
	ID string

	// Config is CRI sandbox config.
	Config *runtime.PodSandboxConfig

	// NetNSPath is the network namespace used by the sandbox.
	NetNSPath string

	// Runtime is the runtime of sandbox
	Runtime string
}

SandboxMeta represents the sandbox's meta data.

func (*SandboxMeta) Key

func (meta *SandboxMeta) Key() string

Key returns sandbox's id.

type Server

type Server interface {
	// GetExec get the serving URL for Exec request.
	GetExec(*runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)

	// GetAttach get the serving URL for Attach request.
	GetAttach(*runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)

	// GetPortForward get the serving URL for PortForward request.
	GetPortForward(*runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)

	// Start starts the stream server.
	Start() error
}

Server as an interface defines all operations against stream server.

func NewServer

func NewServer(config stream.Config, runtime stream.Runtime) (Server, error)

NewServer creates a new stream server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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