types

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: 8 Imported by: 0

Documentation

Overview

Package types defines shared data types used across snapshot packages.

Index

Constants

View Source
const CheckpointBasePath = "/checkpoints"

CheckpointBasePath is the fixed agent-side checkpoint mount. The privileged helper independently enforces the same path.

Variables

This section is empty.

Functions

func WriteManifest

func WriteManifest(checkpointDir string, data *CheckpointManifest) error

WriteManifest writes a checkpoint manifest file in the checkpoint directory.

Types

type AgentConfig

type AgentConfig struct {
	NodeName string          `yaml:"-"`
	Storage  StorageSpec     `yaml:"storage"`
	Overlay  OverlaySettings `yaml:"overlay"`
	Restore  RestoreSpec     `yaml:"restore"`
	CRIU     CRIUSettings    `yaml:"criu"`
}

AgentConfig holds the full agent configuration: static checkpoint settings from the ConfigMap YAML, plus runtime fields from environment variables.

func (*AgentConfig) LoadEnvOverrides

func (c *AgentConfig) LoadEnvOverrides()

func (*AgentConfig) Validate

func (c *AgentConfig) Validate() error

type ArtifactManifest

type ArtifactManifest struct {
	ContentUID    string `yaml:"contentUID"`
	ContainerName string `yaml:"containerName"`
}

ArtifactManifest pins an on-disk checkpoint to the Kubernetes content object and container whose immutable identity determines its path.

type CRIUDumpManifest

type CRIUDumpManifest struct {
	CRIU     CRIUSettings      `yaml:"criu"`
	ExtMnt   map[string]string `yaml:"extMnt,omitempty"`
	External []string          `yaml:"external,omitempty"`
	SkipMnt  []string          `yaml:"skipMnt,omitempty"`
}

CRIUDumpManifest stores the resolved dump-time CRIU mount plan used for restore.

func NewCRIUDumpManifest

func NewCRIUDumpManifest(criuOpts *criurpc.CriuOpts, settings CRIUSettings) CRIUDumpManifest

type CRIUSettings

type CRIUSettings struct {
	GhostLimit        uint32 `yaml:"ghostLimit"`
	LogLevel          int32  `yaml:"logLevel"`
	WorkDir           string `yaml:"workDir"`
	AutoDedup         bool   `yaml:"autoDedup"`
	LazyPages         bool   `yaml:"lazyPages"`
	ShellJob          bool   `yaml:"shellJob"`
	TcpClose          bool   `yaml:"tcpClose"`
	TcpEstablished    bool   `yaml:"tcpEstablished"`
	FileLocks         bool   `yaml:"fileLocks"`
	OrphanPtsMaster   bool   `yaml:"orphanPtsMaster"`
	ExtUnixSk         bool   `yaml:"extUnixSk"`
	LinkRemap         bool   `yaml:"linkRemap"`
	ExtMasters        bool   `yaml:"extMasters"`
	ManageCgroupsMode string `yaml:"manageCgroupsMode"`
	ImageIoMode       string `yaml:"imageIoMode"`
	RstSibling        bool   `yaml:"rstSibling"`
	MntnsCompatMode   bool   `yaml:"mntnsCompatMode"`
	EvasiveDevices    bool   `yaml:"evasiveDevices"`
	ForceIrmap        bool   `yaml:"forceIrmap"`
	BinaryPath        string `yaml:"binaryPath"`
	LibDir            string `yaml:"libDir"`
	AllowUprobes      bool   `yaml:"allowUprobes"`
	SkipInFlight      bool   `yaml:"skipInFlight"`
}

CRIUSettings holds CRIU-specific configuration options.

type CUDAManifest

type CUDAManifest struct {
	PIDs           []int    `yaml:"pids"`
	SourceGPUUUIDs []string `yaml:"sourceGpuUuids"`
}

CUDAManifest captures CUDA state from checkpoint time for restore.

func NewCUDAManifest

func NewCUDAManifest(pids []int, sourceGPUUUIDs []string) CUDAManifest

func (CUDAManifest) IsEmpty

func (m CUDAManifest) IsEmpty() bool

type CheckpointContainerSnapshot

type CheckpointContainerSnapshot struct {
	PID            int
	RootFS         string
	UpperDir       string
	OCISpec        *specs.Spec
	Mounts         []MountInfo
	NetNSInode     uint64
	StdioFDs       []string // readlink targets for FDs 0, 1, 2 (e.g. "pipe:[12345]")
	HostCgroupPath string   // host filesystem path for CRIU's --freeze-cgroup
	CUDAHostPIDs   []int    // host-visible PIDs used for checkpoint-side CUDA actions
	CUDANSPIDs     []int    // namespace-relative PIDs stored in the checkpoint manifest
	GPUUUIDs       []string // source GPU UUIDs from kubelet PodResources API
}

CheckpointContainerSnapshot holds runtime container state collected during checkpoint inspection.

type CheckpointManifest

type CheckpointManifest struct {
	Artifact  ArtifactManifest `yaml:"artifact"`
	CreatedAt time.Time        `yaml:"createdAt"`

	CRIUDump CRIUDumpManifest  `yaml:"criuDump"`
	K8s      SourcePodManifest `yaml:"k8s"`
	Overlay  OverlayManifest   `yaml:"overlay"`
	CUDA     CUDAManifest      `yaml:"cudaRestore,omitempty"`
}

CheckpointManifest is saved as manifest.yaml at checkpoint time and loaded at restore.

func NewCheckpointManifest

func NewCheckpointManifest(
	contentUID string,
	containerName string,
	criuDump CRIUDumpManifest,
	k8s SourcePodManifest,
	overlay OverlayManifest,
) *CheckpointManifest

func ReadManifest

func ReadManifest(checkpointDir string) (*CheckpointManifest, error)

ReadManifest reads checkpoint manifest from a checkpoint directory.

type ConfigError

type ConfigError struct {
	Field   string
	Message string
}

ConfigError represents a configuration validation error.

func (*ConfigError) Error

func (e *ConfigError) Error() string

type MountInfo

type MountInfo struct {
	MountPoint string
	FSType     string
	VFSOptions string // superblock options (e.g. "upperdir=...")

	// IsOCIManaged is true when the mount destination matches an OCI spec entry
	// (including /run/ ↔ /var/run/ aliasing). Set by ClassifyMounts.
	IsOCIManaged bool
}

MountInfo holds parsed mount information from /proc/pid/mountinfo.

type OverlayManifest

type OverlayManifest struct {
	Exclusions     OverlaySettings `yaml:"exclusions"`
	UpperDir       string          `yaml:"upperDir,omitempty"`
	ExternalPaths  []string        `yaml:"externalPaths,omitempty"`
	BindMountDests []string        `yaml:"bindMountDests,omitempty"`
}

OverlayManifest holds runtime overlay state captured at checkpoint time.

func NewOverlayManifest

func NewOverlayManifest(exclusions OverlaySettings, upperDir string, ociSpec *specs.Spec) OverlayManifest

type OverlaySettings

type OverlaySettings struct {
	Exclusions []string `yaml:"exclusions"`
}

OverlaySettings is the static config for rootfs exclusions.

type RestoreContainerSnapshot

type RestoreContainerSnapshot struct {
	PlaceholderPID int
	TargetRoot     string
	CgroupRoot     string
	CUDADeviceMap  string
}

RestoreContainerSnapshot holds inspected state for the restore target.

type RestoreSpec

type RestoreSpec struct {
	RestoreTimeoutSeconds int `yaml:"restoreTimeoutSeconds"`
}

RestoreSpec holds settings for the CRIU restore process.

func (*RestoreSpec) RestoreTimeout

func (c *RestoreSpec) RestoreTimeout() time.Duration

func (*RestoreSpec) Validate

func (c *RestoreSpec) Validate() error

type SourcePodManifest

type SourcePodManifest struct {
	ContainerID  string `yaml:"containerId"`
	PID          int    `yaml:"pid"`
	SourceNode   string `yaml:"sourceNode"`
	PodName      string `yaml:"podName"`
	PodNamespace string `yaml:"podNamespace"`
	PodIP        string `yaml:"podIP,omitempty"`

	// StdioFDs holds readlink targets for FDs 0, 1, 2 (e.g. "pipe:[12345]").
	StdioFDs []string `yaml:"stdioFDs,omitempty"`
}

SourcePodManifest records the source pod identity at checkpoint time.

func NewSourcePodManifest

func NewSourcePodManifest(containerID string, pid int, sourceNode, podName, podNamespace, podIP string, stdioFDs []string) SourcePodManifest

type StorageSpec

type StorageSpec struct {
	Type     string `yaml:"type"`
	BasePath string `yaml:"basePath"`
}

StorageSpec holds snapshot storage settings that are local to the agent deployment.

Jump to

Keyboard shortcuts

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