backup

package
v0.8.0-beta.27 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackupDataJobNamePrefix = "dp-backup"

	BackupDataContainerName      = "backupdata"
	SyncProgressContainerName    = "sync-progress"
	SyncProgressSharedVolumeName = "sync-progress-shared-volume"
	SyncProgressSharedMountPath  = "/dp-sync-progress"
)
View Source
const (
	FormatVersion = "0.1.0"

	// RepoVolumeMountPath is the backup repo volume mount path.
	RepoVolumeMountPath = "/backupdata"

	// BackupInfoFileName is the backup info file name in the backup path.
	BackupInfoFileName = "backup.info"
)

FormatVersion is the backup file format version, including major, minor, and patch version.

Variables

This section is empty.

Functions

func BuildBackupPath

func BuildBackupPath(backup *dpv1alpha1.Backup, pathPrefix string) string

BuildBackupPath builds the path to storage backup data in backup repository.

func BuildBackupWorkloadLabels

func BuildBackupWorkloadLabels(backup *dpv1alpha1.Backup) map[string]string

BuildBackupWorkloadLabels builds the labels for workload which owned by backup.

func BuildCronJobSchedule added in v0.8.0

func BuildCronJobSchedule(cronExpression string) (*string, string)

BuildCronJobSchedule build cron job schedule info based on kubernetes version. For kubernetes version >= 1.25, the timeZone field is supported, return timezone. Ref https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones

For kubernetes version < 1.25 and greater than 1.21, the timeZone field is not supported, so we need to set the CRON_TZ environment variable. Ref https://github.com/kubernetes/kubernetes/issues/47202#issuecomment-901294870

func BuildDeleteBackupFilesJobKey

func BuildDeleteBackupFilesJobKey(backup *dpv1alpha1.Backup) client.ObjectKey

func GenerateBackupJobName

func GenerateBackupJobName(backup *dpv1alpha1.Backup, prefix string) string

func GenerateCRNameByBackupSchedule

func GenerateCRNameByBackupSchedule(backupSchedule *dpv1alpha1.BackupSchedule, method string) string

GenerateCRNameByBackupSchedule generate a CR name which is created by BackupSchedule, such as CronJob Backup.

func GetSchedulePolicyByMethod

func GetSchedulePolicyByMethod(backupSchedule *dpv1alpha1.BackupSchedule, method string) *dpv1alpha1.SchedulePolicy

func SetExpirationByCreationTime added in v0.7.1

func SetExpirationByCreationTime(backup *dpv1alpha1.Backup) error

Types

type Deleter

type Deleter struct {
	ctrlutil.RequestCtx
	Client client.Client
	Scheme *runtime.Scheme
}

func (*Deleter) DeleteBackupFiles

func (d *Deleter) DeleteBackupFiles(backup *dpv1alpha1.Backup) (DeletionStatus, error)

DeleteBackupFiles builds a job to delete backup files, and returns the deletion status. If the deletion job exists, it will check the job status and return the corresponding deletion status.

func (*Deleter) DeleteVolumeSnapshots

func (d *Deleter) DeleteVolumeSnapshots(backup *dpv1alpha1.Backup) error

type DeletionStatus

type DeletionStatus string
const (
	DeletionStatusDeleting  DeletionStatus = "Deleting"
	DeletionStatusFailed    DeletionStatus = "Failed"
	DeletionStatusSucceeded DeletionStatus = "Succeeded"
	DeletionStatusUnknown   DeletionStatus = "Unknown"
)

type Request

type Request struct {
	*dpv1alpha1.Backup
	intctrlutil.RequestCtx

	Client           client.Client
	BackupPolicy     *dpv1alpha1.BackupPolicy
	BackupMethod     *dpv1alpha1.BackupMethod
	ActionSet        *dpv1alpha1.ActionSet
	TargetPods       []*corev1.Pod
	BackupRepoPVC    *corev1.PersistentVolumeClaim
	BackupRepo       *dpv1alpha1.BackupRepo
	ToolConfigSecret *corev1.Secret
}

Request is a request for a backup, with all references to other objects.

func (*Request) BuildActions

func (r *Request) BuildActions() ([]action.Action, error)

BuildActions builds the actions for the backup.

func (*Request) BuildJobActionPodSpec added in v0.7.1

func (r *Request) BuildJobActionPodSpec(name string,
	job *dpv1alpha1.JobActionSpec) (*corev1.PodSpec, error)

func (*Request) GetBackupType

func (r *Request) GetBackupType() string

func (*Request) InjectSyncProgressContainer added in v0.7.1

func (r *Request) InjectSyncProgressContainer(podSpec *corev1.PodSpec,
	sync *dpv1alpha1.SyncProgress, command string)

InjectSyncProgressContainer injects a container to sync the backup progress.

type Scheduler

type Scheduler struct {
	intctrlutil.RequestCtx
	Client         client.Client
	Scheme         *k8sruntime.Scheme
	BackupSchedule *dpv1alpha1.BackupSchedule
	BackupPolicy   *dpv1alpha1.BackupPolicy
}

func (*Scheduler) Schedule

func (s *Scheduler) Schedule() error

Jump to

Keyboard shortcuts

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