server

package
v0.0.0-...-ec24d73 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: Apache-2.0 Imports: 82 Imported by: 0

Documentation

Index

Constants

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
)
View Source
const (
	// IpcNamespace is the Linux IPC namespace
	IpcNamespace = Namespace("ipc")

	// NetNamespace is the network namespace
	NetNamespace = Namespace("net")

	// UnknownNamespace is the zero value if no namespace is known
	UnknownNamespace = Namespace("")
)
View Source
const CrioConfigPath = "/etc/crio/crio.conf"

CrioConfigPath is the default location for the conf file

View Source
const CrioSocketPath = "/var/run/crio/crio.sock"

CrioSocketPath is where the unix socket is located

View Source
const CrioVersionPath = "/var/lib/crio/version"

CrioVersionPath is where the CRI-O version file is located

View Source
const (
	// DefaultGRPCMaxMsgSize is the default message size maximum for grpc APIs.
	DefaultGRPCMaxMsgSize = 16 * 1024 * 1024
)

Variables

This section is empty.

Functions

func ConvertImage

func ConvertImage(from *storage.ImageResult) *pb.Image

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 APIConfig

type APIConfig struct {
	// GRPCMaxSendMsgSize is the maximum grpc send message size in bytes.
	GRPCMaxSendMsgSize int `toml:"grpc_max_send_msg_size"`

	// GRPCMaxRecvMsgSize is the maximum grpc receive message size in bytes.
	GRPCMaxRecvMsgSize int `toml:"grpc_max_recv_msg_size"`

	// Listen is the path to the AF_LOCAL socket on which cri-o will listen.
	// This may support proto://addr formats later, but currently this is just
	// a path.
	Listen string `toml:"listen"`

	// StreamAddress is the IP address on which the stream server will listen.
	StreamAddress string `toml:"stream_address"`

	// StreamPort is the port on which the stream server will listen.
	StreamPort string `toml:"stream_port"`

	// StreamEnableTLS enables encrypted tls transport of the stream server
	StreamEnableTLS bool `toml:"stream_enable_tls"`

	// StreamTLSCert is the x509 certificate file path used to serve the encrypted stream
	StreamTLSCert string `toml:"stream_tls_cert"`

	// StreamTLSKey is the key file path used to serve the encrypted stream
	StreamTLSKey string `toml:"stream_tls_key"`

	// StreamTLSCA is the x509 CA(s) file used to verify and authenticate client
	// communication with the tls encrypted stream
	StreamTLSCA string `toml:"stream_tls_ca"`

	// HostIP is the IP address that the server uses where it needs to use the primary host IP.
	HostIP string `toml:"host_ip"`
}

APIConfig represents the "crio.api" TOML config table.

type Config

type Config struct {
	lib.Config
	APIConfig
}

Config represents the entire set of configuration values that can be set for the server. This is intended to be loaded from a toml-encoded config file.

func DefaultConfig

func DefaultConfig() (*Config, error)

DefaultConfig returns the default configuration for crio.

func (*Config) ToFile

func (c *Config) ToFile(path string) error

ToFile outputs the given Config as a TOML-encoded file at the given path. Returns errors encountered when generating or writing the file, or nil otherwise.

func (*Config) UpdateFromFile

func (c *Config) UpdateFromFile(path string) error

UpdateFromFile populates the Config from the TOML-encoded file at the given path. Returns errors encountered when reading or parsing the files, or nil otherwise.

func (*Config) Validate

func (c *Config) Validate(onExecution bool) error

Validate is the main entry point for configuration validation The parameter `onExecution` specifies if the validation should include execution checks. It returns an `error` on validation failure, otherwise `nil`.

type Namespace

type Namespace string

Namespace represents a kernel namespace name.

type SecretData

type SecretData struct {
	Name string
	Data []byte
}

SecretData info

func (SecretData) SaveTo

func (s SecretData) SaveTo(dir string) error

SaveTo saves secret data to given directory

type Server

type Server struct {
	*lib.ContainerServer
	// contains filtered or unexported fields
}

Server implements the RuntimeService and ImageService

func New

func New(ctx context.Context, config *Config) (*Server, error)

New creates a new Server with options provided

func (*Server) Attach

func (s *Server) Attach(ctx context.Context, req *pb.AttachRequest) (resp *pb.AttachResponse, err error)

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

func (*Server) ContainerStats

func (s *Server) ContainerStats(ctx context.Context, req *pb.ContainerStatsRequest) (resp *pb.ContainerStatsResponse, err error)

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

func (*Server) ContainerStatus

func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusRequest) (resp *pb.ContainerStatusResponse, err error)

ContainerStatus returns status of the container.

func (*Server) CreateContainer

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

CreateContainer creates a new container in specified PodSandbox

func (*Server) CreateMetricsEndpoint

func (s *Server) CreateMetricsEndpoint() (*http.ServeMux, error)

CreateMetricsEndpoint creates a /metrics endpoint for prometheus monitoring

func (*Server) Exec

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

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

func (*Server) ExecSync

func (s *Server) ExecSync(ctx context.Context, req *pb.ExecSyncRequest) (resp *pb.ExecSyncResponse, err error)

ExecSync runs a command in a container synchronously.

func (*Server) GetInfoMux

func (s *Server) GetInfoMux() *bone.Mux

GetInfoMux returns the mux used to serve info requests

func (*Server) ImageFsInfo

func (s *Server) ImageFsInfo(ctx context.Context, req *pb.ImageFsInfoRequest) (resp *pb.ImageFsInfoResponse, err error)

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

func (*Server) ImageStatus

func (s *Server) ImageStatus(ctx context.Context, req *pb.ImageStatusRequest) (resp *pb.ImageStatusResponse, err error)

ImageStatus returns the status of the image.

func (*Server) ListContainerStats

func (s *Server) ListContainerStats(ctx context.Context, req *pb.ListContainerStatsRequest) (resp *pb.ListContainerStatsResponse, err error)

ListContainerStats returns stats of all running containers.

func (*Server) ListContainers

func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersRequest) (resp *pb.ListContainersResponse, err error)

ListContainers lists all containers by filters.

func (*Server) ListImages

func (s *Server) ListImages(ctx context.Context, req *pb.ListImagesRequest) (resp *pb.ListImagesResponse, err error)

ListImages lists existing images.

func (*Server) ListPodSandbox

func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxRequest) (resp *pb.ListPodSandboxResponse, err error)

ListPodSandbox returns a list of SandBoxes.

func (*Server) MonitorsCloseChan

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

MonitorsCloseChan returns the close chan for the exit monitor

func (*Server) PodSandboxStatus

func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusRequest) (resp *pb.PodSandboxStatusResponse, err error)

PodSandboxStatus returns the Status of the PodSandbox.

func (*Server) PortForward

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

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

func (*Server) PullImage

func (s *Server) PullImage(ctx context.Context, req *pb.PullImageRequest) (resp *pb.PullImageResponse, err error)

PullImage pulls a image with authentication config.

func (*Server) RemoveContainer

func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerRequest) (resp *pb.RemoveContainerResponse, err error)

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

func (*Server) RemoveImage

func (s *Server) RemoveImage(ctx context.Context, req *pb.RemoveImageRequest) (resp *pb.RemoveImageResponse, err error)

RemoveImage removes the image.

func (*Server) RemovePodSandbox

func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxRequest) (resp *pb.RemovePodSandboxResponse, err error)

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

func (*Server) ReopenContainerLog

func (s *Server) ReopenContainerLog(ctx context.Context, req *pb.ReopenContainerLogRequest) (resp *pb.ReopenContainerLogResponse, err error)

ReopenContainerLog reopens the containers log file

func (*Server) RunPodSandbox

func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest) (resp *pb.RunPodSandboxResponse, err error)

RunPodSandbox creates and runs a pod-level sandbox.

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 *pb.StartContainerRequest) (resp *pb.StartContainerResponse, err error)

StartContainer starts the container.

func (*Server) StartExitMonitor

func (s *Server) StartExitMonitor()

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

func (*Server) Status

func (s *Server) Status(ctx context.Context, req *pb.StatusRequest) (resp *pb.StatusResponse, err error)

Status returns the status of the runtime

func (*Server) StopContainer

func (s *Server) StopContainer(ctx context.Context, req *pb.StopContainerRequest) (resp *pb.StopContainerResponse, err error)

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

func (*Server) StopMonitors

func (s *Server) StopMonitors()

StopMonitors stops al the monitors

func (*Server) StopPodSandbox

func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxRequest) (resp *pb.StopPodSandboxResponse, err error)

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

func (s *Server) UpdateContainerResources(ctx context.Context, req *pb.UpdateContainerResourcesRequest) (resp *pb.UpdateContainerResourcesResponse, err error)

UpdateContainerResources updates ContainerConfig of the container.

func (*Server) UpdateRuntimeConfig

func (s *Server) UpdateRuntimeConfig(ctx context.Context, req *pb.UpdateRuntimeConfigRequest) (resp *pb.UpdateRuntimeConfigResponse, err error)

UpdateRuntimeConfig updates the configuration of a running container.

func (*Server) Version

func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (resp *pb.VersionResponse, err error)

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

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