utils

package
v0.0.0-...-ba09d25 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Overview

Package utils container miscellaneous utility function used by the shim.

Index

Constants

View Source
const (

	// ContainerTypeAnnotation is they key that defines sandbox or container.
	ContainerTypeAnnotation = "io.kubernetes.cri.container-type"

	// ContainerTypeContainer is the value for container.
	ContainerTypeContainer = "container"
)

Annotations from the CRI annotations package.

These are vendor due to import conflicts.

Variables

This section is empty.

Functions

func ErrToGRPC

func ErrToGRPC(err error) error

ErrToGRPC wraps containerd's ToGRPC error mapper which depends on github.com/pkg/errors to work correctly. Once we upgrade to containerd v1.4, this function can go away and we can use errdefs.ToGRPC directly instead.

TODO(gvisor.dev/issue/6232): Remove after upgrading to containerd v1.4

func ErrToGRPCf

func ErrToGRPCf(err error, format string, args ...interface{}) error

ErrToGRPCf maps the error to grpc error codes, assembling the formatting string and combining it with the target error string.

TODO(gvisor.dev/issue/6232): Remove after upgrading to containerd v1.4

func IsSandbox

func IsSandbox(spec *specs.Spec) bool

IsSandbox checks whether a container is a sandbox container.

func ReadSpec

func ReadSpec(bundle string) (*specs.Spec, error)

ReadSpec reads OCI spec from the bundle directory.

func UpdateVolumeAnnotations

func UpdateVolumeAnnotations(s *specs.Spec) (bool, error)

UpdateVolumeAnnotations add necessary OCI annotations for gvisor volume optimization. Returns true if the spec was modified.

func UserLogPath

func UserLogPath(spec *specs.Spec) string

UserLogPath gets user log path from OCI annotation.

func WriteSpec

func WriteSpec(bundle string, spec *specs.Spec) error

WriteSpec writes OCI spec to the bundle directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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