criutil

package
v0.0.0-...-93bbcbf Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Overview

Package criutil contains utility functions for interacting with the Container Runtime Interface (CRI), principally via the crictl command line tool. This requires critools to be installed on the local system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolvePath

func ResolvePath(executable string) string

ResolvePath attempts to find binary paths. It may set the path to invalid, which will cause the execution to fail with a sensible error.

Types

type Crictl

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

Crictl contains information required to run the crictl utility.

func NewCrictl

func NewCrictl(logger testutil.Logger, endpoint string) *Crictl

NewCrictl returns a Crictl configured with a timeout and an endpoint over which it will talk to containerd.

func (*Crictl) CleanUp

func (cc *Crictl) CleanUp()

CleanUp executes cleanup functions.

func (*Crictl) Create

func (cc *Crictl) Create(podID, contSpecFile, sbSpecFile string) (string, error)

Create creates a container within a sandbox. It corresponds to `crictl create`.

func (*Crictl) Exec

func (cc *Crictl) Exec(contID string, args ...string) (string, error)

Exec execs a program inside a container. It corresponds to `crictl exec`.

func (*Crictl) Import

func (cc *Crictl) Import(image string) error

Import imports the given container from the local Docker instance.

func (*Crictl) Logs

func (cc *Crictl) Logs(contID string, args ...string) (string, error)

Logs retrieves the container logs. It corresponds to `crictl logs`.

func (*Crictl) PodIP

func (cc *Crictl) PodIP(podID string) (string, error)

PodIP returns a pod's IP address.

func (*Crictl) Rm

func (cc *Crictl) Rm(contID string) error

Rm removes a container. It corresponds to `crictl rm`.

func (*Crictl) RmPod

func (cc *Crictl) RmPod(podID string) error

RmPod removes a container. It corresponds to `crictl rmp`.

func (*Crictl) RunPod

func (cc *Crictl) RunPod(runtime, sbSpecFile string) (string, error)

RunPod creates a sandbox. It corresponds to `crictl runp`.

func (*Crictl) Start

func (cc *Crictl) Start(contID string) (string, error)

Start starts a container. It corresponds to `crictl start`.

func (*Crictl) StartContainer

func (cc *Crictl) StartContainer(podID, image, sbSpec, contSpec string) (string, error)

StartContainer pulls the given image ands starts the container in the sandbox with the given podID.

Note that the image will always be imported from the local docker daemon.

func (*Crictl) StartPodAndContainer

func (cc *Crictl) StartPodAndContainer(runtime, image, sbSpec, contSpec string) (string, string, error)

StartPodAndContainer starts a sandbox and container in that sandbox. It returns the pod ID and container ID.

func (*Crictl) Stop

func (cc *Crictl) Stop(contID string) error

Stop stops a container. It corresponds to `crictl stop`.

func (*Crictl) StopContainer

func (cc *Crictl) StopContainer(contID string) error

StopContainer stops and deletes the container with the given container ID.

func (*Crictl) StopPod

func (cc *Crictl) StopPod(podID string) error

StopPod stops a pod. It corresponds to `crictl stopp`.

func (*Crictl) StopPodAndContainer

func (cc *Crictl) StopPodAndContainer(podID, contID string) error

StopPodAndContainer stops a container and pod.

Jump to

Keyboard shortcuts

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