cri

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package cri provides minimal CRI client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a lightweight implementation of CRI client.

func NewClient

func NewClient(endpoint string, connectionTimeout time.Duration) (*Client, error)

NewClient builds CRI client.

func (*Client) Close

func (c *Client) Close() error

Close connection.

func (*Client) ContainerStats

func (c *Client) ContainerStats(ctx context.Context, containerID string) (*runtimeapi.ContainerStats, error)

ContainerStats returns the stats of the container.

func (*Client) ContainerStatus

func (c *Client) ContainerStatus(ctx context.Context, containerID string, verbose bool) (*runtimeapi.ContainerStatus, map[string]string, error)

ContainerStatus returns the container status.

func (*Client) CreateContainer

func (c *Client) CreateContainer(ctx context.Context, podSandBoxID string, config *runtimeapi.ContainerConfig, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error)

CreateContainer creates a new container in the specified PodSandbox.

func (*Client) ImageStatus

func (c *Client) ImageStatus(ctx context.Context, image *runtimeapi.ImageSpec) (*runtimeapi.Image, error)

ImageStatus returns the status of the image.

func (*Client) ListContainerStats

func (c *Client) ListContainerStats(ctx context.Context, filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error)

ListContainerStats returns stats for all the containers matching the filter.

func (*Client) ListContainers

func (c *Client) ListContainers(ctx context.Context, filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error)

ListContainers lists containers by filters.

func (*Client) ListImages

func (c *Client) ListImages(ctx context.Context, filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error)

ListImages lists available images.

func (*Client) ListPodSandbox

func (c *Client) ListPodSandbox(ctx context.Context, filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)

ListPodSandbox returns a list of PodSandboxes.

func (*Client) PodSandboxStatus

func (c *Client) PodSandboxStatus(ctx context.Context, podSandBoxID string) (*runtimeapi.PodSandboxStatus, map[string]string, error)

PodSandboxStatus returns the status of the PodSandbox.

func (*Client) PullImage

func (c *Client) PullImage(ctx context.Context, image *runtimeapi.ImageSpec, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error)

PullImage pulls container image.

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(ctx context.Context, containerID string) error

RemoveContainer removes the container. If the container is running, the container should be forced to removal.

func (*Client) RemovePodSandbox

func (c *Client) RemovePodSandbox(ctx context.Context, podSandBoxID string) error

RemovePodSandbox removes the sandbox. If there are any containers in the sandbox, they should be forcibly removed.

func (*Client) RunPodSandbox

func (c *Client) RunPodSandbox(ctx context.Context, config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)

RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure the sandbox is in ready state.

func (*Client) StartContainer

func (c *Client) StartContainer(ctx context.Context, containerID string) error

StartContainer starts the container.

func (*Client) StopAndRemovePodSandboxes

func (c *Client) StopAndRemovePodSandboxes(ctx context.Context, stopAction StopAction, modes ...runtimeapi.NamespaceMode) (err error)

StopAndRemovePodSandboxes stops and removes all pods with the specified network mode. If no network mode is specified, all pods will be removed.

func (*Client) StopContainer

func (c *Client) StopContainer(ctx context.Context, containerID string, timeout int64) error

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

func (*Client) StopPodSandbox

func (c *Client) StopPodSandbox(ctx context.Context, podSandBoxID string) error

StopPodSandbox stops the sandbox. If there are any running containers in the sandbox, they should be forced to termination.

type StopAction

type StopAction int

StopAction for StopAndRemovePodSandboxes.

const (
	StopOnly StopAction = iota
	StopAndRemove
)

Stop actions.

Jump to

Keyboard shortcuts

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