restore

package
v0.7.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// condition types
	ConditionTypeRestoreValidationPassed = "ValidationPassed"
	ConditionTypeRestorePreparedData     = "PrepareData"
	ConditionTypeReadinessProbe          = "ReadinessProbe"
	ConditionTypeRestorePostReady        = "PostReady"

	// condition reasons
	ReasonRestoreStarting      = "RestoreStarting"
	ReasonRestoreCompleted     = "RestoreCompleted"
	ReasonRestoreFailed        = "RestoreFailed"
	ReasonValidateFailed       = "ValidateFailed"
	ReasonValidateSuccessfully = "ValidateSuccessfully"
	ReasonProcessing           = "Processing"
	ReasonFailed               = "Failed"
	ReasonSucceed              = "Succeed"
)

Restore condition constants

View Source
const (
	DPRestoreTime      = "DP_RESTORE_TIME"
	DPRestoreTimestamp = "DP_RESTORE_TIMESTAMP"
)
View Source
const (
	DataProtectionLabelRestoreKey = "dataprotection.kubeblocks.io/restore"
)

labels key

View Source
const Restore = "restore"

Restore constant

Variables

This section is empty.

Functions

func BuildRestoreLabels

func BuildRestoreLabels(restoreName string) map[string]string

func GetRestoreActionsCountForPrepareData

func GetRestoreActionsCountForPrepareData(config *dpv1alpha1.PrepareDataConfig) int

func GetRestoreDuration

func GetRestoreDuration(status dpv1alpha1.RestoreStatus) *metav1.Duration

func SetRestoreCondition

func SetRestoreCondition(restore *dpv1alpha1.Restore, status metav1.ConditionStatus, conditionType, reason, message string)

func SetRestoreStageCondition

func SetRestoreStageCondition(restore *dpv1alpha1.Restore, stage dpv1alpha1.RestoreStage, reason, message string)

SetRestoreStageCondition sets restore stage condition.

func SetRestoreStatusAction

func SetRestoreStatusAction(actions *[]dpv1alpha1.RestoreStatusAction,
	statusAction dpv1alpha1.RestoreStatusAction)

func SetRestoreValidationCondition

func SetRestoreValidationCondition(restore *dpv1alpha1.Restore, reason, message string)

SetRestoreValidationCondition sets restore condition which type is ConditionTypeRestoreValidationPassed.

Types

type BackupActionSet

type BackupActionSet struct {
	Backup            *dpv1alpha1.Backup
	ActionSet         *dpv1alpha1.ActionSet
	UseVolumeSnapshot bool
}

type RestoreManager

type RestoreManager struct {
	OriginalRestore       *dpv1alpha1.Restore
	Restore               *dpv1alpha1.Restore
	PrepareDataBackupSets []BackupActionSet
	PostReadyBackupSets   []BackupActionSet
	Schema                *runtime.Scheme
	Recorder              record.EventRecorder
}

func NewRestoreManager

func NewRestoreManager(restore *dpv1alpha1.Restore, recorder record.EventRecorder, schema *runtime.Scheme) *RestoreManager

func (*RestoreManager) AnalysisRestoreActionsWithBackup

func (r *RestoreManager) AnalysisRestoreActionsWithBackup(stage dpv1alpha1.RestoreStage, backupName string, actionName string) (bool, bool)

AnalysisRestoreActionsWithBackup analysis the restore actions progress group by backup. check if the restore jobs are completed or failed or processing.

func (*RestoreManager) BuildDifferentialBackupActionSets

func (r *RestoreManager) BuildDifferentialBackupActionSets(reqCtx intctrlutil.RequestCtx, cli client.Client, sourceBackupSet BackupActionSet) error

BuildDifferentialBackupActionSets builds the backupActionSets for specified incremental backup.

func (*RestoreManager) BuildIncrementalBackupActionSets

func (r *RestoreManager) BuildIncrementalBackupActionSets(reqCtx intctrlutil.RequestCtx, cli client.Client, sourceBackupSet BackupActionSet) error

BuildIncrementalBackupActionSets builds the backupActionSets for specified incremental backup.

func (*RestoreManager) BuildPostReadyActionJobs

func (r *RestoreManager) BuildPostReadyActionJobs(reqCtx intctrlutil.RequestCtx, cli client.Client, backupSet BackupActionSet, actionSpec dpv1alpha1.ActionSpec) ([]*batchv1.Job, error)

BuildPostReadyActionJobs builds the post ready jobs.

func (*RestoreManager) BuildPrepareDataJobs

func (r *RestoreManager) BuildPrepareDataJobs(reqCtx intctrlutil.RequestCtx, cli client.Client, backupSet BackupActionSet, actionName string) ([]*batchv1.Job, error)

BuildPrepareDataJobs builds the restore jobs for prepare pvc's data, and will create the target pvcs if not exist.

func (*RestoreManager) CheckJobsDone

func (r *RestoreManager) CheckJobsDone(
	stage dpv1alpha1.RestoreStage,
	actionName string,
	backupSet BackupActionSet,
	fetchedJobs []*batchv1.Job) (bool, bool)

CheckJobsDone checks if jobs are completed or failed.

func (*RestoreManager) CreateJobsIfNotExist

func (r *RestoreManager) CreateJobsIfNotExist(reqCtx intctrlutil.RequestCtx,
	cli client.Client,
	objs []*batchv1.Job) ([]*batchv1.Job, error)

CreateJobsIfNotExist creates the jobs if not exist.

func (*RestoreManager) GetBackupActionSetByNamespaced

func (r *RestoreManager) GetBackupActionSetByNamespaced(reqCtx intctrlutil.RequestCtx,
	cli client.Client,
	backupName,
	namespace string) (*BackupActionSet, error)

GetBackupActionSetByNamespaced gets the BackupActionSet by name and namespace of backup.

func (*RestoreManager) Recalculation

func (r *RestoreManager) Recalculation(backupName, actionName string, allActionsFinished, existFailedAction *bool)

Recalculation whether all actions have been completed.

func (*RestoreManager) RestorePVCFromSnapshot

func (r *RestoreManager) RestorePVCFromSnapshot(reqCtx intctrlutil.RequestCtx, cli client.Client, backupSet BackupActionSet, actionName string) error

func (*RestoreManager) SetBackupSets

func (r *RestoreManager) SetBackupSets(backupSets ...BackupActionSet)

Jump to

Keyboard shortcuts

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