controller

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Overview

Package controller implements the node-local control loop inside snapshot-agent. It does not own CRDs or replace the operator. Instead it watches pod and work order state on the current node and delegates CRIU/CUDA execution to the snapshot executor workflows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckpointParams

type CheckpointParams struct {
	// Pod is the live source pod (already provenance-verified by the reconciler).
	Pod *corev1.Pod
	// ContainerName is the single target container to checkpoint.
	ContainerName string
	// ContainerID is the agent-resolved running container ID (CRI scheme stripped).
	ContainerID string
	// ContainerPID is the agent-resolved host PID of the running container.
	ContainerPID int
	// ContentUID is the immutable PodSnapshotContent identity owning the artifact.
	ContentUID string
	// HostPath is the agent-resolved destination directory for the dump.
	HostPath string
	// StartedAt marks when the controller observed the work order, for timing.
	StartedAt time.Time
	// CuInterposeRequested is the source Pod's explicit opt-in, already preflighted.
	CuInterposeRequested bool
	// StoreID binds this capture to a configured store; empty means legacy.
	StoreID string
}

CheckpointParams carries everything the node driver needs to dump one container.

type NodeController

type NodeController struct {
	// contains filtered or unexported fields
}

NodeController watches local-node pods with checkpoint metadata and reconciles snapshot execution for checkpoint and restore requests. Both paths are workqueue driven, with typed reads/writes via an uncached controller-runtime client.

func NewNodeController

func NewNodeController(
	cfg *types.AgentConfig,
	rt snapshotruntime.Runtime,
	log logr.Logger,
) (*NodeController, error)

NewNodeController creates the node-local controller that runs inside snapshot-agent.

func (*NodeController) RestoreContainerStarted added in v0.3.0

func (w *NodeController) RestoreContainerStarted(pod ktypes.NamespacedName, uid ktypes.UID, container, containerID string)

RestoreContainerStarted records a restore destination's container that the NRI plugin saw start, and requeues its Pod so the restore begins without waiting for kubelet to publish the container in the Pod status. In a vCluster tenant that status is also the only other way to find the container: the runtime labels it with the host Pod's name.

func (*NodeController) RestoreContainerStopped added in v0.3.0

func (w *NodeController) RestoreContainerStopped(uid ktypes.UID, container, containerID string)

RestoreContainerStopped forgets a reported destination container that has stopped, unless a later container already replaced the report. A restore into it would fail the Pod's restore instead of waiting for the container kubelet starts next.

func (*NodeController) RestoreDestinations added in v0.3.0

func (w *NodeController) RestoreDestinations(ctx context.Context, pod *corev1.Pod) ([]string, error)

RestoreDestinations returns the names of the containers a restore Pod restores into. When the Pod carries no container map, the destination is the captured container, which the PodSnapshot's spec names. That spec is set at creation and immutable, so this works while the snapshot is still being taken. It checks nothing else: the restore itself still runs the full preflight, including the bound PodSnapshotContent.

func (*NodeController) RestoreWithoutProxy added in v0.3.0

func (w *NodeController) RestoreWithoutProxy()

RestoreWithoutProxy makes restores run without the restore proxy, on a node whose runtime cannot run it. Call it before Run.

func (*NodeController) Run

func (w *NodeController) Run(ctx context.Context) error

Run starts the local pod informers and processes checkpoint/restore events.

Jump to

Keyboard shortcuts

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