snapshotting

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SnapshotManagerLabel is used to identify resources managed by the snapshotting manager
	SnapshotManagerLabel = "llmos.ai/snapshotting-manager"
	SnapshotManagerValue = "true"
)
View Source
const (
	ResourceTypeLabel = "llmos.ai/resource-type"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JobSpec

type JobSpec struct {
	BackoffLimit            *int32
	TTLSecondsAfterFinished *int32
	Image                   string
	Args                    []string
}

JobSpec defines the specification for creating a Job

type Manager

type Manager struct {
	JobClient                ctlbatchv1.JobClient
	JobCache                 ctlbatchv1.JobCache
	PVCClient                ctlcorev1.PersistentVolumeClaimClient
	PVCCache                 ctlcorev1.PersistentVolumeClaimCache
	VolumeSnapshotClient     ctlsnapshotv1.VolumeSnapshotClient
	VolumeSnapshotCache      ctlsnapshotv1.VolumeSnapshotCache
	ServiceAccountClient     ctlcorev1.ServiceAccountClient
	ServiceAccountCache      ctlcorev1.ServiceAccountCache
	ClusterRoleBindingClient ctlrbacv1.ClusterRoleBindingClient
	ClusterRoleBindingCache  ctlrbacv1.ClusterRoleBindingCache

	ResourceHandler ResourceHandler
}

func NewManager

func NewManager(mgmt *config.Management, resourceHandler ResourceHandler) (*Manager, error)

func (*Manager) CancelSnapshot

func (m *Manager) CancelSnapshot(ctx context.Context, spec *Spec) error

func (*Manager) DoSnapshot

func (m *Manager) DoSnapshot(ctx context.Context, spec *Spec) error

DoSnapshot is the main entry point for starting the snapshot process

func (*Manager) OnJobChange

func (m *Manager) OnJobChange(_ string, job *batchv1.Job) (*batchv1.Job, error)

OnJobChange handles Job status changes

func (*Manager) OnVolumeSnapshotChange

func (m *Manager) OnVolumeSnapshotChange(
	_ string, snapshot *snapshotv1.VolumeSnapshot,
) (*snapshotv1.VolumeSnapshot, error)

OnVolumeSnapshotChange handles VolumeSnapshot status changes

type PVCSpec

type PVCSpec struct {
	// Size of the PVC
	Size string `json:"size"`
	// AccessModes for the PVC
	AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"`
	// RestoreFromLatestSnapshot indicates whether to restore from the latest snapshot
	RestoreFromLatestSnapshot bool `json:"restoreFromLatestSnapshot,omitempty"`
}

type ResourceHandler

type ResourceHandler interface {
	GetSnapshottingStatus(namespace, name string) (*mlv1.SnapshottingStatus, error)
	UpdateSnapshottingStatus(namespace, name string, status *mlv1.SnapshottingStatus) error
	GetContentSize(ctx context.Context, namespace, name string) (int64, error)
	GetLatestReadySnapshot(namespace, localModelName string) (string, error)
	// GetResourceType returns the resource type for event handler naming
	GetResourceType() string
}

type Spec

type Spec struct {
	// Namespace is the namespace where resources will be created
	Namespace string `json:"namespace"`
	// Name is the base name for created resources
	Name string `json:"name"`
	// Labels to be applied to all created resources
	Labels map[string]string `json:"labels,omitempty"`
	// OwnerReferences to be applied to all created resources
	OwnerReferences []metav1.OwnerReference `json:"ownerReferences,omitempty"`

	// PVC configuration
	PVCSpec PVCSpec `json:"pvcSpec"`
	// Job configuration
	JobSpec JobSpec `json:"jobSpec"`
}

Spec contains the key spec to create a snapshot including pvc, job, volumesnapshot

Jump to

Keyboard shortcuts

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