executor

package
v0.2.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package executor provides the top-level checkpoint and restore executors. These wire together the lib packages (criu, cuda, etc.) into multi-step workflows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checkpoint

Checkpoint captures a container through PageBroker and commits its artifact. The broker owns storage publication and, when supported, CUDA CustomStorage.

func CheckpointNeedsSourceKill added in v0.2.0

func CheckpointNeedsSourceKill(err error) bool

CheckpointNeedsSourceKill reports whether a failed checkpoint may have left the source unsafe.

Types

type CheckpointRequest

type CheckpointRequest struct {
	ContainerID   string
	ContainerName string
	ContentUID    string
	StartedAt     time.Time
	NodeName      string
	PodName       string
	PodNamespace  string
	PodIP         string
	Clientset     kubernetes.Interface

	// Pod carries the image reference and limits the target container runs with, read from
	// the live pod by the caller rather than here: the capture path has no API
	// client for the pod, and the reconciler already holds it.
	Pod compat.Environment
	// CuInterposeRequested is the workload's explicit opt-in. Capture then fails unless
	// every CUDA process loaded the shim. Without it, a loaded shim is still captured.
	CuInterposeRequested bool
}

CheckpointRequest holds the content-owned inputs for a checkpoint operation.

type CleanupError

type CleanupError struct {
	Action  string `json:"action"`
	Message string `json:"message"`
}

CleanupError is the wire representation of a successful restore whose in-namespace cleanup did not fully complete.

func (*CleanupError) Error

func (e *CleanupError) Error() string

type RestoreCleanupError

type RestoreCleanupError struct {
	Err error
}

RestoreCleanupError reports a successful restore whose cleanup did not fully complete. The controller logs it, emits a warning event, and completes restore.

func NewRestoreCleanupError

func NewRestoreCleanupError(err error) *RestoreCleanupError

func (*RestoreCleanupError) Error

func (e *RestoreCleanupError) Error() string

func (*RestoreCleanupError) Unwrap

func (e *RestoreCleanupError) Unwrap() error

type RestoreInNamespaceResult

type RestoreInNamespaceResult struct {
	RestoredPID            int           `json:"restoredPID"`
	CleanupError           *CleanupError `json:"cleanupError,omitempty"`
	OverlayCaptureDuration time.Duration `json:"overlayCaptureDuration"`
	CRIUPrepareDuration    time.Duration `json:"criuPrepareDuration"`
	CRIURestoreDuration    time.Duration `json:"criuRestoreDuration"`
	CUDARestoreDuration    time.Duration `json:"cudaRestoreDuration"`
	// Error is set, with every other field empty, when nsrestore exits non-zero.
	Error string `json:"error,omitempty"`
}

func RestoreInNamespace

func RestoreInNamespace(ctx context.Context, opts RestoreOptions, log logr.Logger) (*RestoreInNamespaceResult, error)

RestoreInNamespace performs a full restore from inside the target container's namespaces.

type RestoreMounter

type RestoreMounter interface {
	MountBundle(ctx context.Context, pid int) (nsmount.MountPoint, error)
	MountCuInterpose(ctx context.Context, namespaceMount nsmount.MountPoint) (nsmount.MountPoint, error)
	MountArtifact(ctx context.Context, namespaceMount nsmount.MountPoint, artifactPath string) (nsmount.MountPoint, error)
	MountPageBroker(ctx context.Context, namespaceMount nsmount.MountPoint, stagingPath string) (nsmount.MountPoint, error)
}

RestoreMounter installs the fixed binary bundle, the cuinterpose libraries and one validated checkpoint artifact inside a placeholder container's mount namespace.

type RestoreOptions

type RestoreOptions struct {
	CustomStorageExecution *pagebroker.CustomStorageExecution
	HostProc               *os.File // Host proc remains accessible after CRIU changes mounts.
	CheckpointPath         string
	CUDADeviceMap          string
	GPUMountAliases        map[string]string
	CgroupRoot             string
	TargetPodIP            string
	// BundleDir is the path where the agent's binary bundle is mounted inside this namespace.
	BundleDir string
}

RestoreOptions holds configuration for an in-namespace restore.

type RestoreRequest

type RestoreRequest struct {
	ContentUID                  string
	BasePath                    string
	ContainerID                 string
	StartedAt                   time.Time
	PodName                     string
	PodNamespace                string
	TargetPodIP                 string
	ArtifactContainerName       string
	DestinationContainerName    string
	Clientset                   kubernetes.Interface
	CustomStorageAvailable      bool
	PageBrokerControlSocketPath string
	PageBrokerRestoreMode       string

	// Decided by the caller, so both gates reach the same answer.
	SkipCompatCheck bool
}

RestoreRequest holds the parameters for a restore operation.

type RestoreResult added in v0.2.0

type RestoreResult struct {
	// PlaceholderHostPID is the placeholder container's host PID, so callers
	// can reach into the container's mount namespace (e.g. to write sentinels
	// under /snapshot-control) without re-resolving via the runtime.
	PlaceholderHostPID int
	// RestoredPID is the restored process, relative to the container's PID
	// namespace.
	RestoredPID int
}

RestoreResult identifies the processes a successful restore leaves behind.

func Restore

func Restore(ctx context.Context, rt snapshotruntime.Runtime, log logr.Logger, req RestoreRequest, mounts RestoreMounter) (restored RestoreResult, retErr error)

Restore performs external restore for the given request. The DaemonSet side inspects the placeholder and launches nsrestore, which handles rootfs application, CRIU restore, and CUDA restore inside the namespace.

A RestoreCleanupError still carries the result: the restore itself succeeded.

Jump to

Keyboard shortcuts

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