executor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 22 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 performs a CRIU dump of a container.

The checkpoint directory is staged under the content-owned .tmp directory. On success, the previous checkpoint is removed and the staged directory is renamed atomically into the content/container artifact path.

func Restore

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

Restore performs external restore for the given request. Returns the namespace-relative PID of the restored process. The DaemonSet side inspects the placeholder and launches nsrestore, which handles rootfs application, CRIU restore, and CUDA restore inside the namespace.

Returns 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.

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
}

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"`
}

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)
	MountArtifact(ctx context.Context, namespaceMount nsmount.MountPoint, artifactPath string) (nsmount.MountPoint, error)
}

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

type RestoreOptions

type RestoreOptions struct {
	CheckpointPath string
	CUDADeviceMap  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
}

RestoreRequest holds the parameters for a restore operation.

Jump to

Keyboard shortcuts

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