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 ¶
- func Checkpoint(ctx context.Context, rt snapshotruntime.Runtime, log logr.Logger, ...) error
- func Restore(ctx context.Context, rt snapshotruntime.Runtime, log logr.Logger, ...) (placeholderPID int, retErr error)
- type CheckpointRequest
- type Mounter
- type RestoreInNamespaceResult
- type RestoreOptions
- type RestoreRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Checkpoint ¶
func Checkpoint(ctx context.Context, rt snapshotruntime.Runtime, log logr.Logger, req CheckpointRequest, cfg *types.AgentConfig) error
Checkpoint performs a CRIU dump of a container. The operation has three phases: inspect, configure, capture.
The checkpoint directory is staged under tmp/<uuid> during the operation. On success, the previous checkpoint is removed and the staged directory is renamed into place at the base path root.
func Restore ¶
func Restore(ctx context.Context, rt snapshotruntime.Runtime, log logr.Logger, req RestoreRequest, mounter Mounter) (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
CheckpointID string
CheckpointLocation string
StartedAt time.Time
NodeName string
PodName string
PodNamespace string
PodIP string
Clientset kubernetes.Interface
}
CheckpointRequest holds per-checkpoint identifiers for a checkpoint operation.
type Mounter ¶
Mounter mounts the agent binary bundle into a placeholder container's mount namespace.
type RestoreInNamespaceResult ¶
type RestoreInNamespaceResult struct {
RestoredPID int `json:"restoredPID"`
NSRestoreSetupDuration time.Duration `json:"nsrestoreSetupDuration"`
CRIURestoreDuration time.Duration `json:"criuRestoreDuration"`
CUDADuration time.Duration `json:"cudaDuration"`
}
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.
func (RestoreInNamespaceResult) TotalDuration ¶
func (r RestoreInNamespaceResult) TotalDuration() time.Duration
TotalDuration returns the sum of all in-namespace restore phase durations.
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 {
CheckpointID string
CheckpointLocation string
ContainerCheckpointLocation string
ContainerID string
StartedAt time.Time
PodName string
PodNamespace string
TargetPodIP string
ContainerName string
Clientset kubernetes.Interface
}
RestoreRequest holds the parameters for a restore operation.