Documentation ¶
Index ¶
- Constants
- Variables
- func BuildJobKeyForActionStatus(jobName string) string
- func BuildRestoreLabels(restoreName string) map[string]string
- func CompareWithBackupStopTime(backupI, backupJ dpv1alpha1.Backup) bool
- func FindRestoreStatusAction(actions []dpv1alpha1.RestoreStatusAction, key string) *dpv1alpha1.RestoreStatusAction
- func FormatRestoreTimeAndValidate(restoreTimeStr string, continuousBackup *dpv1alpha1.Backup) (string, error)
- func GetRestoreActionsCountForPrepareData(config *dpv1alpha1.PrepareDataConfig) int
- func GetRestoreDuration(status dpv1alpha1.RestoreStatus) *metav1.Duration
- func GetRestoreFromBackupAnnotation(backup *dpv1alpha1.Backup, volumeRestorePolicy, restoreTime string, ...) (string, error)
- func GetSourcePodNameFromTarget(target *dpv1alpha1.BackupStatusTarget, ...) (string, error)
- func GetVolumeSnapshotsBySourcePod(backup *dpv1alpha1.Backup, sourcePodName string) map[string]string
- func SetRestoreCheckBackupRepoCondition(restore *dpv1alpha1.Restore, reason, message string)
- 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, restoreMgr *RestoreManager) error
- type BackupActionSet
- type RestoreManager
- func (r *RestoreManager) AnalysisRestoreActionsWithBackup(stage dpv1alpha1.RestoreStage, backupName string, actionName string) (bool, bool)
- func (r *RestoreManager) BuildContinuousRestoreManager(reqCtx intctrlutil.RequestCtx, cli client.Client, ...) error
- 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" ConditionTypeRestoreCheckBackupRepo = "CheckBackupRepo" // condition reasons ReasonRestoreStarting = "RestoreStarting" ReasonRestoreCompleted = "RestoreCompleted" ReasonRestoreFailed = "RestoreFailed" ReasonCheckBackupRepoFailed = "CheckBackupRepoFailed" ReasonWaitForBackupRepo = "WaitForBackupRepo" ReasonCheckBackupRepoSuccessfully = "CheckBackupRepoSuccessfully" ReasonValidateFailed = "ValidateFailed" ReasonValidateSuccessfully = "ValidateSuccessfully" ReasonProcessing = "Processing" ReasonFailed = "Failed" ReasonSucceed = "Succeed" )
Restore condition constants
const ( DataProtectionRestoreLabelKey = "dataprotection.kubeblocks.io/restore" DataProtectionRestoreNamespaceLabelKey = "dataprotection.kubeblocks.io/restore-namespace" DataProtectionPopulatePVCLabelKey = "dataprotection.kubeblocks.io/populate-pvc" )
labels key
const ( DPRestoreTime = "DP_RESTORE_TIME" DPRestoreTimestamp = "DP_RESTORE_TIMESTAMP" DPBaseBackupStartTime = "DP_BASE_BACKUP_START_TIME" DPBaseBackupStartTimestamp = "DP_BASE_BACKUP_START_TIMESTAMP" DPBaseBackupStopTime = "DP_BASE_BACKUP_STOP_TIME" DPBaseBackupStopTimestamp = "DP_BASE_BACKUP_STOP_TIMESTAMP" )
const (
DataProtectionBackupExtrasLabelKey = "dataprotection.kubeblocks.io/backup-extras"
)
Annotations key
const Restore = "restore"
Restore constant
Variables ¶
var VolumeSnapshotGroup = "snapshot.storage.k8s.io"
Functions ¶
func BuildJobKeyForActionStatus ¶ added in v0.8.2
func BuildRestoreLabels ¶
func CompareWithBackupStopTime ¶ added in v0.7.1
func CompareWithBackupStopTime(backupI, backupJ dpv1alpha1.Backup) bool
func FindRestoreStatusAction ¶
func FindRestoreStatusAction(actions []dpv1alpha1.RestoreStatusAction, key string) *dpv1alpha1.RestoreStatusAction
func FormatRestoreTimeAndValidate ¶ added in v0.8.0
func FormatRestoreTimeAndValidate(restoreTimeStr string, continuousBackup *dpv1alpha1.Backup) (string, error)
func GetRestoreActionsCountForPrepareData ¶
func GetRestoreActionsCountForPrepareData(config *dpv1alpha1.PrepareDataConfig) int
func GetRestoreDuration ¶
func GetRestoreDuration(status dpv1alpha1.RestoreStatus) *metav1.Duration
func GetRestoreFromBackupAnnotation ¶ added in v0.8.0
func GetSourcePodNameFromTarget ¶ added in v0.9.0
func GetSourcePodNameFromTarget(target *dpv1alpha1.BackupStatusTarget, requiredPolicy *dpv1alpha1.RequiredPolicyForAllPodSelection, index int) (string, error)
GetSourcePodNameFromTarget gets the source pod name from backup status target according to 'RequiredPolicyForAllPodSelection'.
func GetVolumeSnapshotsBySourcePod ¶ added in v0.9.0
func GetVolumeSnapshotsBySourcePod(backup *dpv1alpha1.Backup, sourcePodName string) map[string]string
GetVolumeSnapshotsBySourcePod gets the volume snapshots of the backup and group by source target pod.
func SetRestoreCheckBackupRepoCondition ¶ added in v0.9.0
func SetRestoreCheckBackupRepoCondition(restore *dpv1alpha1.Restore, reason, message string)
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, 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 // set it when the backup relies on a base backup, such as Continuous backup BaseBackup *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 WorkerServiceAccount string }
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) BuildContinuousRestoreManager ¶ added in v0.8.2
func (r *RestoreManager) BuildContinuousRestoreManager(reqCtx intctrlutil.RequestCtx, cli client.Client, continuousBackupSet BackupActionSet) error
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, target *dpv1alpha1.BackupStatusTarget, 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, target *dpv1alpha1.BackupStatusTarget, 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, target *dpv1alpha1.BackupStatusTarget, 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, target *dpv1alpha1.BackupStatusTarget) error
func (*RestoreManager) SetBackupSets ¶
func (r *RestoreManager) SetBackupSets(backupSets ...BackupActionSet)