Documentation ¶
Index ¶
- type CriManager
- func (c *CriManager) Attach(ctx context.Context, r *runtime.AttachRequest) (*runtime.AttachResponse, error)
- func (c *CriManager) ContainerStats(ctx context.Context, r *runtime.ContainerStatsRequest) (*runtime.ContainerStatsResponse, error)
- func (c *CriManager) ContainerStatus(ctx context.Context, r *runtime.ContainerStatusRequest) (*runtime.ContainerStatusResponse, error)
- func (c *CriManager) CreateContainer(ctx context.Context, r *runtime.CreateContainerRequest) (*runtime.CreateContainerResponse, error)
- func (c *CriManager) Exec(ctx context.Context, r *runtime.ExecRequest) (*runtime.ExecResponse, error)
- func (c *CriManager) ExecSync(ctx context.Context, r *runtime.ExecSyncRequest) (*runtime.ExecSyncResponse, error)
- func (c *CriManager) ImageFsInfo(ctx context.Context, r *runtime.ImageFsInfoRequest) (*runtime.ImageFsInfoResponse, error)
- func (c *CriManager) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (*runtime.ImageStatusResponse, error)
- func (c *CriManager) ListContainerStats(ctx context.Context, r *runtime.ListContainerStatsRequest) (*runtime.ListContainerStatsResponse, error)
- func (c *CriManager) ListContainers(ctx context.Context, r *runtime.ListContainersRequest) (*runtime.ListContainersResponse, error)
- func (c *CriManager) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error)
- func (c *CriManager) ListPodSandbox(ctx context.Context, r *runtime.ListPodSandboxRequest) (*runtime.ListPodSandboxResponse, error)
- func (c *CriManager) PauseContainer(ctx context.Context, r *runtime.PauseContainerRequest) (*runtime.PauseContainerResponse, error)
- func (c *CriManager) PodSandboxStatus(ctx context.Context, r *runtime.PodSandboxStatusRequest) (*runtime.PodSandboxStatusResponse, error)
- func (c *CriManager) PortForward(ctx context.Context, r *runtime.PortForwardRequest) (*runtime.PortForwardResponse, error)
- func (c *CriManager) PullImage(ctx context.Context, r *runtime.PullImageRequest) (*runtime.PullImageResponse, error)
- func (c *CriManager) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) (*runtime.RemoveContainerResponse, error)
- func (c *CriManager) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) (*runtime.RemoveImageResponse, error)
- func (c *CriManager) RemovePodSandbox(ctx context.Context, r *runtime.RemovePodSandboxRequest) (*runtime.RemovePodSandboxResponse, error)
- func (c *CriManager) RemoveVolume(ctx context.Context, r *runtime.RemoveVolumeRequest) (*runtime.RemoveVolumeResponse, error)
- func (c *CriManager) ReopenContainerLog(ctx context.Context, r *runtime.ReopenContainerLogRequest) (*runtime.ReopenContainerLogResponse, error)
- func (c *CriManager) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (_ *runtime.RunPodSandboxResponse, retErr error)
- func (c *CriManager) StartContainer(ctx context.Context, r *runtime.StartContainerRequest) (*runtime.StartContainerResponse, error)
- func (c *CriManager) StartPodSandbox(ctx context.Context, r *runtime.StartPodSandboxRequest) (_ *runtime.StartPodSandboxResponse, retErr error)
- func (c *CriManager) Status(ctx context.Context, r *runtime.StatusRequest) (*runtime.StatusResponse, error)
- func (c *CriManager) StopContainer(ctx context.Context, r *runtime.StopContainerRequest) (*runtime.StopContainerResponse, error)
- func (c *CriManager) StopPodSandbox(ctx context.Context, r *runtime.StopPodSandboxRequest) (*runtime.StopPodSandboxResponse, error)
- func (c *CriManager) StreamRouter() stream.Router
- func (c *CriManager) StreamServerStart() error
- func (c *CriManager) UnpauseContainer(ctx context.Context, r *runtime.UnpauseContainerRequest) (*runtime.UnpauseContainerResponse, error)
- func (c *CriManager) UpdateContainerResources(ctx context.Context, r *runtime.UpdateContainerResourcesRequest) (*runtime.UpdateContainerResourcesResponse, error)
- func (c *CriManager) UpdateRuntimeConfig(ctx context.Context, r *runtime.UpdateRuntimeConfigRequest) (*runtime.UpdateRuntimeConfigResponse, error)
- func (c *CriManager) Version(ctx context.Context, r *runtime.VersionRequest) (*runtime.VersionResponse, error)
- type CriMgr
- type Service
- type StreamServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CriManager ¶
type CriManager struct { ContainerMgr mgr.ContainerMgr ImageMgr mgr.ImageMgr VolumeMgr mgr.VolumeMgr CniMgr cni.CniMgr CriPlugin hookplugins.CriPlugin // StreamServer is the stream server of CRI serves container streaming request. StreamServer StreamServer // SandboxBaseDir is the directory used to store sandbox files like /etc/hosts, /etc/resolv.conf, etc. SandboxBaseDir string // SandboxImage is the image used by sandbox container. SandboxImage string // SandboxStore stores the configuration of sandboxes. SandboxStore *meta.Store // SnapshotStore stores information of all snapshots. SnapshotStore *mgr.SnapshotStore // DaemonConfig is the config of daemon DaemonConfig *config.Config // contains filtered or unexported fields }
CriManager is an implementation of interface CriMgr.
func (*CriManager) Attach ¶
func (c *CriManager) Attach(ctx context.Context, r *runtime.AttachRequest) (*runtime.AttachResponse, error)
Attach prepares a streaming endpoint to attach to a running container, and returns the address.
func (*CriManager) ContainerStats ¶
func (c *CriManager) ContainerStats(ctx context.Context, r *runtime.ContainerStatsRequest) (*runtime.ContainerStatsResponse, error)
ContainerStats returns stats of the container. If the container does not exist, the call returns an error.
func (*CriManager) ContainerStatus ¶
func (c *CriManager) ContainerStatus(ctx context.Context, r *runtime.ContainerStatusRequest) (*runtime.ContainerStatusResponse, error)
ContainerStatus inspects the container and returns the status.
func (*CriManager) CreateContainer ¶
func (c *CriManager) CreateContainer(ctx context.Context, r *runtime.CreateContainerRequest) (*runtime.CreateContainerResponse, error)
CreateContainer creates a new container in the given PodSandbox.
func (*CriManager) Exec ¶
func (c *CriManager) Exec(ctx context.Context, r *runtime.ExecRequest) (*runtime.ExecResponse, error)
Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
func (*CriManager) ExecSync ¶
func (c *CriManager) ExecSync(ctx context.Context, r *runtime.ExecSyncRequest) (*runtime.ExecSyncResponse, error)
ExecSync executes a command in the container, and returns the stdout output. If command exits with a non-zero exit code, an error is returned.
func (*CriManager) ImageFsInfo ¶
func (c *CriManager) ImageFsInfo(ctx context.Context, r *runtime.ImageFsInfoRequest) (*runtime.ImageFsInfoResponse, error)
ImageFsInfo returns information of the filesystem that is used to store images.
func (*CriManager) ImageStatus ¶
func (c *CriManager) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (*runtime.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 (*CriManager) ListContainerStats ¶
func (c *CriManager) ListContainerStats(ctx context.Context, r *runtime.ListContainerStatsRequest) (*runtime.ListContainerStatsResponse, error)
ListContainerStats returns stats of all running containers.
func (*CriManager) ListContainers ¶
func (c *CriManager) ListContainers(ctx context.Context, r *runtime.ListContainersRequest) (*runtime.ListContainersResponse, error)
ListContainers lists all containers matching the filter.
func (*CriManager) ListImages ¶
func (c *CriManager) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error)
ListImages lists existing images.
func (*CriManager) ListPodSandbox ¶
func (c *CriManager) ListPodSandbox(ctx context.Context, r *runtime.ListPodSandboxRequest) (*runtime.ListPodSandboxResponse, error)
ListPodSandbox returns a list of Sandbox.
func (*CriManager) PauseContainer ¶
func (c *CriManager) PauseContainer(ctx context.Context, r *runtime.PauseContainerRequest) (*runtime.PauseContainerResponse, error)
PauseContainer pauses the container.
func (*CriManager) PodSandboxStatus ¶
func (c *CriManager) PodSandboxStatus(ctx context.Context, r *runtime.PodSandboxStatusRequest) (*runtime.PodSandboxStatusResponse, error)
PodSandboxStatus returns the status of the PodSandbox.
func (*CriManager) PortForward ¶
func (c *CriManager) PortForward(ctx context.Context, r *runtime.PortForwardRequest) (*runtime.PortForwardResponse, error)
PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
func (*CriManager) PullImage ¶
func (c *CriManager) PullImage(ctx context.Context, r *runtime.PullImageRequest) (*runtime.PullImageResponse, error)
PullImage pulls an image with authentication config.
func (*CriManager) RemoveContainer ¶
func (c *CriManager) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) (*runtime.RemoveContainerResponse, error)
RemoveContainer removes the container.
func (*CriManager) RemoveImage ¶
func (c *CriManager) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) (*runtime.RemoveImageResponse, error)
RemoveImage removes the image.
func (*CriManager) RemovePodSandbox ¶
func (c *CriManager) RemovePodSandbox(ctx context.Context, r *runtime.RemovePodSandboxRequest) (*runtime.RemovePodSandboxResponse, error)
RemovePodSandbox removes the sandbox. If there are running containers in the sandbox, they should be forcibly removed.
func (*CriManager) RemoveVolume ¶
func (c *CriManager) RemoveVolume(ctx context.Context, r *runtime.RemoveVolumeRequest) (*runtime.RemoveVolumeResponse, error)
RemoveVolume removes the volume.
func (*CriManager) ReopenContainerLog ¶
func (c *CriManager) ReopenContainerLog(ctx context.Context, r *runtime.ReopenContainerLogRequest) (*runtime.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 (*CriManager) RunPodSandbox ¶
func (c *CriManager) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (_ *runtime.RunPodSandboxResponse, retErr error)
RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure the sandbox is in ready state.
func (*CriManager) StartContainer ¶
func (c *CriManager) StartContainer(ctx context.Context, r *runtime.StartContainerRequest) (*runtime.StartContainerResponse, error)
StartContainer starts the container.
func (*CriManager) StartPodSandbox ¶
func (c *CriManager) StartPodSandbox(ctx context.Context, r *runtime.StartPodSandboxRequest) (_ *runtime.StartPodSandboxResponse, retErr error)
StartPodSandbox restart a sandbox pod which was stopped by accident and we should reconfigure it with network plugin which will make sure it reacquire its original network configuration, like IP address.
func (*CriManager) Status ¶
func (c *CriManager) Status(ctx context.Context, r *runtime.StatusRequest) (*runtime.StatusResponse, error)
Status returns the status of the runtime.
func (*CriManager) StopContainer ¶
func (c *CriManager) StopContainer(ctx context.Context, r *runtime.StopContainerRequest) (*runtime.StopContainerResponse, error)
StopContainer stops a running container with a grace period (i.e., timeout).
func (*CriManager) StopPodSandbox ¶
func (c *CriManager) StopPodSandbox(ctx context.Context, r *runtime.StopPodSandboxRequest) (*runtime.StopPodSandboxResponse, error)
StopPodSandbox stops the sandbox. If there are any running containers in the sandbox, they should be forcibly terminated. notes: 1. for legacy dockershim style container, lifecycle of podNetwork is bound to container using /proc/$pid/ns/net. When stopping sandbox, we first teardown the pod network, then stop the sandbox container. 2. In newly implementation. We first create an empty netns and setup pod network inside it, which is independent from container lifecycle. When stopping sandbox, we first stop container, then teardown the pod network, which is a reverse operation of RunPodSandbox.
func (*CriManager) StreamRouter ¶
func (c *CriManager) StreamRouter() stream.Router
StreamRouter returns the router of Stream StreamServer.
func (*CriManager) StreamServerStart ¶
func (c *CriManager) StreamServerStart() error
StreamServerStart starts the stream server of CRI.
func (*CriManager) UnpauseContainer ¶
func (c *CriManager) UnpauseContainer(ctx context.Context, r *runtime.UnpauseContainerRequest) (*runtime.UnpauseContainerResponse, error)
UnpauseContainer unpauses the container.
func (*CriManager) UpdateContainerResources ¶
func (c *CriManager) UpdateContainerResources(ctx context.Context, r *runtime.UpdateContainerResourcesRequest) (*runtime.UpdateContainerResourcesResponse, error)
UpdateContainerResources updates ContainerConfig of the container.
func (*CriManager) UpdateRuntimeConfig ¶
func (c *CriManager) UpdateRuntimeConfig(ctx context.Context, r *runtime.UpdateRuntimeConfigRequest) (*runtime.UpdateRuntimeConfigResponse, error)
UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.
func (*CriManager) Version ¶
func (c *CriManager) Version(ctx context.Context, r *runtime.VersionRequest) (*runtime.VersionResponse, error)
Version returns the runtime name, runtime version and runtime API version.
type CriMgr ¶
type CriMgr interface { // RuntimeServiceServer is interface of CRI runtime service. runtime.RuntimeServiceServer // ImageServiceServer is interface of CRI image service. runtime.ImageServiceServer // VolumeServiceServer is interface of CRI volume service. runtime.VolumeServiceServer // StreamServerStart starts the stream server of CRI. StreamServerStart() error // StreamStart returns the router of Stream Server. StreamRouter() stream.Router }
CriMgr as an interface defines all operations against CRI.
func NewCriManager ¶
func NewCriManager(config *config.Config, ctrMgr mgr.ContainerMgr, imgMgr mgr.ImageMgr, volumeMgr mgr.VolumeMgr, criPlugin hookplugins.CriPlugin) (CriMgr, error)
NewCriManager creates a brand new cri manager.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service serves the kubelet runtime grpc api which will be consumed by kubelet.
func NewService ¶
NewService creates a brand new cri service.
type StreamServer ¶
type StreamServer interface { // GetExec get the serving URL for Exec request. GetExec(*runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) // GetAttach get the serving URL for Attach request. GetAttach(*runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) // GetPortForward get the serving URL for PortForward request. GetPortForward(*runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error) // Start starts the stream server. Start() error // Router is the Stream Server's handlers which we should export. stream.Router }
StreamServer as an interface defines all operations against stream server.
func NewStreamServer ¶
NewStreamServer creates a new stream server.