Documentation ¶
Index ¶
- Constants
- func BuildBackupPathByTarget(backup *dpv1alpha1.Backup, target *dpv1alpha1.BackupTarget, ...) string
- func BuildBackupWorkloadLabels(backup *dpv1alpha1.Backup) map[string]string
- func BuildBaseBackupPath(backup *dpv1alpha1.Backup, repoPathPrefix, pathPrefix string) string
- func BuildCronJobSchedule(cronExpression string) (*string, string)
- func BuildDeleteBackupFilesJobKey(backup *dpv1alpha1.Backup, isPreDelete bool) client.ObjectKey
- func BuildKopiaRepoPath(backup *dpv1alpha1.Backup, repoPathPrefix, pathPrefix string) string
- func BuildParametersManifest(parameters []dpv1alpha1.ParameterPair) (string, error)
- func GenerateBackupJobName(backup *dpv1alpha1.Backup, prefix string) string
- func GenerateBackupStatefulSetName(backup *dpv1alpha1.Backup, targetName, prefix string) string
- func GenerateCRNameByBackupSchedule(backupSchedule *dpv1alpha1.BackupSchedule, method string) string
- func GenerateCRNameByScheduleNameAndMethod(backupSchedule *dpv1alpha1.BackupSchedule, method string, name string) string
- func GenerateLegacyCRNameByBackupSchedule(backupSchedule *dpv1alpha1.BackupSchedule, method string) string
- func GetSchedulePolicyByMethod(backupSchedule *dpv1alpha1.BackupSchedule, method string) *dpv1alpha1.SchedulePolicy
- func SetExpirationByCreationTime(backup *dpv1alpha1.Backup) error
- func StopStatefulSetsWhenFailed(ctx context.Context, cli client.Client, backup *dpv1alpha1.Backup, ...) error
- type Deleter
- type DeletionStatus
- type Request
- func (r *Request) BuildActions() (map[string][]action.Action, error)
- func (r *Request) BuildJobActionPodSpec(targetPod *corev1.Pod, name string, job *dpv1alpha1.JobActionSpec) (*corev1.PodSpec, error)
- func (r *Request) GetBackupType() string
- func (r *Request) InjectManagerContainer(podSpec *corev1.PodSpec, sync *dpv1alpha1.SyncProgress, command string)
- type Scheduler
Constants ¶
const ( BackupDataJobNamePrefix = "dp-backup" BackupDataContainerName = "backupdata" )
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 BuildBackupPathByTarget ¶ added in v0.9.0
func BuildBackupPathByTarget(backup *dpv1alpha1.Backup, target *dpv1alpha1.BackupTarget, repoPathPrefix, pathPrefix, targetPodName string) string
BuildBackupPathByTarget builds the backup by target.name and podSelectionStrategy.
func BuildBackupWorkloadLabels ¶
func BuildBackupWorkloadLabels(backup *dpv1alpha1.Backup) map[string]string
BuildBackupWorkloadLabels builds the labels for workload which owned by backup.
func BuildBaseBackupPath ¶ added in v0.9.0
func BuildBaseBackupPath(backup *dpv1alpha1.Backup, repoPathPrefix, pathPrefix string) string
BuildBaseBackupPath builds the path to storage backup data in backup repository.
func BuildCronJobSchedule ¶ added in v0.8.0
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 >= 1.22, the timeZone field is not supported. Therefore, we need to set the CRON_TZ environment variable. Ref https://github.com/kubernetes/kubernetes/issues/47202#issuecomment-901294870
For kubernetes version < 1.22, the CRON_TZ environment variable is not supported. The kube-controller-manager interprets schedules relative to its local time zone.
func BuildDeleteBackupFilesJobKey ¶
func BuildDeleteBackupFilesJobKey(backup *dpv1alpha1.Backup, isPreDelete bool) client.ObjectKey
func BuildKopiaRepoPath ¶ added in v0.8.0
func BuildKopiaRepoPath(backup *dpv1alpha1.Backup, repoPathPrefix, pathPrefix string) string
BuildKopiaRepoPath builds the path of kopia repository.
func BuildParametersManifest ¶
func BuildParametersManifest(parameters []dpv1alpha1.ParameterPair) (string, error)
func GenerateBackupJobName ¶
func GenerateBackupJobName(backup *dpv1alpha1.Backup, prefix string) string
func GenerateBackupStatefulSetName ¶ added in v0.9.1
func GenerateBackupStatefulSetName(backup *dpv1alpha1.Backup, targetName, 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 Continuous Backup.
func GenerateCRNameByScheduleNameAndMethod ¶
func GenerateCRNameByScheduleNameAndMethod(backupSchedule *dpv1alpha1.BackupSchedule, method string, name string) string
GenerateCRNameByScheduleNameAndMethod generate a CR name which is created by BackupSchedule, such as CronJob.
func GenerateLegacyCRNameByBackupSchedule ¶ added in v0.9.0
func GenerateLegacyCRNameByBackupSchedule(backupSchedule *dpv1alpha1.BackupSchedule, method string) string
GenerateLegacyCRNameByBackupSchedule generate a legacy CR name which is created by BackupSchedule, such as CronJob.
func GetSchedulePolicyByMethod ¶
func GetSchedulePolicyByMethod(backupSchedule *dpv1alpha1.BackupSchedule, method string) *dpv1alpha1.SchedulePolicy
func SetExpirationByCreationTime ¶ added in v0.7.1
func SetExpirationByCreationTime(backup *dpv1alpha1.Backup) error
func StopStatefulSetsWhenFailed ¶ added in v0.9.2
func StopStatefulSetsWhenFailed(ctx context.Context, cli client.Client, backup *dpv1alpha1.Backup, targetName string) error
StopStatefulSetsWhenFailed stops the sts to un-bound the pvcs.
Types ¶
type Deleter ¶
type Deleter struct { ctrlutil.RequestCtx Client client.Client Scheme *runtime.Scheme WorkerServiceAccount string // contains filtered or unexported fields }
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 WorkerServiceAccount string SnapshotVolumes bool Target *dpv1alpha1.BackupTarget }
Request is a request for a backup, with all references to other objects.
func (*Request) BuildActions ¶
BuildActions builds the actions for the backup.
func (*Request) BuildJobActionPodSpec ¶ added in v0.7.1
func (r *Request) BuildJobActionPodSpec(targetPod *corev1.Pod, name string, job *dpv1alpha1.JobActionSpec) (*corev1.PodSpec, error)
func (*Request) GetBackupType ¶
func (*Request) InjectManagerContainer ¶ added in v0.9.0
func (r *Request) InjectManagerContainer(podSpec *corev1.PodSpec, sync *dpv1alpha1.SyncProgress, command string)
InjectManagerContainer injects a sidecar that will sync the backup status or push the backup CR object to the backup repo.
type Scheduler ¶
type Scheduler struct { intctrlutil.RequestCtx Client client.Client Scheme *k8sruntime.Scheme BackupSchedule *dpv1alpha1.BackupSchedule BackupPolicy *dpv1alpha1.BackupPolicy WorkerServiceAccount string }