Documentation ¶
Index ¶
- Constants
- Variables
- func BuildRestoreLabels(restoreName string) map[string]string
- func FindRestoreStatusAction(actions []dpv1alpha1.RestoreStatusAction, key string) *dpv1alpha1.RestoreStatusAction
- func GetRestoreActionsCountForPrepareData(config *dpv1alpha1.PrepareDataConfig) int
- func GetRestoreDuration(status dpv1alpha1.RestoreStatus) *metav1.Duration
- func SetRestoreCondition(restore *dpv1alpha1.Restore, status metav1.ConditionStatus, ...)
- func SetRestoreStageCondition(restore *dpv1alpha1.Restore, stage dpv1alpha1.RestoreStage, ...)
- func SetRestoreStatusAction(actions *[]dpv1alpha1.RestoreStatusAction, ...)
- func SetRestoreValidationCondition(restore *dpv1alpha1.Restore, reason, message string)
- func ValidateAndInitRestoreMGR(reqCtx intctrlutil.RequestCtx, cli client.Client, ...) error
- type BackupActionSet
- type RestoreManager
- func (r *RestoreManager) AnalysisRestoreActionsWithBackup(stage dpv1alpha1.RestoreStage, backupName string, actionName string) (bool, bool)
- func (r *RestoreManager) BuildDifferentialBackupActionSets(reqCtx intctrlutil.RequestCtx, cli client.Client, ...) error
- func (r *RestoreManager) BuildIncrementalBackupActionSets(reqCtx intctrlutil.RequestCtx, cli client.Client, ...) error
- func (r *RestoreManager) BuildPostReadyActionJobs(reqCtx intctrlutil.RequestCtx, cli client.Client, backupSet BackupActionSet, ...) ([]*batchv1.Job, error)
- func (r *RestoreManager) BuildPrepareDataJobs(reqCtx intctrlutil.RequestCtx, cli client.Client, backupSet BackupActionSet, ...) ([]*batchv1.Job, error)
- func (r *RestoreManager) BuildVolumePopulateJob(reqCtx intctrlutil.RequestCtx, cli client.Client, backupSet BackupActionSet, ...) (*batchv1.Job, error)
- func (r *RestoreManager) CheckJobsDone(stage dpv1alpha1.RestoreStage, actionName string, backupSet BackupActionSet, ...) (bool, bool)
- func (r *RestoreManager) CreateJobsIfNotExist(reqCtx intctrlutil.RequestCtx, cli client.Client, ownerObj client.Object, ...) ([]*batchv1.Job, error)
- func (r *RestoreManager) GetBackupActionSetByNamespaced(reqCtx intctrlutil.RequestCtx, cli client.Client, backupName, namespace string) (*BackupActionSet, error)
- func (r *RestoreManager) Recalculation(backupName, actionName string, allActionsFinished, existFailedAction *bool)
- func (r *RestoreManager) RestorePVCFromSnapshot(reqCtx intctrlutil.RequestCtx, cli client.Client, backupSet BackupActionSet) error
- func (r *RestoreManager) SetBackupSets(backupSets ...BackupActionSet)
Constants ¶
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
const ( DataProtectionLabelRestoreKey = "dataprotection.kubeblocks.io/restore" DataProtectionLabelRestoreNamespaceKey = "dataprotection.kubeblocks.io/restore-namespace" DataProtectionLabelPopulatePVCKey = "dataprotection.kubeblocks.io/populate-pvc" )
labels key
const ( DPRestoreTime = "DP_RESTORE_TIME" DPRestoreTimestamp = "DP_RESTORE_TIMESTAMP" )
const Restore = "restore"
Restore constant
Variables ¶
var VolumeSnapshotGroup = "snapshot.storage.k8s.io"
Functions ¶
func BuildRestoreLabels ¶
func FindRestoreStatusAction ¶
func FindRestoreStatusAction(actions []dpv1alpha1.RestoreStatusAction, key string) *dpv1alpha1.RestoreStatusAction
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.
func ValidateAndInitRestoreMGR ¶
func ValidateAndInitRestoreMGR(reqCtx intctrlutil.RequestCtx, cli client.Client, recorder record.EventRecorder, restoreMgr *RestoreManager) error
ValidateAndInitRestoreMGR validate if the restore CR is valid and init the restore manager.
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, step int) ([]*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) BuildVolumePopulateJob ¶
func (r *RestoreManager) BuildVolumePopulateJob( reqCtx intctrlutil.RequestCtx, cli client.Client, backupSet BackupActionSet, populatePVC *corev1.PersistentVolumeClaim, index int) (*batchv1.Job, error)
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, ownerObj client.Object, 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) error
func (*RestoreManager) SetBackupSets ¶
func (r *RestoreManager) SetBackupSets(backupSets ...BackupActionSet)