server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 93 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InspectConfigEndpoint     = "/config"
	InspectContainersEndpoint = "/containers"
	InspectInfoEndpoint       = "/info"
	InspectPauseEndpoint      = "/pause"
	InspectUnpauseEndpoint    = "/unpause"
	InspectGoRoutinesEndpoint = "/debug/goroutines"
	InspectHeapEndpoint       = "/debug/heap"
)
View Source
const (
	// PodInfraOOMAdj is the value that we set for oom score adj for
	// the pod infra container.
	// TODO: Remove this const once this value is provided over CRI
	// See https://github.com/kubernetes/kubernetes/issues/47938
	PodInfraOOMAdj int = -998
	// PodInfraCPUshares is default cpu shares for sandbox container.
	PodInfraCPUshares = 2
)

Variables

This section is empty.

Functions

func InitLabel

func InitLabel(cLabel string) (string, error)

InitLabel returns labels for running systemd based containers.

func KVMLabel

func KVMLabel(cLabel string) (string, error)

KVMLabel returns labels for running kvm isolated containers.

func Listen

func Listen(network, address string) (net.Listener, error)

Listen opens the network address for the server. Expects the config.Listen address.

This is a platform specific wrapper.

Types

type Server

type Server struct {
	*lib.ContainerServer

	ContainerEventsChan chan types.ContainerEventResponse
	// contains filtered or unexported fields
}

Server implements the RuntimeService and ImageService.

func New

func New(
	ctx context.Context,
	configIface libconfig.Iface,
) (*Server, error)

New creates a new Server with the provided context and configuration.

func (*Server) Attach

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

func (*Server) CheckpointContainer

CheckpointContainer checkpoints a container.

func (*Server) ContainerStats

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

func (*Server) ContainerStatus

ContainerStatus returns status of the container.

func (*Server) CreateContainer

func (s *Server) CreateContainer(ctx context.Context, req *types.CreateContainerRequest) (res *types.CreateContainerResponse, retErr error)

CreateContainer creates a new container in specified PodSandbox.

func (*Server) Exec

func (s *Server) Exec(ctx context.Context, req *types.ExecRequest) (*types.ExecResponse, error)

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

func (*Server) ExecSync

ExecSync runs a command in a container synchronously.

func (*Server) FilterDisallowedAnnotations

func (s *Server) FilterDisallowedAnnotations(toFind, toFilter map[string]string, runtimeHandler string) error

FilterDisallowedAnnotations is a common place to have a map of annotations filtered for both runtimes and workloads. This function exists until the support for runtime level allowed annotations is dropped. toFind is used to find the workload for the specific pod or container, toFilter are the annotations for which disallowed annotations will be filtered. They may be the same. After this function, toFilter will no longer container disallowed annotations.

func (*Server) GetContainerEvents

GetContainerEvents sends the stream of container events to clients.

func (*Server) GetExtendInterfaceMux

func (s *Server) GetExtendInterfaceMux(enableProfile bool) *chi.Mux

GetExtendInterfaceMux returns the mux used to serve extend interface requests.

func (*Server) ImageFsInfo

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

func (*Server) ImageStatus

ImageStatus returns the status of the image.

func (*Server) ListContainerStats

ListContainerStats returns stats of all running containers.

func (*Server) ListContainers

ListContainers lists all containers by filters.

func (*Server) ListImages

ListImages lists existing images.

func (*Server) ListMetricDescriptors

ListMetricDescriptors lists all metric descriptors.

func (*Server) ListPodSandbox

ListPodSandbox returns a list of SandBoxes.

func (*Server) ListPodSandboxMetrics

ListPodSandboxMetrics lists all pod sandbox metrics.

func (*Server) ListPodSandboxStats

ListPodSandboxStats returns stats of all sandboxes.

func (*Server) MonitorsCloseChan

func (s *Server) MonitorsCloseChan() chan struct{}

MonitorsCloseChan returns the close chan for the exit monitor.

func (*Server) PodSandboxStats

PodSandboxStats returns stats of the sandbox. If the sandbox does not exist, the call returns an error.

func (*Server) PodSandboxStatus

PodSandboxStatus returns the Status of the PodSandbox.

func (*Server) PortForward

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

func (*Server) PullImage

PullImage pulls a image with authentication config.

func (*Server) RemoveContainer

RemoveContainer removes the container. If the container is running, the container should be force removed.

func (*Server) RemoveImage

RemoveImage removes the image.

func (*Server) RemovePodSandbox

RemovePodSandbox deletes the sandbox. If there are any running containers in the sandbox, they should be force deleted.

func (*Server) ReopenContainerLog

ReopenContainerLog reopens the containers log file.

func (*Server) ReserveSandboxContainerIDAndName

func (s *Server) ReserveSandboxContainerIDAndName(config *types.PodSandboxConfig) (string, error)

func (*Server) RunPodSandbox

RunPodSandbox creates and runs a pod-level sandbox.

func (*Server) RuntimeConfig

RuntimeConfig returns configuration information of the runtime.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown attempts to shut down the server's storage cleanly.

func (*Server) StartContainer

func (s *Server) StartContainer(ctx context.Context, req *types.StartContainerRequest) (res *types.StartContainerResponse, retErr error)

StartContainer starts the container.

func (*Server) StartExitMonitor

func (s *Server) StartExitMonitor(ctx context.Context)

StartExitMonitor start a routine that monitors container exits and updates the container status.

func (*Server) Status

Status returns the status of the runtime.

func (*Server) StopContainer

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

func (*Server) StopMonitors

func (s *Server) StopMonitors()

StopMonitors stops all the monitors.

func (*Server) StopPodSandbox

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

func (*Server) StopStreamServer

func (s *Server) StopStreamServer() error

StopStreamServer stops the stream server.

func (*Server) StreamingServerCloseChan

func (s *Server) StreamingServerCloseChan() chan struct{}

StreamingServerCloseChan returns the close channel for the streaming server.

func (*Server) UpdateContainerResources

UpdateContainerResources updates ContainerConfig of the container.

func (*Server) UpdateRuntimeConfig

func (*Server) Version

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

type StreamService

type StreamService struct {
	streaming.Runtime
	// contains filtered or unexported fields
}

StreamService implements streaming.Runtime.

func (*StreamService) Attach

func (s *StreamService) Attach(ctx context.Context, containerID string, inputStream io.Reader, outputStream, errorStream io.WriteCloser, tty bool, resizeChan <-chan remotecommand.TerminalSize) error

Attach endpoint for streaming.Runtime.

func (*StreamService) Exec

func (s *StreamService) Exec(ctx context.Context, containerID string, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resizeChan <-chan remotecommand.TerminalSize) error

Exec endpoint for streaming.Runtime.

func (*StreamService) PortForward

func (s *StreamService) PortForward(ctx context.Context, podSandboxID string, port int32, stream io.ReadWriteCloser) error

Directories

Path Synopsis
Package useragent provides helper functions to pack version information into a single User-Agent header.
Package useragent provides helper functions to pack version information into a single User-Agent header.

Jump to

Keyboard shortcuts

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