v1alpha1

package
v0.8.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: AGPL-3.0 Imports: 10 Imported by: 8

Documentation

Overview

+k8s:deepcopy-gen=package,register +k8s:openapi-gen=true +groupName=dataprotection.kubeblocks.io

Package v1alpha1 contains API Schema definitions for the dataprotection v1alpha1 API group +kubebuilder:object:generate=true +groupName=dataprotection.kubeblocks.io

Index

Constants

This section is empty.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "dataprotection.kubeblocks.io", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = GroupVersion

SchemeGroupVersion is group version used to register these objects.

Functions

func Resource added in v0.6.0

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type AccessMethod added in v0.7.0

type AccessMethod string

AccessMethod is an enum type that defines the access method of the backup repo.

const (
	// AccessMethodMount means that the storage is mounted locally,
	// so that remote files can be accessed just like a local file.
	AccessMethodMount AccessMethod = "Mount"
	// AccessMethodTool means to access the storage with a command-line tool,
	// which helps to transfer files between the storage and local.
	AccessMethodTool AccessMethod = "Tool"
)

type ActionErrorMode added in v0.7.0

type ActionErrorMode string

ActionErrorMode defines how should treat an error from an action. +kubebuilder:validation:Enum=Continue;Fail

const (
	// ActionErrorModeContinue means that an error from an action is acceptable.
	ActionErrorModeContinue ActionErrorMode = "Continue"

	// ActionErrorModeFail means that an error from an action is problematic.
	ActionErrorModeFail ActionErrorMode = "Fail"
)

type ActionPhase added in v0.7.0

type ActionPhase string
const (
	// ActionPhaseNew means the action has been created but not yet processed by
	// the BackupController.
	ActionPhaseNew ActionPhase = "New"

	// ActionPhaseRunning means the action is currently executing.
	ActionPhaseRunning ActionPhase = "Running"

	// ActionPhaseCompleted means the action has run successfully without errors.
	ActionPhaseCompleted ActionPhase = "Completed"

	// ActionPhaseFailed means the action ran but encountered an error that
	ActionPhaseFailed ActionPhase = "Failed"
)

type ActionSet added in v0.7.0

type ActionSet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ActionSetSpec   `json:"spec,omitempty"`
	Status ActionSetStatus `json:"status,omitempty"`
}

ActionSet is the Schema for the actionsets API

func (*ActionSet) HasPostReadyStage added in v0.7.0

func (r *ActionSet) HasPostReadyStage() bool

func (*ActionSet) HasPrepareDataStage added in v0.7.0

func (r *ActionSet) HasPrepareDataStage() bool

type ActionSetList added in v0.7.0

type ActionSetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ActionSet `json:"items"`
}

ActionSetList contains a list of ActionSet

type ActionSetSpec added in v0.7.0

type ActionSetSpec struct {
	// backupType specifies the backup type, supported values: Full, Continuous.
	// Full means full backup.
	// Incremental means back up data that have changed since the last backup (full or incremental).
	// Differential means back up data that have changed since the last full backup.
	// Continuous will back up the transaction log continuously, the PITR (Point in Time Recovery).
	// can be performed based on the continuous backup and full backup.
	// +kubebuilder:validation:Enum={Full,Incremental,Differential,Continuous}
	// +kubebuilder:default=Full
	// +kubebuilder:validation:Required
	BackupType BackupType `json:"backupType"`

	// List of environment variables to set in the container.
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

	// List of sources to populate environment variables in the container.
	// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
	// will be reported as an event when the container is starting. When a key exists in multiple
	// sources, the value associated with the last source will take precedence.
	// Values defined by an Env with a duplicate key will take precedence.
	// Cannot be updated.
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`

	// backup specifies the backup action.
	// +optional
	Backup *BackupActionSpec `json:"backup,omitempty"`

	// restore specifies the restore action.
	// +optional
	Restore *RestoreActionSpec `json:"restore,omitempty"`
}

ActionSetSpec defines the desired state of ActionSet

type ActionSetStatus added in v0.7.0

type ActionSetStatus struct {
	// phase - in list of [Available,Unavailable]
	// +optional
	Phase Phase `json:"phase,omitempty"`

	// A human-readable message indicating details about why the ActionSet is in this phase.
	// +optional
	Message string `json:"message,omitempty"`

	// generation number
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

ActionSetStatus defines the observed state of ActionSet

type ActionSpec added in v0.7.0

type ActionSpec struct {
	// exec specifies the action should be executed by the pod exec API in a container.
	// +optional
	Exec *ExecActionSpec `json:"exec,omitempty"`

	// job specifies the action should be executed by a Kubernetes Job.
	// +optional
	Job *JobActionSpec `json:"job,omitempty"`
}

ActionSpec defines an action that should be executed. Only one of the fields may be set.

type ActionStatus added in v0.7.0

type ActionStatus struct {
	// name is the name of the action.
	Name string `json:"name,omitempty"`

	// phase is the current state of the action.
	// +optional
	Phase ActionPhase `json:"phase,omitempty"`

	// startTimestamp records the time an action was started.
	// +optional
	StartTimestamp *metav1.Time `json:"startTimestamp,omitempty"`

	// completionTimestamp records the time an action was completed.
	// +optional
	CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`

	// failureReason is an error that caused the backup to fail.
	// +optional
	FailureReason string `json:"failureReason,omitempty"`

	// actionType is the type of the action.
	// +optional
	ActionType ActionType `json:"actionType,omitempty"`

	// availableReplicas available replicas for statefulSet action.
	// +optional
	AvailableReplicas *int32 `json:"availableReplicas,omitempty"`

	// objectRef is the object reference for the action.
	// +optional
	ObjectRef *corev1.ObjectReference `json:"objectRef,omitempty"`

	// totalSize is the total size of backed up data size.
	// A string with capacity units in the format of "1Gi", "1Mi", "1Ki".
	// +optional
	TotalSize string `json:"totalSize,omitempty"`

	// timeRange records the time range of backed up data, for PITR, this is the
	// time range of recoverable data.
	// +optional
	TimeRange *BackupTimeRange `json:"timeRange,omitempty"`

	// volumeSnapshots records the volume snapshot status for the action.
	// +optional
	VolumeSnapshots []VolumeSnapshotStatus `json:"volumeSnapshots,omitempty"`
}

type ActionType added in v0.7.0

type ActionType string
const (
	ActionTypeJob         ActionType = "Job"
	ActionTypeStatefulSet ActionType = "StatefulSet"
	ActionTypeNone        ActionType = ""
)

type Backup

type Backup struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   BackupSpec   `json:"spec,omitempty"`
	Status BackupStatus `json:"status,omitempty"`
}

Backup is the Schema for the backups API.

func (*Backup) GetEndTime added in v0.7.0

func (r *Backup) GetEndTime() *metav1.Time

GetEndTime gets the backup end time. Default return status.completionTimestamp, unless status.timeRange.endTime is not nil.

func (*Backup) GetStartTime added in v0.7.0

func (r *Backup) GetStartTime() *metav1.Time

GetStartTime gets the backup start time. Default return status.startTimestamp, unless status.timeRange.startTime is not nil.

type BackupActionSpec added in v0.7.0

type BackupActionSpec struct {
	// backupData specifies the backup data action.
	// +kubebuilder:validation:Required
	BackupData *BackupDataActionSpec `json:"backupData,omitempty"`

	// preBackup specifies a hook that should be executed before the backup.
	// +optional
	PreBackup []ActionSpec `json:"preBackup,omitempty"`

	// postBackup specifies a hook that should be executed after the backup.
	// +optional
	PostBackup []ActionSpec `json:"postBackup,omitempty"`
}

type BackupDataActionSpec added in v0.7.0

type BackupDataActionSpec struct {
	JobActionSpec `json:",inline"`

	// syncProgress specifies whether to sync the backup progress and its interval seconds.
	// +optional
	SyncProgress *SyncProgress `json:"syncProgress,omitempty"`
}

BackupDataActionSpec defines how to back up data.

type BackupDeletionPolicy added in v0.7.0

type BackupDeletionPolicy string

BackupDeletionPolicy describes a policy for end-of-life maintenance of backup content. +enum +kubebuilder:validation:Enum={Delete,Retain}

const (
	BackupDeletionPolicyDelete BackupDeletionPolicy = "Delete"
	BackupDeletionPolicyRetain BackupDeletionPolicy = "Retain"
)

type BackupList

type BackupList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Backup `json:"items"`
}

BackupList contains a list of Backup.

type BackupMethod added in v0.6.0

type BackupMethod struct {
	// the name of backup method.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	Name string `json:"name"`

	// snapshotVolumes specifies whether to take snapshots of persistent volumes.
	// if true, the BackupScript is not required, the controller will use the CSI
	// volume snapshotter to create the snapshot.
	// +optional
	// +kubebuilder:default=false
	SnapshotVolumes *bool `json:"snapshotVolumes,omitempty"`

	// actionSetName refers to the ActionSet object that defines the backup actions.
	// For volume snapshot backup, the actionSet is not required, the controller
	// will use the CSI volume snapshotter to create the snapshot.
	// +optional
	ActionSetName string `json:"actionSetName,omitempty"`

	// targetVolumes specifies which volumes from the target should be mounted in
	// the backup workload.
	// +optional
	TargetVolumes *TargetVolumeInfo `json:"targetVolumes,omitempty"`

	// env specifies the environment variables for the backup workload.
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty"`

	// runtimeSettings specifies runtime settings for the backup workload container.
	// +optional
	RuntimeSettings *RuntimeSettings `json:"runtimeSettings,omitempty"`
}

BackupMethod defines the backup method.

type BackupPhase

type BackupPhase string

BackupPhase is a string representation of the lifecycle phase of a Backup. +enum +kubebuilder:validation:Enum={New,InProgress,Running,Completed,Failed,Deleting}

const (
	// BackupPhaseNew means the backup has been created but not yet processed by
	// the BackupController.
	BackupPhaseNew BackupPhase = "New"

	// BackupPhaseRunning means the backup is currently executing.
	BackupPhaseRunning BackupPhase = "Running"

	// BackupPhaseCompleted means the backup has run successfully without errors.
	BackupPhaseCompleted BackupPhase = "Completed"

	// BackupPhaseFailed means the backup ran but encountered an error that
	// prevented it from completing successfully.
	BackupPhaseFailed BackupPhase = "Failed"

	// BackupPhaseDeleting means the backup and all its associated data are being deleted.
	BackupPhaseDeleting BackupPhase = "Deleting"
)

type BackupPolicy

type BackupPolicy struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   BackupPolicySpec   `json:"spec,omitempty"`
	Status BackupPolicyStatus `json:"status,omitempty"`
}

BackupPolicy is the Schema for the backuppolicies API.

type BackupPolicyList

type BackupPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []BackupPolicy `json:"items"`
}

BackupPolicyList contains a list of BackupPolicy

type BackupPolicyPhase

type BackupPolicyPhase string

BackupPolicyPhase defines phases for BackupPolicy. +enum +kubebuilder:validation:Enum={Available,Failed}

const (
	BackupPolicyAvailable BackupPolicyPhase = "Available"
	BackupPolicyFailed    BackupPolicyPhase = "Failed"
)

type BackupPolicySpec

type BackupPolicySpec struct {
	// backupRepoName is the name of BackupRepo and the backup data will be
	// stored in this repository. If not set, will be stored in the default
	// backup repository.
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +optional
	BackupRepoName *string `json:"backupRepoName,omitempty"`

	// pathPrefix is the directory inside the backup repository to store the backup content.
	// It is a relative to the path of the backup repository.
	// +optional
	PathPrefix string `json:"pathPrefix,omitempty"`

	// Specifies the number of retries before marking the backup failed.
	// +optional
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=10
	BackoffLimit *int32 `json:"backoffLimit,omitempty"`

	// target specifies the target information to back up.
	// +kubebuilder:validation:Required
	Target *BackupTarget `json:"target"`

	// backupMethods defines the backup methods.
	// +kubebuilder:validation:Required
	BackupMethods []BackupMethod `json:"backupMethods"`
}

BackupPolicySpec defines the desired state of BackupPolicy

type BackupPolicyStatus

type BackupPolicyStatus struct {
	// phase - in list of [Available,Unavailable]
	// +optional
	Phase Phase `json:"phase,omitempty"`

	// A human-readable message indicating details about why the BackupPolicy is
	// in this phase.
	// +optional
	Message string `json:"message,omitempty"`

	// observedGeneration is the most recent generation observed for this
	// BackupPolicy. It refers to the BackupPolicy's generation, which is
	// updated on mutation by the API Server.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

BackupPolicyStatus defines the observed state of BackupPolicy

type BackupRef added in v0.7.0

type BackupRef struct {
	// backup name
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// backup namespace
	// +kubebuilder:validation:Required
	Namespace string `json:"namespace"`
}

BackupRef describes the backup name and namespace.

type BackupRepo added in v0.6.0

type BackupRepo struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   BackupRepoSpec   `json:"spec,omitempty"`
	Status BackupRepoStatus `json:"status,omitempty"`
}

BackupRepo is the Schema for the backuprepos API

func (*BackupRepo) AccessByMount added in v0.7.0

func (repo *BackupRepo) AccessByMount() bool

func (*BackupRepo) AccessByTool added in v0.7.0

func (repo *BackupRepo) AccessByTool() bool

type BackupRepoList added in v0.6.0

type BackupRepoList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []BackupRepo `json:"items"`
}

BackupRepoList contains a list of BackupRepo

type BackupRepoPhase added in v0.6.0

type BackupRepoPhase string

BackupRepoPhase defines phases for BackupRepo CR. +enum +kubebuilder:validation:Enum={PreChecking,Failed,Ready,Deleting}

const (
	BackupRepoPreChecking BackupRepoPhase = "PreChecking"
	BackupRepoFailed      BackupRepoPhase = "Failed"
	BackupRepoReady       BackupRepoPhase = "Ready"
	BackupRepoDeleting    BackupRepoPhase = "Deleting"
)

type BackupRepoSpec added in v0.6.0

type BackupRepoSpec struct {
	// The storage provider used by this backup repo.
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="StorageProviderRef is immutable"
	// +kubebuilder:validation:Required
	StorageProviderRef string `json:"storageProviderRef"`

	// Specifies the access method of the backup repo.
	// +kubebuilder:validation:Enum={Mount,Tool}
	// +kubebuilder:default=Mount
	// +optional
	AccessMethod AccessMethod `json:"accessMethod,omitempty"`

	// The requested capacity for the PVC created by this backup repo.
	// +optional
	VolumeCapacity resource.Quantity `json:"volumeCapacity,omitempty"`

	// The reclaim policy for the PV created by this backup repo.
	// +kubebuilder:validation:Enum={Delete,Retain}
	// +kubebuilder:validation:Required
	PVReclaimPolicy corev1.PersistentVolumeReclaimPolicy `json:"pvReclaimPolicy"`

	// Non-secret configurations for the storage provider.
	// +optional
	Config map[string]string `json:"config,omitempty"`

	// A secret that contains the credentials needed by the storage provider.
	// +optional
	Credential *corev1.SecretReference `json:"credential,omitempty"`
}

BackupRepoSpec defines the desired state of BackupRepo

type BackupRepoStatus added in v0.6.0

type BackupRepoStatus struct {
	// Backup repo reconciliation phases. Valid values are PreChecking, Failed, Ready, Deleting.
	// +kubebuilder:validation:Enum={PreChecking,Failed,Ready,Deleting}
	// +optional
	Phase BackupRepoPhase `json:"phase,omitempty"`

	// conditions describes the current state of the repo.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// observedGeneration is the latest generation observed by the controller.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// generatedCSIDriverSecret references the generated secret used by the CSI driver.
	// +optional
	GeneratedCSIDriverSecret *corev1.SecretReference `json:"generatedCSIDriverSecret,omitempty"`

	// generatedStorageClassName indicates the generated storage class name.
	// +optional
	GeneratedStorageClassName string `json:"generatedStorageClassName,omitempty"`

	// backupPVCName is the name of the PVC used to store backup data.
	// +optional
	BackupPVCName string `json:"backupPVCName,omitempty"`

	// toolConfigSecretName is the name of the secret containing the configuration for the access tool.
	// +optional
	ToolConfigSecretName string `json:"toolConfigSecretName,omitempty"`

	// isDefault indicates whether this backup repo is the default one.
	// +optional
	IsDefault bool `json:"isDefault,omitempty"`
}

BackupRepoStatus defines the observed state of BackupRepo

type BackupSchedule added in v0.7.0

type BackupSchedule struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   BackupScheduleSpec   `json:"spec,omitempty"`
	Status BackupScheduleStatus `json:"status,omitempty"`
}

BackupSchedule is the Schema for the backupschedules API.

type BackupScheduleList added in v0.7.0

type BackupScheduleList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []BackupSchedule `json:"items"`
}

BackupScheduleList contains a list of BackupSchedule.

type BackupSchedulePhase added in v0.7.0

type BackupSchedulePhase string

BackupSchedulePhase defines the phase of BackupSchedule

const (
	// BackupSchedulePhaseAvailable means the backup schedule is available.
	BackupSchedulePhaseAvailable BackupSchedulePhase = "Available"

	// BackupSchedulePhaseFailed means the backup schedule is failed.
	BackupSchedulePhaseFailed BackupSchedulePhase = "Failed"
)

type BackupScheduleSpec added in v0.7.0

type BackupScheduleSpec struct {
	// Which backupPolicy is applied to perform this backup.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	BackupPolicyName string `json:"backupPolicyName"`

	// startingDeadlineMinutes defines the deadline in minutes for starting the
	// backup workload if it misses scheduled time for any reason.
	// +optional
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=1440
	StartingDeadlineMinutes *int64 `json:"startingDeadlineMinutes,omitempty"`

	// schedules defines the list of backup schedules.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	Schedules []SchedulePolicy `json:"schedules"`
}

BackupScheduleSpec defines the desired state of BackupSchedule.

type BackupScheduleStatus added in v0.7.0

type BackupScheduleStatus struct {
	// phase describes the phase of the BackupSchedule.
	// +optional
	Phase BackupSchedulePhase `json:"phase,omitempty"`

	// observedGeneration is the most recent generation observed for this
	// BackupSchedule. It refers to the BackupSchedule's generation, which is
	// updated on mutation by the API Server.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// failureReason is an error that caused the backup to fail.
	// +optional
	FailureReason string `json:"failureReason,omitempty"`

	// schedules describes the status of each schedule.
	// +optional
	Schedules map[string]ScheduleStatus `json:"schedules,omitempty"`
}

BackupScheduleStatus defines the observed state of BackupSchedule.

type BackupSpec

type BackupSpec struct {
	// Which backupPolicy is applied to perform this backup.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.backupPolicyName"
	BackupPolicyName string `json:"backupPolicyName"`

	// backupMethod specifies the backup method name that is defined in backupPolicy.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.backupMethod"
	BackupMethod string `json:"backupMethod"`

	// deletionPolicy determines whether the backup contents stored in backup repository
	// should be deleted when the backup custom resource is deleted.
	// Supported values are "Retain" and "Delete".
	// "Retain" means that the backup can not be deleted and remains in 'Deleting' phase.
	// "Delete" means that the backup content and its physical snapshot on backup repository are deleted.
	// +kubebuilder:validation:Enum=Delete;Retain
	// +kubebuilder:validation:Required
	// +kubebuilder:default=Delete
	DeletionPolicy BackupDeletionPolicy `json:"deletionPolicy,omitempty"`

	// retentionPeriod determines a duration up to which the backup should be kept.
	// Controller will remove all backups that are older than the RetentionPeriod.
	// For example, RetentionPeriod of `30d` will keep only the backups of last 30 days.
	// Sample duration format:
	// - years: 	2y
	// - months: 	6mo
	// - days: 		30d
	// - hours: 	12h
	// - minutes: 	30m
	// You can also combine the above durations. For example: 30d12h30m.
	// If not set, the backup will be kept forever.
	// +optional
	RetentionPeriod RetentionPeriod `json:"retentionPeriod,omitempty"`

	// parentBackupName determines the parent backup name for incremental or
	// differential backup.
	// +optional
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.parentBackupName"
	ParentBackupName string `json:"parentBackupName,omitempty"`
}

BackupSpec defines the desired state of Backup.

type BackupStatus

type BackupStatus struct {
	// formatVersion is the backup format version, including major, minor and patch version.
	// +optional
	FormatVersion string `json:"formatVersion,omitempty"`

	// phase is the current state of the Backup.
	// +optional
	Phase BackupPhase `json:"phase,omitempty"`

	// expiration is when this backup is eligible for garbage collection.
	// 'null' means the Backup will NOT be cleaned except delete manual.
	// +optional
	Expiration *metav1.Time `json:"expiration,omitempty"`

	// startTimestamp records the time a backup was started.
	// The server's time is used for StartTimestamp.
	// +optional
	StartTimestamp *metav1.Time `json:"startTimestamp,omitempty"`

	// completionTimestamp records the time a backup was completed.
	// Completion time is recorded even on failed backups.
	// The server's time is used for CompletionTimestamp.
	// +optional
	CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`

	// The duration time of backup execution.
	// When converted to a string, the format is "1h2m0.5s".
	// +optional
	Duration *metav1.Duration `json:"duration,omitempty"`

	// totalSize is the total size of backed up data size.
	// A string with capacity units in the format of "1Gi", "1Mi", "1Ki".
	// If no capacity unit is specified, it is assumed to be in bytes.
	// +optional
	TotalSize string `json:"totalSize,omitempty"`

	// failureReason is an error that caused the backup to fail.
	// +optional
	FailureReason string `json:"failureReason,omitempty"`

	// backupRepoName is the name of the backup repository.
	// +optional
	BackupRepoName string `json:"backupRepoName,omitempty"`

	// path is the directory inside the backup repository where the backup data is stored.
	// It is an absolute path in the backup repository.
	// +optional
	Path string `json:"path,omitempty"`

	// persistentVolumeClaimName is the name of the persistent volume claim that
	// is used to store the backup data.
	// +optional
	PersistentVolumeClaimName string `json:"persistentVolumeClaimName,omitempty"`

	// timeRange records the time range of backed up data, for PITR, this is the
	// time range of recoverable data.
	// +optional
	TimeRange *BackupTimeRange `json:"timeRange,omitempty"`

	// target records the target information for this backup.
	// +optional
	Target *BackupTarget `json:"target,omitempty"`

	// backupMethod records the backup method information for this backup.
	// Refer to BackupMethod for more details.
	// +optional
	BackupMethod *BackupMethod `json:"backupMethod,omitempty"`

	// actions records the actions information for this backup.
	// +optional
	Actions []ActionStatus `json:"actions,omitempty"`

	// volumeSnapshots records the volume snapshot status for the action.
	// +optional
	VolumeSnapshots []VolumeSnapshotStatus `json:"volumeSnapshots,omitempty"`
}

BackupStatus defines the observed state of Backup.

type BackupTarget added in v0.7.0

type BackupTarget struct {
	// podSelector is used to find the target pod. The volumes of the target pod
	// will be backed up.
	// +kube:validation:Required
	PodSelector *PodSelector `json:"podSelector,omitempty"`

	// connectionCredential specifies the connection credential to connect to the
	// target database cluster.
	// +optional
	ConnectionCredential *ConnectionCredential `json:"connectionCredential,omitempty"`

	// resources specifies the kubernetes resources to back up.
	// +optional
	Resources *KubeResources `json:"resources,omitempty"`

	// serviceAccountName specifies the service account to run the backup workload.
	// +kubebuilder:validation:Required
	ServiceAccountName string `json:"serviceAccountName,omitempty"`
}

type BackupTimeRange added in v0.7.0

type BackupTimeRange struct {
	// start records the start time of backup.
	// +optional
	Start *metav1.Time `json:"start,omitempty"`

	// end records the end time of backup.
	// +optional
	End *metav1.Time `json:"end,omitempty"`
}

BackupTimeRange records the time range of backed up data, for PITR, this is the time range of recoverable data.

type BackupType

type BackupType string

BackupType the backup type. +enum +kubebuilder:validation:Enum={Full,Incremental,Differential,Continuous}

const (
	BackupTypeFull         BackupType = "Full"
	BackupTypeIncremental  BackupType = "Incremental"
	BackupTypeDifferential BackupType = "Differential"
	BackupTypeContinuous   BackupType = "Continuous"
)

type ConnectionCredential added in v0.7.0

type ConnectionCredential struct {
	// secretName refers to the Secret object that contains the connection credential.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
	SecretName string `json:"secretName"`

	// usernameKey specifies the map key of the user in the connection credential secret.
	// +kubebuilder:default=username
	UsernameKey string `json:"usernameKey,omitempty"`

	// passwordKey specifies the map key of the password in the connection credential secret.
	// This password will be saved in the backup annotation for full backup.
	// You can use the environment variable DP_ENCRYPTION_KEY to specify encryption key.
	// +kubebuilder:default=password
	PasswordKey string `json:"passwordKey,omitempty"`

	// hostKey specifies the map key of the host in the connection credential secret.
	HostKey string `json:"hostKey,omitempty"`

	// portKey specifies the map key of the port in the connection credential secret.
	PortKey string `json:"portKey,omitempty"`
}

ConnectionCredential specifies the connection credential to connect to the target database cluster.

type ExecAction added in v0.7.0

type ExecAction struct {
	// execActionTarget defines the pods that need to be executed for the exec action.
	// will execute on all pods that meet the conditions.
	// +optional
	Target ExecActionTarget `json:"target"`
}

type ExecActionSpec added in v0.7.0

type ExecActionSpec struct {
	// container is the container in the pod where the command should be executed.
	// If not specified, the pod's first container is used.
	// +optional
	Container string `json:"container,omitempty"`

	// Command is the command and arguments to execute.
	// +kubebuilder:validation:MinItems=1
	Command []string `json:"command"`

	// OnError specifies how should behave if it encounters an error executing this action.
	// +optional
	// +kubebuilder:default=Fail
	OnError ActionErrorMode `json:"onError,omitempty"`

	// Timeout defines the maximum amount of time should wait for the hook to complete before
	// considering the execution a failure.
	// +optional
	Timeout metav1.Duration `json:"timeout,omitempty"`
}

ExecActionSpec is an action that uses the pod exec API to execute a command in a container in a pod.

type ExecActionTarget added in v0.7.0

type ExecActionTarget struct {
	// kubectl exec in all selected pods.
	// +kubebuilder:validation:Required
	PodSelector metav1.LabelSelector `json:"podSelector"`
}

type IncludeResource added in v0.7.0

type IncludeResource struct {
	//
	// +kubebuilder:validation:Required
	GroupResource string `json:"groupResource"`

	// select the specified resource for recovery by label.
	// +optional
	LabelSelector metav1.LabelSelector `json:"labelSelector,omitempty"`
}

type JobAction added in v0.7.0

type JobAction struct {
	// jobActionTarget defines the pod that need to be executed for the job action.
	//  will select a pod that meets the conditions to execute.
	// +kubebuilder:validation:Required
	Target JobActionTarget `json:"target"`
}

type JobActionSpec added in v0.7.0

type JobActionSpec struct {
	// image specifies the image of backup container.
	// +kubebuilder:validation:Required
	Image string `json:"image"`

	// runOnTargetPodNode specifies whether to run the job workload on the
	// target pod node. If backup container should mount the target pod's
	// volumes, this field should be set to true. otherwise the target pod's
	// volumes will be ignored.
	// +optional
	// +kubebuilder:default=false
	RunOnTargetPodNode *bool `json:"runOnTargetPodNode,omitempty"`

	// command specifies the commands to back up the volume data.
	// +kubebuilder:validation:Required
	Command []string `json:"command"`

	// OnError specifies how should behave if it encounters an error executing
	// this action.
	// +optional
	// +kubebuilder:default=Fail
	OnError ActionErrorMode `json:"onError,omitempty"`
}

JobActionSpec is an action that creates a Kubernetes Job to execute a command.

type JobActionTarget added in v0.7.0

type JobActionTarget struct {
	// select one of the pods which selected by labels to build the job spec, such as mount required volumes and inject built-in env of the selected pod.
	// +kubebuilder:validation:Required
	PodSelector metav1.LabelSelector `json:"podSelector"`

	// volumeMounts defines which volumes of the selected pod need to be mounted on the restoring pod.
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +optional
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

type KubeResources added in v0.7.0

type KubeResources struct {
	// selector is a metav1.LabelSelector to filter the target kubernetes resources
	// that need to be backed up.
	// If not set, will do not back up any kubernetes resources.
	// +kube:validation:Required
	Selector *metav1.LabelSelector `json:"selector,omitempty"`

	// included is a slice of namespaced-scoped resource type names to include in
	// the kubernetes resources.
	// The default value is "*", which means all resource types will be included.
	// +optional
	// +kubebuilder:default={"*"}
	Included []string `json:"included,omitempty"`

	// excluded is a slice of namespaced-scoped resource type names to exclude in
	// the kubernetes resources.
	// The default value is empty.
	// +optional
	Excluded []string `json:"excluded,omitempty"`
}

KubeResources defines the kubernetes resources to back up.

type Phase added in v0.7.0

type Phase string

Phase defines the BackupPolicy and ActionSet CR .status.phase +enum +kubebuilder:validation:Enum={Available,Unavailable}

const (
	AvailablePhase   Phase = "Available"
	UnavailablePhase Phase = "Unavailable"
)

func (Phase) IsAvailable added in v0.7.0

func (p Phase) IsAvailable() bool

type PodSelectionStrategy added in v0.7.0

type PodSelectionStrategy string

PodSelectionStrategy specifies the strategy to select when multiple pods are selected for backup target +kubebuilder:validation:Enum=Any

const (
	// PodSelectionStrategyAll selects all pods that match the labelsSelector.
	// TODO: support PodSelectionStrategyAll
	PodSelectionStrategyAll PodSelectionStrategy = "All"

	// PodSelectionStrategyAny selects any one pod that match the labelsSelector.
	PodSelectionStrategyAny PodSelectionStrategy = "Any"
)

type PodSelector added in v0.7.0

type PodSelector struct {
	// labelsSelector is the label selector to filter the target pods.
	*metav1.LabelSelector `json:",inline"`

	// strategy specifies the strategy to select the target pod when multiple pods
	// are selected.
	// Valid values are:
	// - Any: select any one pod that match the labelsSelector.
	// +kubebuilder:default=Any
	Strategy PodSelectionStrategy `json:"strategy,omitempty"`
}

type PrepareDataConfig added in v0.7.0

type PrepareDataConfig struct {
	// dataSourceRef describes the configuration when using `persistentVolumeClaim.spec.dataSourceRef` method for restoring.
	// it describes the source volume of the backup targetVolumes and how to mount path in the restoring container.
	// +kubebuilder:validation:XValidation:rule="self.volumeSource != ” || self.mountPath !=”",message="at least one exists for volumeSource and mountPath."
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.prepareDataConfig.dataSourceRef"
	// +optional
	DataSourceRef *VolumeConfig `json:"dataSourceRef,omitempty"`

	// volumeClaims defines the persistent Volume claims that need to be restored and mount them together into the restore job.
	// these persistent Volume claims will be created if not exist.
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.prepareDataConfig.volumeClaims"
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +optional
	RestoreVolumeClaims []RestoreVolumeClaim `json:"volumeClaims,omitempty"`

	// volumeClaimsTemplate defines a template to build persistent Volume claims that need to be restored.
	// these claims will be created in an orderly manner based on the number of replicas or reused if already exist.
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.prepareDataConfig.volumeClaimsTemplate"
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +optional
	RestoreVolumeClaimsTemplate *RestoreVolumeClaimsTemplate `json:"volumeClaimsTemplate,omitempty"`

	// VolumeClaimRestorePolicy defines restore policy for persistent volume claim.
	// Supported policies are as follows:
	// 1. Parallel: parallel recovery of persistent volume claim.
	// 2. Serial: restore the persistent volume claim in sequence, and wait until the previous persistent volume claim is restored before restoring a new one.
	// +kubebuilder:default=Parallel
	// +kubebuilder:validation:Required
	VolumeClaimRestorePolicy VolumeClaimRestorePolicy `json:"volumeClaimRestorePolicy"`

	// scheduling spec for restoring pod.
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.prepareDataConfig.schedulingSpec"
	// +optional
	SchedulingSpec SchedulingSpec `json:"schedulingSpec,omitempty"`
}

func (*PrepareDataConfig) IsSerialPolicy added in v0.7.0

func (p *PrepareDataConfig) IsSerialPolicy() bool

type ReadinessProbe added in v0.7.0

type ReadinessProbe struct {
	// number of seconds after the container has started before probe is initiated.
	// +optional
	// +kubebuilder:validation:Minimum=0
	InitialDelaySeconds int `json:"initialDelaySeconds,omitempty"`

	// number of seconds after which the probe times out.
	// defaults to 30 second, minimum value is 1.
	// +optional
	// +kubebuilder:default=30
	// +kubebuilder:validation:Minimum=1
	TimeoutSeconds int `json:"timeoutSeconds"`

	// how often (in seconds) to perform the probe.
	// defaults to 5 second, minimum value is 1.
	// +optional
	// +kubebuilder:default=5
	// +kubebuilder:validation:Minimum=1
	PeriodSeconds int `json:"periodSeconds"`

	// exec specifies the action to take.
	// +kubebuilder:validation:Required
	Exec ReadinessProbeExecAction `json:"exec"`
}

type ReadinessProbeExecAction added in v0.7.0

type ReadinessProbeExecAction struct {
	// refer to container image.
	// +kubebuilder:validation:Required
	Image string `json:"image"`

	// refer to container command.
	// +kubebuilder:validation:Required
	Command []string `json:"command"`
}

type ReadyConfig added in v0.7.0

type ReadyConfig struct {
	// configuration for job action.
	// +optional
	JobAction *JobAction `json:"jobAction,omitempty"`

	// configuration for exec action.
	// +optional
	ExecAction *ExecAction `json:"execAction,omitempty"`

	// credential template used for creating a connection credential
	// +optional
	ConnectionCredential *ConnectionCredential `json:"connectionCredential,omitempty"`

	// periodic probe of the service readiness.
	// controller will perform postReadyHooks of BackupScript.spec.restore after the service readiness when readinessProbe is configured.
	// +optional
	ReadinessProbe *ReadinessProbe `json:"readinessProbe,omitempty"`
}

type Restore added in v0.7.0

type Restore struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   RestoreSpec   `json:"spec,omitempty"`
	Status RestoreStatus `json:"status,omitempty"`
}

Restore is the Schema for the restores API

type RestoreActionSpec added in v0.7.0

type RestoreActionSpec struct {
	// prepareData specifies the action to prepare data.
	// +optional
	PrepareData *JobActionSpec `json:"prepareData,omitempty"`

	// postReady specifies the action to execute after the data is ready.
	// +optional
	PostReady []ActionSpec `json:"postReady,omitempty"`
}

RestoreActionSpec defines how to restore data.

type RestoreActionStatus added in v0.7.0

type RestoreActionStatus string

RestoreActionStatus the status of restore action. +enum +kubebuilder:validation:Enum={Processing,Completed,Failed}

const (
	RestoreActionProcessing RestoreActionStatus = "Processing"
	RestoreActionCompleted  RestoreActionStatus = "Completed"
	RestoreActionFailed     RestoreActionStatus = "Failed"
)

type RestoreKubeResources added in v0.7.0

type RestoreKubeResources struct {
	// will restore the specified resources
	IncludeResources []IncludeResource `json:"included,omitempty"`
}

type RestoreList added in v0.7.0

type RestoreList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Restore `json:"items"`
}

RestoreList contains a list of Restore

type RestorePhase added in v0.7.0

type RestorePhase string

RestorePhase The current phase. Valid values are Running, Completed, Failed, AsDataSource. +enum +kubebuilder:validation:Enum={Running,Completed,Failed,AsDataSource}

const (
	RestorePhaseRunning      RestorePhase = "Running"
	RestorePhaseCompleted    RestorePhase = "Completed"
	RestorePhaseFailed       RestorePhase = "Failed"
	RestorePhaseAsDataSource RestorePhase = "AsDataSource"
)

type RestoreSpec added in v0.7.0

type RestoreSpec struct {
	// backup to be restored. The restore behavior based on the backup type:
	// 1. Full: will be restored the full backup directly.
	// 2. Incremental: will be restored sequentially from the most recent full backup of this incremental backup.
	// 3. Differential: will be restored sequentially from the parent backup of the differential backup.
	// 4. Continuous: will find the most recent full backup at this time point and the continuous backups after it to restore.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.backupName"
	Backup BackupRef `json:"backup"`

	// restoreTime is the point in time for restoring.
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.restoreTime"
	// +optional
	// +kubebuilder:validation:Pattern=`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$`
	RestoreTime string `json:"restoreTime,omitempty"`

	// restore the specified resources of kubernetes.
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update spec.resources"
	// +optional
	Resources *RestoreKubeResources `json:"resources,omitempty"`

	// configuration for the action of "prepareData" phase, including the persistent volume claims
	// that need to be restored and scheduling strategy of temporary recovery pod.
	// +optional
	PrepareDataConfig *PrepareDataConfig `json:"prepareDataConfig,omitempty"`

	// service account name which needs for recovery pod.
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// configuration for the action of "postReady" phase.
	// +kubebuilder:validation:XValidation:rule="has(self.jobAction) || has(self.execAction)", message="at least one exists for jobAction and execAction."
	// +optional
	ReadyConfig *ReadyConfig `json:"readyConfig,omitempty"`

	// list of environment variables to set in the container for restore and will be
	// merged with the env of Backup and ActionSet.
	// The priority of merging is as follows: Restore env > Backup env > ActionSet env.
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

	// specified the required resources of restore job's container.
	// +optional
	ContainerResources corev1.ResourceRequirements `json:"containerResources,omitempty"`
}

RestoreSpec defines the desired state of Restore

type RestoreStage added in v0.7.0

type RestoreStage string
const (
	PrepareData RestoreStage = "prepareData"
	PostReady   RestoreStage = "postReady"
)

type RestoreStatus added in v0.7.0

type RestoreStatus struct {
	// +optional
	Phase RestorePhase `json:"phase,omitempty"`

	// Date/time when the restore started being processed.
	// +optional
	StartTimestamp *metav1.Time `json:"startTimestamp,omitempty"`

	// Date/time when the restore finished being processed.
	// +optional
	CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`

	// The duration time of restore execution.
	// When converted to a string, the form is "1h2m0.5s".
	// +optional
	Duration *metav1.Duration `json:"duration,omitempty"`

	// recorded all restore actions performed.
	// +optional
	Actions RestoreStatusActions `json:"actions,omitempty"`

	// describe current state of restore API Resource, like warning.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

RestoreStatus defines the observed state of Restore

type RestoreStatusAction added in v0.7.0

type RestoreStatusAction struct {
	// name describes the name of the recovery action based on the current backup.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// which backup's restore action belongs to.
	// +kubebuilder:validation:Required
	BackupName string `json:"backupName"`

	// the execution object of the restore action.
	// +kubebuilder:validation:Required
	ObjectKey string `json:"objectKey"`

	// message is a human readable message indicating details about the object condition.
	// +optional
	Message string `json:"message,omitempty"`

	// the status of this action.
	// +kubebuilder:validation:Required
	Status RestoreActionStatus `json:"status,omitempty"`

	// startTime is the start time for the restore job.
	// +optional
	StartTime metav1.Time `json:"startTime,omitempty"`

	// endTime is the completion time for the restore job.
	// +optional
	EndTime metav1.Time `json:"endTime,omitempty"`
}

type RestoreStatusActions added in v0.7.0

type RestoreStatusActions struct {
	// record the actions for prepareData phase.
	// +patchMergeKey=jobName
	// +patchStrategy=merge,retainKeys
	// +optional
	PrepareData []RestoreStatusAction `json:"prepareData,omitempty"`

	// record the actions for postReady phase.
	// +patchMergeKey=jobName
	// +patchStrategy=merge,retainKeys
	// +optional
	PostReady []RestoreStatusAction `json:"postReady,omitempty"`
}

type RestoreVolumeClaim added in v0.7.0

type RestoreVolumeClaim struct {
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	// +kubebuilder:validation:Required
	metav1.ObjectMeta `json:"metadata"`

	// volumeClaimSpec defines the desired characteristics of a persistent volume claim.
	// +kubebuilder:validation:Required
	VolumeClaimSpec corev1.PersistentVolumeClaimSpec `json:"volumeClaimSpec"`

	// describing the source volume of the backup targetVolumes and how to mount path in the restoring container.
	// +kubebuilder:validation:XValidation:rule="self.volumeSource != ” || self.mountPath !=”",message="at least one exists for volumeSource and mountPath."
	VolumeConfig `json:",inline"`
}

type RestoreVolumeClaimsTemplate added in v0.7.0

type RestoreVolumeClaimsTemplate struct {
	// templates is a list of volume claims.
	// +kubebuilder:validation:Required
	Templates []RestoreVolumeClaim `json:"templates"`

	// the replicas of persistent volume claim which need to be created and restored.
	// the format of created claim name is "<template-name>-<index>".
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Required
	Replicas int32 `json:"replicas"`

	// the starting index for the created persistent volume claim by according to template.
	// minimum is 0.
	// +kubebuilder:validation:Minimum=0
	StartingIndex int32 `json:"startingIndex,omitempty"`
}

type RetentionPeriod added in v0.7.0

type RetentionPeriod string

RetentionPeriod represents a duration in the format "1y2mo3w4d5h6m", where y=year, mo=month, w=week, d=day, h=hour, m=minute.

func (RetentionPeriod) String added in v0.7.0

func (r RetentionPeriod) String() string

func (RetentionPeriod) ToDuration added in v0.7.0

func (r RetentionPeriod) ToDuration() (time.Duration, error)

ToDuration converts the RetentionPeriod to time.Duration.

type RuntimeSettings added in v0.7.0

type RuntimeSettings struct {
	// resources specifies the resource required by container.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}

type SchedulePhase added in v0.7.0

type SchedulePhase string

SchedulePhase defines the phase of schedule

const (
	ScheduleRunning SchedulePhase = "Running"
	ScheduleFailed  SchedulePhase = "Failed"
)

type SchedulePolicy

type SchedulePolicy struct {
	// enabled specifies whether the backup schedule is enabled or not.
	// +optional
	Enabled *bool `json:"enabled,omitempty"`

	// backupMethod specifies the backup method name that is defined in backupPolicy.
	// +kubebuilder:validation:Required
	BackupMethod string `json:"backupMethod"`

	// the cron expression for schedule, the timezone is in UTC.
	// see https://en.wikipedia.org/wiki/Cron.
	// +kubebuilder:validation:Required
	CronExpression string `json:"cronExpression"`

	// retentionPeriod determines a duration up to which the backup should be kept.
	// controller will remove all backups that are older than the RetentionPeriod.
	// For example, RetentionPeriod of `30d` will keep only the backups of last 30 days.
	// Sample duration format:
	// - years: 	2y
	// - months: 	6mo
	// - days: 		30d
	// - hours: 	12h
	// - minutes: 	30m
	// You can also combine the above durations. For example: 30d12h30m
	// +optional
	// +kubebuilder:default="7d"
	RetentionPeriod RetentionPeriod `json:"retentionPeriod,omitempty"`
}

type ScheduleStatus added in v0.7.0

type ScheduleStatus struct {
	// phase describes the phase of the schedule.
	// +optional
	Phase SchedulePhase `json:"phase,omitempty"`

	// failureReason is an error that caused the backup to fail.
	// +optional
	FailureReason string `json:"failureReason,omitempty"`

	// lastScheduleTime records the last time the backup was scheduled.
	// +optional
	LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`

	// lastSuccessfulTime records the last time the backup was successfully completed.
	// +optional
	LastSuccessfulTime *metav1.Time `json:"lastSuccessfulTime,omitempty"`
}

ScheduleStatus defines the status of each schedule.

type SchedulingSpec added in v0.7.0

type SchedulingSpec struct {
	// the restoring pod's tolerations.
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// nodeSelector is a selector which must be true for the pod to fit on a node.
	// Selector which must match a node's labels for the pod to be scheduled on that node.
	// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	// +optional
	// +mapType=atomic
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// nodeName is a request to schedule this pod onto a specific node. If it is non-empty,
	// the scheduler simply schedules this pod onto that node, assuming that it fits resource
	// requirements.
	// +optional
	NodeName string `json:"nodeName,omitempty"`

	// affinity is a group of affinity scheduling rules.
	// refer to https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`

	// topologySpreadConstraints describes how a group of pods ought to spread across topology
	// domains. Scheduler will schedule pods in a way which abides by the constraints.
	// refer to https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
	// +optional
	TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`

	// If specified, the pod will be dispatched by specified scheduler.
	// If not specified, the pod will be dispatched by default scheduler.
	// +optional
	SchedulerName string `json:"schedulerName,omitempty"`
}

type SyncProgress added in v0.7.0

type SyncProgress struct {
	// enabled specifies whether to sync the backup progress. If enabled,
	// a sidecar container will be created to sync the backup progress to the
	// Backup CR status.
	// +optional
	Enabled *bool `json:"enabled,omitempty"`

	// intervalSeconds specifies the interval seconds to sync the backup progress.
	// +optional
	// +kubebuilder:default=60
	IntervalSeconds *int32 `json:"intervalSeconds,omitempty"`
}

type TargetVolumeInfo added in v0.7.0

type TargetVolumeInfo struct {
	// Volumes indicates the list of volumes of targeted application that should
	// be mounted on the backup job.
	// +optional
	Volumes []string `json:"volumes,omitempty"`

	// volumeMounts specifies the mount for the volumes specified in `Volumes` section.
	// +optional
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

TargetVolumeInfo specifies the volumes and their mounts of the targeted application that should be mounted in backup workload.

type VolumeClaimRestorePolicy added in v0.7.0

type VolumeClaimRestorePolicy string

VolumeClaimRestorePolicy defines restore policy for persistent volume claim. Supported policies are as follows: 1. Parallel: parallel recovery of persistent volume claim. 2. Serial: restore the persistent volume claim in sequence, and wait until the previous persistent volume claim is restored before restoring a new one. +enum +kubebuilder:validation:Enum={Parallel,Serial}

const (
	VolumeClaimRestorePolicyParallel VolumeClaimRestorePolicy = "Parallel"
	VolumeClaimRestorePolicySerial   VolumeClaimRestorePolicy = "Serial"
)

type VolumeConfig added in v0.7.0

type VolumeConfig struct {
	// volumeSource describes the volume will be restored from the specified volume of the backup targetVolumes.
	// required if the backup uses volume snapshot.
	// +optional
	VolumeSource string `json:"volumeSource,omitempty"`

	// mountPath path within the restoring container at which the volume should be mounted.
	// +optional
	MountPath string `json:"mountPath,omitempty"`
}

type VolumeSnapshotStatus added in v0.7.0

type VolumeSnapshotStatus struct {
	// name is the name of the volume snapshot.
	Name string `json:"name,omitempty"`

	// contentName is the name of the volume snapshot content.
	ContentName string `json:"contentName,omitempty"`

	// volumeName is the name of the volume.
	// +optional
	VolumeName string `json:"volumeName,omitempty"`

	// size is the size of the volume snapshot.
	// +optional
	Size string `json:"size,omitempty"`
}

Jump to

Keyboard shortcuts

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