Documentation ¶
Index ¶
- Constants
- Variables
- func AnnErr(log *logrus.Entry, code codes.Code, err error, msg string) error
- func CompareFilterMap(base map[string]string, filter map[string]string) bool
- func SilErr(log *logrus.Entry, code codes.Code, err error, msg string) error
- type AnnotatedError
- type Config
- type ImageServer
- func (s ImageServer) ImageFsInfo(ctx context.Context, req *rtApi.ImageFsInfoRequest) (*rtApi.ImageFsInfoResponse, error)
- func (s ImageServer) ImageStatus(ctx context.Context, req *rtApi.ImageStatusRequest) (*rtApi.ImageStatusResponse, error)
- func (s ImageServer) ListImages(ctx context.Context, req *rtApi.ListImagesRequest) (*rtApi.ListImagesResponse, error)
- func (s ImageServer) PullImage(ctx context.Context, req *rtApi.PullImageRequest) (*rtApi.PullImageResponse, error)
- func (s ImageServer) RemoveImage(ctx context.Context, req *rtApi.RemoveImageRequest) (*rtApi.RemoveImageResponse, error)
- type RuntimeServer
- func (s RuntimeServer) Attach(ctx context.Context, req *rtApi.AttachRequest) (*rtApi.AttachResponse, error)
- func (s RuntimeServer) ContainerStarted(c *lxf.Container) error
- func (s RuntimeServer) ContainerStats(ctx context.Context, req *rtApi.ContainerStatsRequest) (*rtApi.ContainerStatsResponse, error)
- func (s RuntimeServer) ContainerStatus(ctx context.Context, req *rtApi.ContainerStatusRequest) (*rtApi.ContainerStatusResponse, error)
- func (s *RuntimeServer) ContainerStopped(c *lxf.Container) error
- func (s RuntimeServer) CreateContainer(ctx context.Context, req *rtApi.CreateContainerRequest) (*rtApi.CreateContainerResponse, error)
- func (s RuntimeServer) Exec(ctx context.Context, req *rtApi.ExecRequest) (*rtApi.ExecResponse, error)
- func (s RuntimeServer) ExecSync(ctx context.Context, req *rtApi.ExecSyncRequest) (*rtApi.ExecSyncResponse, error)
- func (s RuntimeServer) ListContainerStats(ctx context.Context, req *rtApi.ListContainerStatsRequest) (*rtApi.ListContainerStatsResponse, error)
- func (s RuntimeServer) ListContainers(ctx context.Context, req *rtApi.ListContainersRequest) (*rtApi.ListContainersResponse, error)
- func (s RuntimeServer) ListPodSandbox(ctx context.Context, req *rtApi.ListPodSandboxRequest) (*rtApi.ListPodSandboxResponse, error)
- func (s RuntimeServer) PodSandboxStatus(ctx context.Context, req *rtApi.PodSandboxStatusRequest) (*rtApi.PodSandboxStatusResponse, error)
- func (s RuntimeServer) PortForward(ctx context.Context, req *rtApi.PortForwardRequest) (resp *rtApi.PortForwardResponse, err error)
- func (s RuntimeServer) RemoveContainer(ctx context.Context, req *rtApi.RemoveContainerRequest) (*rtApi.RemoveContainerResponse, error)
- func (s RuntimeServer) RemovePodSandbox(ctx context.Context, req *rtApi.RemovePodSandboxRequest) (*rtApi.RemovePodSandboxResponse, error)
- func (s RuntimeServer) ReopenContainerLog(ctx context.Context, req *rtApi.ReopenContainerLogRequest) (*rtApi.ReopenContainerLogResponse, error)
- func (s RuntimeServer) RunPodSandbox(ctx context.Context, req *rtApi.RunPodSandboxRequest) (*rtApi.RunPodSandboxResponse, error)
- func (s RuntimeServer) StartContainer(ctx context.Context, req *rtApi.StartContainerRequest) (*rtApi.StartContainerResponse, error)
- func (s RuntimeServer) Status(ctx context.Context, req *rtApi.StatusRequest) (*rtApi.StatusResponse, error)
- func (s RuntimeServer) StopContainer(ctx context.Context, req *rtApi.StopContainerRequest) (*rtApi.StopContainerResponse, error)
- func (s RuntimeServer) StopPodSandbox(ctx context.Context, req *rtApi.StopPodSandboxRequest) (*rtApi.StopPodSandboxResponse, error)
- func (s RuntimeServer) UpdateContainerResources(ctx context.Context, req *rtApi.UpdateContainerResourcesRequest) (*rtApi.UpdateContainerResourcesResponse, error)
- func (s RuntimeServer) UpdateRuntimeConfig(ctx context.Context, req *rtApi.UpdateRuntimeConfigRequest) (*rtApi.UpdateRuntimeConfigResponse, error)
- func (s RuntimeServer) Version(ctx context.Context, req *rtApi.VersionRequest) (*rtApi.VersionResponse, error)
- type Server
- type SilentError
Constants ¶
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
const Domain = "lxe"
Domain of the daemon
Variables ¶
var ( ErrNotImplemented = errors.New("not implemented") ErrUnknownNetworkPlugin = errors.New("unknown network plugin") )
var (
ErrDetectDefault = errors.New("unable to detect default")
)
var (
ErrTimeout = errors.New("timeout error")
)
var NetworkSetupTimeout = 30 * time.Second
Functions ¶
func CompareFilterMap ¶
CompareFilterMap allows comparing two string maps
Types ¶
type AnnotatedError ¶ added in v0.4.1
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 ¶
func (s ImageServer) ImageFsInfo(ctx context.Context, req *rtApi.ImageFsInfoRequest) (*rtApi.ImageFsInfoResponse, error)
ImageFsInfo returns information of the filesystem that is used to store images.
func (ImageServer) ImageStatus ¶
func (s ImageServer) ImageStatus(ctx context.Context, req *rtApi.ImageStatusRequest) (*rtApi.ImageStatusResponse, error)
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 ¶
func (s ImageServer) ListImages(ctx context.Context, req *rtApi.ListImagesRequest) (*rtApi.ListImagesResponse, error)
ListImages lists existing images.
func (ImageServer) PullImage ¶
func (s ImageServer) PullImage(ctx context.Context, req *rtApi.PullImageRequest) (*rtApi.PullImageResponse, error)
PullImage pulls an image with authentication config.
func (ImageServer) RemoveImage ¶
func (s ImageServer) RemoveImage(ctx context.Context, req *rtApi.RemoveImageRequest) (*rtApi.RemoveImageResponse, error)
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 ¶
func (s RuntimeServer) Attach(ctx context.Context, req *rtApi.AttachRequest) (*rtApi.AttachResponse, error)
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 ¶
func (s RuntimeServer) ContainerStats(ctx context.Context, req *rtApi.ContainerStatsRequest) (*rtApi.ContainerStatsResponse, error)
ContainerStats returns stats of the container. If the container does not exist, the call returns an error.
func (RuntimeServer) ContainerStatus ¶
func (s RuntimeServer) ContainerStatus(ctx context.Context, req *rtApi.ContainerStatusRequest) (*rtApi.ContainerStatusResponse, error)
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 ¶
func (s RuntimeServer) CreateContainer(ctx context.Context, req *rtApi.CreateContainerRequest) (*rtApi.CreateContainerResponse, error)
CreateContainer creates a new container in specified PodSandbox
func (RuntimeServer) Exec ¶
func (s RuntimeServer) Exec(ctx context.Context, req *rtApi.ExecRequest) (*rtApi.ExecResponse, error)
Exec prepares a streaming endpoint to execute a command in the container.
func (RuntimeServer) ExecSync ¶
func (s RuntimeServer) ExecSync(ctx context.Context, req *rtApi.ExecSyncRequest) (*rtApi.ExecSyncResponse, error)
ExecSync runs a command in a container synchronously.
func (RuntimeServer) ListContainerStats ¶
func (s RuntimeServer) ListContainerStats(ctx context.Context, req *rtApi.ListContainerStatsRequest) (*rtApi.ListContainerStatsResponse, error)
ListContainerStats returns stats of all running containers.
func (RuntimeServer) ListContainers ¶
func (s RuntimeServer) ListContainers(ctx context.Context, req *rtApi.ListContainersRequest) (*rtApi.ListContainersResponse, error)
ListContainers lists all containers by filters.
func (RuntimeServer) ListPodSandbox ¶
func (s RuntimeServer) ListPodSandbox(ctx context.Context, req *rtApi.ListPodSandboxRequest) (*rtApi.ListPodSandboxResponse, error)
ListPodSandbox returns a list of PodSandboxes.
func (RuntimeServer) PodSandboxStatus ¶
func (s RuntimeServer) PodSandboxStatus(ctx context.Context, req *rtApi.PodSandboxStatusRequest) (*rtApi.PodSandboxStatusResponse, error)
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 ¶
func (s RuntimeServer) RemoveContainer(ctx context.Context, req *rtApi.RemoveContainerRequest) (*rtApi.RemoveContainerResponse, error)
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 ¶
func (s RuntimeServer) RemovePodSandbox(ctx context.Context, req *rtApi.RemovePodSandboxRequest) (*rtApi.RemovePodSandboxResponse, error)
RemovePodSandbox removes the sandbox. This is pretty much the same as StopPodSandbox but also removes the sandbox and the containers
func (RuntimeServer) ReopenContainerLog ¶
func (s RuntimeServer) ReopenContainerLog(ctx context.Context, req *rtApi.ReopenContainerLogRequest) (*rtApi.ReopenContainerLogResponse, error)
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 ¶
func (s RuntimeServer) RunPodSandbox(ctx context.Context, req *rtApi.RunPodSandboxRequest) (*rtApi.RunPodSandboxResponse, error)
RunPodSandbox creates and starts a pod-level sandbox. Runtimes must ensure the sandbox is in the ready state on success
func (RuntimeServer) StartContainer ¶
func (s RuntimeServer) StartContainer(ctx context.Context, req *rtApi.StartContainerRequest) (*rtApi.StartContainerResponse, error)
StartContainer starts the container.
func (RuntimeServer) Status ¶
func (s RuntimeServer) Status(ctx context.Context, req *rtApi.StatusRequest) (*rtApi.StatusResponse, error)
Status returns the status of the runtime.
func (RuntimeServer) StopContainer ¶
func (s RuntimeServer) StopContainer(ctx context.Context, req *rtApi.StopContainerRequest) (*rtApi.StopContainerResponse, error)
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 ¶
func (s RuntimeServer) StopPodSandbox(ctx context.Context, req *rtApi.StopPodSandboxRequest) (*rtApi.StopPodSandboxResponse, error)
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 ¶
func (s RuntimeServer) UpdateContainerResources(ctx context.Context, req *rtApi.UpdateContainerResourcesRequest) (*rtApi.UpdateContainerResourcesResponse, error)
UpdateContainerResources updates ContainerConfig of the container.
func (RuntimeServer) UpdateRuntimeConfig ¶
func (s RuntimeServer) UpdateRuntimeConfig(ctx context.Context, req *rtApi.UpdateRuntimeConfigRequest) (*rtApi.UpdateRuntimeConfigResponse, error)
UpdateRuntimeConfig updates the runtime configuration based on the given request.
func (RuntimeServer) Version ¶
func (s RuntimeServer) Version(ctx context.Context, req *rtApi.VersionRequest) (*rtApi.VersionResponse, error)
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
type SilentError ¶ added in v0.4.1
type SilentError struct {
AnnotatedError
}
Some errors should not be logged, so we can differentiate that by type
Source Files ¶
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 |