cri

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetworkPluginBridge = "bridge"
	NetworkPluginCNI    = "cni"
)

NetworkPlugin defines how the pod network should be setup. NetworkPluginBridge creates and manages a lxd bridge which the containers are attached to NetworkPluginCNI uses the kubernetes cni tools to let it attach interfaces to containers

View Source
const Domain = "lxe"

Domain of the daemon

Variables

View Source
var (
	ErrNotImplemented       = errors.New("not implemented")
	ErrUnknownNetworkPlugin = errors.New("unknown network plugin")
)
View Source
var (
	ErrDetectDefault = errors.New("unable to detect default")
)
View Source
var (
	ErrTimeout = errors.New("timeout error")
)
View Source
var NetworkSetupTimeout = 30 * time.Second

Functions

func AnnErr added in v0.4.1

func AnnErr(log *logrus.Entry, code codes.Code, err error, msg string) error

func CompareFilterMap

func CompareFilterMap(base map[string]string, filter map[string]string) bool

CompareFilterMap allows comparing two string maps

func SilErr added in v0.4.1

func SilErr(log *logrus.Entry, code codes.Code, err error, msg string) error

Types

type AnnotatedError added in v0.4.1

type AnnotatedError struct {
	Log  *logrus.Entry
	Code codes.Code
	Err  error
	Msg  string
}

Provide possibility to annotate errors for logging. The grpc CallTracer will try to match the returned error and log accordingly.

func (AnnotatedError) Error added in v0.4.1

func (e AnnotatedError) Error() string

func (AnnotatedError) String added in v0.4.1

func (e AnnotatedError) String() string

type Config

type Config struct {
	// UnixSocket this LXE will be reachable under
	UnixSocket string
	// LXDSocket where LXD is reachable under
	LXDSocket string
	// LXDRemoteConfig file path where lxd remote settings are stored
	LXDRemoteConfig string
	// LXDImageRemote to use by default when ImageSpec doesn't provide an explicit remote
	LXDImageRemote string
	// LXDProfiles which all cri containers inherit
	LXDProfiles []string
	// LXDBridgeName is the name of the bridge to create and use
	LXDBridgeName string
	// LXDBridgeDHCPRange to configure for bridge if NetworkPlugin is default
	LXDBridgeDHCPRange string
	// LXEStreamingBindAddr contains the listen address for the streaming server
	LXEStreamingBindAddr string
	// LXEStreamingBaseURL is the base address for constructing streaming URLs
	LXEStreamingBaseURL string
	// LXEHostnetworkFile file path to use for lxc's raw.include
	LXEHostnetworkFile string
	// Which LXENetworkPlugin to use
	LXENetworkPlugin string
	// CNIConfDir is the path where the cni configuration files are
	CNIConfDir string
	// CNIBinDir is the path where the cni plugins are
	CNIBinDir string
	// CNIOutputWriter is the writer for CNI call outputs
	CNIOutputTarget string
	// CNIOutputFile is the path to a file
	CNIOutputFile string
	// CRITest mode that enables rewriting of requested images as cri-tools only refer to OCI-images
	CRITest bool
}

Config options that LXE will need to interface with LXD

type ImageServer

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

ImageServer is the PoC implementation of the CRI ImageServer

func NewImageServer

func NewImageServer(s *RuntimeServer, lxf lxf.Client) (*ImageServer, error)

NewImageServer returns a new ImageServer backed by LXD we only need one connection — until we start distinguishing runtime & image service

func (ImageServer) ImageFsInfo

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

func (ImageServer) ImageStatus

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

func (ImageServer) ListImages

ListImages lists existing images.

func (ImageServer) PullImage

PullImage pulls an image with authentication config.

func (ImageServer) RemoveImage

RemoveImage removes the image. This call is idempotent, and must not return an error if the image has already been removed.

type RuntimeServer

type RuntimeServer struct {
	rtApi.RuntimeServiceServer
	// contains filtered or unexported fields
}

RuntimeServer is the PoC implementation of the CRI RuntimeServer

func NewRuntimeServer

func NewRuntimeServer(criConfig *Config, lxf lxf.Client, network network.Plugin) (*RuntimeServer, error)

NewRuntimeServer returns a new RuntimeServer backed by LXD

func (RuntimeServer) Attach

Attach prepares a streaming endpoint to attach to a running container.

func (RuntimeServer) ContainerStarted

func (s RuntimeServer) ContainerStarted(c *lxf.Container) error

ContainerStarted implements lxf.EventHandler interface

func (RuntimeServer) ContainerStats

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

func (RuntimeServer) ContainerStatus

ContainerStatus returns status of the container. If the container is not present, returns an error.

func (*RuntimeServer) ContainerStopped

func (s *RuntimeServer) ContainerStopped(c *lxf.Container) error

ContainerStopped implements lxf.EventHandler interface

func (RuntimeServer) CreateContainer

CreateContainer creates a new container in specified PodSandbox

func (RuntimeServer) Exec

Exec prepares a streaming endpoint to execute a command in the container.

func (RuntimeServer) ExecSync

ExecSync runs a command in a container synchronously.

func (RuntimeServer) ListContainerStats

ListContainerStats returns stats of all running containers.

func (RuntimeServer) ListContainers

ListContainers lists all containers by filters.

func (RuntimeServer) ListPodSandbox

ListPodSandbox returns a list of PodSandboxes.

func (RuntimeServer) PodSandboxStatus

PodSandboxStatus returns the status of the PodSandbox. If the PodSandbox is not present, returns an error.

func (RuntimeServer) PortForward

func (s RuntimeServer) PortForward(ctx context.Context, req *rtApi.PortForwardRequest) (resp *rtApi.PortForwardResponse, err error)

PortForward prepares a streaming endpoint to forward ports from a PodSandbox.

func (RuntimeServer) RemoveContainer

RemoveContainer removes the container. If the container is running, the container must be forcibly removed. This call is idempotent, and must not return an error if the container has already been removed. nolint: dupl

func (RuntimeServer) RemovePodSandbox

RemovePodSandbox removes the sandbox. This is pretty much the same as StopPodSandbox but also removes the sandbox and the containers

func (RuntimeServer) 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 (RuntimeServer) RunPodSandbox

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

func (RuntimeServer) StartContainer

StartContainer starts the container.

func (RuntimeServer) Status

Status returns the status of the runtime.

func (RuntimeServer) StopContainer

StopContainer stops a running container with a grace period (i.e., timeout). This call is idempotent, and must not return an error if the container has already been stopped.

func (RuntimeServer) StopPodSandbox

StopPodSandbox stops any running process that is part of the sandbox and reclaims network resources (e.g. IP addresses) allocated to the sandbox. If there are any running containers in the sandbox, they must be forcibly terminated. This call is idempotent, and must not return an error if all relevant resources have already been reclaimed. kubelet will call StopPodSandbox at least once before calling RemovePodSandbox. It will also attempt to reclaim resources eagerly, as soon as a sandbox is not needed. Hence, multiple StopPodSandbox calls are expected.

func (RuntimeServer) UpdateContainerResources

UpdateContainerResources updates ContainerConfig of the container.

func (RuntimeServer) UpdateRuntimeConfig

UpdateRuntimeConfig updates the runtime configuration based on the given request.

func (RuntimeServer) Version

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

type Server

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

Server implements the kubernetes CRI interface specification

func NewServer

func NewServer(criConfig *Config) *Server

NewServer creates the CRI server

func (*Server) Serve

func (c *Server) Serve() error

Serve creates the cri socket and wraps for grpc.Serve

func (*Server) Stop

func (c *Server) Stop() error

Stop stops the cri socket

type SilentError added in v0.4.1

type SilentError struct {
	AnnotatedError
}

Some errors should not be logged, so we can differentiate that by type

Directories

Path Synopsis
Offer compatibility with CRI interface v1alpha2 Use unsafe Pointer as cri-o did: https://github.com/cri-o/cri-o/commit/96679844e96b9235813580215325ca5f0a0a27a6 nolint: nlreturn
Offer compatibility with CRI interface v1alpha2 Use unsafe Pointer as cri-o did: https://github.com/cri-o/cri-o/commit/96679844e96b9235813580215325ca5f0a0a27a6 nolint: nlreturn

Jump to

Keyboard shortcuts

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