utils

package
v0.9.306 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RUNTIME_PATTERN = "io.containerd.(.*).v[0-9]+"

	// The runtime may instead be a path to a shim binary, e.g. for containers
	// created by cedana, which use the cedana shim as the container's runtime
	SHIM_BINARY_PATTERN = "(?:containerd|cedana)-shim-(.*)-v[0-9]+$"
)

Variables

View Source
var WRAPPER_RUNTIME_BINARIES = map[string]string{
	"nvidia-container-runtime": "runc",
}

Some runtime binaries are thin wrappers around another runtime, and their containers are handled by the wrapped runtime's plugin. E.g. the (legacy) nvidia-container-runtime just injects NVIDIA's prestart hook into the spec and execs runc, so its containers are runc containers.

Functions

func NamespaceFromRoot

func NamespaceFromRoot(root string) string

Extract the namespace from the root path E.g. /run/containerd/runc/default -> default

func PluginForContainer added in v0.9.303

func PluginForContainer(ctx context.Context, client *containerd.Client, id string) (plugin string, runtime string, binary string, err error)

PluginForContainer returns the plugin that handles the container's runtime, alongside the runtime name and the runtime binary (if a custom one is set). Unlike PluginForRuntime, it inspects the container's runtime options, since runtimes like crun run under the same shim as runc (io.containerd.runc.v2) with just a different binary name.

func PluginForRuntime

func PluginForRuntime(runtime string) string

E.g. io.containerd.runc.v2 -> runc, /usr/local/bin/cedana-shim-runc-v2 -> runc

func PluginForRuntimeBinary added in v0.9.303

func PluginForRuntimeBinary(runtime string, binary string) string

PluginForRuntimeBinary returns the plugin that handles the given runtime and runtime binary combination (e.g. io.containerd.runc.v2 + crun -> crun).

func RootFromPlugin

func RootFromPlugin(plugin, namespace string) string

Get the root runtime directory for the plugin in namespace (e.g. runc) E.g. /run/containerd/runc/default

func RootFromRuntime added in v0.9.278

func RootFromRuntime(runtime, namespace string) string

Get the root runtime directory for the runtime in namespace (e.g. io.containerd.runc.v2) E.g. /run/containerd/runc/default

func Runtime added in v0.9.278

func Runtime(container *containerd_proto.Containerd) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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