cri

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetworkPluginDefault = ""
	NetworkPluginCNI     = "cni"
)

NetworkPlugin defines how the pod network should be setup. NetworkPluginDefault 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")
)

Functions

func CompareFilterMap

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

CompareFilterMap allows comparing two string maps

Types

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
	// LXEStreamingServerEndpoint contains the listen address for the streaming server
	LXEStreamingServerEndpoint string
	// LXEStreamingPort is the port for the streaming server
	LXEStreamingPort int
	// LXEHostnetworkFile file path to use for lxc's raw.include
	LXEHostnetworkFile string
	// Which LXENetworkPlugin to use
	LXENetworkPlugin string
	// LXEBridgeName is the name of the bridge to create and use
	LXEBridgeName string
	// LXEBridgeDHCPRange to configure for lxebr0 if NetworkPlugin is default
	LXEBridgeDHCPRange string
	// CNIConfDir is the path where the cni configuration files are
	CNIConfDir string
	// CNIBinDir is the path where the cni plugins are
	CNIBinDir string
}

Config options that LXE will need to interface with LXD

type Daemon

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

A Daemon can respond to requests from a shared client.

func NewDaemon

func NewDaemon(criConfig *Config) *Daemon

NewDaemon returns a new Daemon object with the given configuration.

func (*Daemon) Init

func (d *Daemon) Init() error

Init the daemon

func (*Daemon) Kill

func (d *Daemon) Kill()

Kill signals the daemon that we want to shutdown, and that any work initiated from this point (e.g. database queries over gRPC) should not be retried in case of failure.

func (*Daemon) Stop

func (d *Daemon) Stop() error

Stop stops the shared daemon.

type ImageServer

type ImageServer struct {
	rtApi.ImageServiceServer
	// 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(ctx context.Context, 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(ctx context.Context, 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. nolint: dupl

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

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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