v1alpha2

package
v0.0.0-...-8680cc4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 51 Imported by: 10

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
	VolumeMgr    mgr.VolumeMgr
	CniMgr       cni.CniMgr
	CriPlugin    hookplugins.CriPlugin

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

	// 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

	// DaemonConfig is the config of daemon
	DaemonConfig *config.Config
	// contains filtered or unexported fields
}

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) PauseContainer

PauseContainer pauses the container.

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) RemoveVolume

RemoveVolume removes the volume.

func (*CriManager) ReopenContainerLog

ReopenContainerLog asks runtime to reopen the stdout/stderr log file for the container. This is often called after the log file has been rotated. If the container is not running, container runtime can choose to either create a new log file and return nil, or return an error. Once it returns error, new container log file MUST NOT be created.

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) StartPodSandbox

StartPodSandbox restart a sandbox pod which was stopped by accident and we should reconfigure it with network plugin which will make sure it reacquire its original network configuration, like IP address.

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. notes: 1. for legacy dockershim style container, lifecycle of podNetwork is bound to container using /proc/$pid/ns/net. When stopping sandbox, we first teardown the pod network, then stop the sandbox container. 2. In newly implementation. We first create an empty netns and setup pod network inside it, which is independent from container lifecycle. When stopping sandbox, we first stop container, then teardown the pod network, which is a reverse operation of RunPodSandbox.

func (*CriManager) StreamRouter

func (c *CriManager) StreamRouter() stream.Router

StreamRouter returns the router of Stream StreamServer.

func (*CriManager) StreamServerStart

func (c *CriManager) StreamServerStart() error

StreamServerStart starts the stream server of CRI.

func (*CriManager) UnpauseContainer

UnpauseContainer unpauses the container.

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

	// VolumeServiceServer is interface of CRI volume service.
	runtime.VolumeServiceServer

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

	// StreamStart returns the router of Stream Server.
	StreamRouter() stream.Router
}

CriMgr as an interface defines all operations against CRI.

func NewCriManager

func NewCriManager(config *config.Config, ctrMgr mgr.ContainerMgr, imgMgr mgr.ImageMgr, volumeMgr mgr.VolumeMgr, criPlugin hookplugins.CriPlugin) (CriMgr, error)

NewCriManager creates a brand new cri manager.

type Service

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

Service serves the kubelet runtime grpc api which will be consumed by kubelet.

func NewService

func NewService(cfg *config.Config, criMgr CriMgr) (*Service, error)

NewService creates a brand new cri service.

func (*Service) Serve

func (s *Service) Serve() error

Serve starts grpc server.

type StreamServer

type StreamServer 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

	// Router is the Stream Server's handlers which we should export.
	stream.Router
}

StreamServer as an interface defines all operations against stream server.

func NewStreamServer

func NewStreamServer(config stream.Config, runtime stream.Runtime) (StreamServer, error)

NewStreamServer 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