跳到主要内容

备份 API 参考


Packages:

dataprotection.kubeblocks.io/v1alpha1

Resource Types:

Backup

Backup is the Schema for the backups API (defined by User).


FieldDescription
apiVersion
string
dataprotection.kubeblocks.io/v1alpha1
kind
string
Backup
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of themetadata field.
spec
BackupSpec


backupPolicyName
string

Which backupPolicy is applied to perform this backup


backupType
BackupType

Backup Type. datafile or logfile or snapshot. If not set, datafile is the default type.


parentBackupName
string
(Optional)

if backupType is incremental, parentBackupName is required.


status
BackupStatus

BackupPolicy

BackupPolicy is the Schema for the backuppolicies API (defined by User)


FieldDescription
apiVersion
string
dataprotection.kubeblocks.io/v1alpha1
kind
string
BackupPolicy
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of themetadata field.
spec
BackupPolicySpec


retention
RetentionSpec
(Optional)

retention describe how long the Backup should be retained. if not set, will be retained forever.


schedule
Schedule
(Optional)

schedule policy for backup.


snapshot
SnapshotPolicy
(Optional)

the policy for snapshot backup.


datafile
CommonBackupPolicy
(Optional)

the policy for datafile backup.


logfile
CommonBackupPolicy
(Optional)

the policy for logfile backup.


status
BackupPolicyStatus

BackupRepo

BackupRepo is the Schema for the backuprepos API


FieldDescription
apiVersion
string
dataprotection.kubeblocks.io/v1alpha1
kind
string
BackupRepo
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of themetadata field.
spec
BackupRepoSpec


storageProviderRef
string

The storage provider used by this backup repo.


volumeCapacity
Kubernetes resource.Quantity
(Optional)

The requested capacity for the PVC created by this backup repo.


pvReclaimPolicy
Kubernetes core/v1.PersistentVolumeReclaimPolicy

The reclaim policy for the PV created by this backup repo.


config
map[string]string
(Optional)

Non-secret configurations for the storage provider.


credential
Kubernetes core/v1.SecretReference
(Optional)

A secret that contains the credentials needed by the storage provider.


status
BackupRepoStatus

BackupTool

BackupTool is the Schema for the backuptools API (defined by provider)


FieldDescription
apiVersion
string
dataprotection.kubeblocks.io/v1alpha1
kind
string
BackupTool
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of themetadata field.
spec
BackupToolSpec


image
string

Backup tool Container image name.


deployKind
DeployKind

which kind for run a backup tool, supported values: job, statefulSet.


type
string

the type of backup tool, file or pitr


resources
Kubernetes core/v1.ResourceRequirements
(Optional)

Compute Resources required by this container.
Cannot be updated.


env
[]Kubernetes core/v1.EnvVar
(Optional)

List of environment variables to set in the container.


envFrom
[]Kubernetes core/v1.EnvFromSource
(Optional)

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.


backupCommands
[]string

Array of command that apps can do database backup.
from invoke args
the order of commands follows the order of array.


incrementalBackupCommands
[]string
(Optional)

Array of command that apps can do database incremental backup.
like xtrabackup, that can performs an incremental backup file.


physical
PhysicalConfig
(Optional)

backup tool can support physical restore, in this case, restore must be RESTART database.


logical
LogicalConfig
(Optional)

backup tool can support logical restore, in this case, restore NOT RESTART database.


status
BackupToolStatus

RestoreJob

RestoreJob is the Schema for the restorejobs API (defined by User)


FieldDescription
apiVersion
string
dataprotection.kubeblocks.io/v1alpha1
kind
string
RestoreJob
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of themetadata field.
spec
RestoreJobSpec


backupJobName
string

Specified one backupJob to restore.


target
TargetCluster

the target database workload to restore


targetVolumes
[]Kubernetes core/v1.Volume

array of restore volumes .


targetVolumeMounts
[]Kubernetes core/v1.VolumeMount

array of restore volume mounts .


onFailAttempted
int32
(Optional)

count of backup stop retries on fail.


status
RestoreJobStatus

BackupLogStatus

(Appears on:ManifestsStatus)

FieldDescription
startTime
Kubernetes meta/v1.Time
(Optional)

startTime records the start time of data logging.


stopTime
Kubernetes meta/v1.Time
(Optional)

stopTime records the stop time of data logging.


BackupMethod(string alias)

BackupMethod the backup method


ValueDescription

"backupTool"

"snapshot"

BackupPhase(string alias)

(Appears on:BackupStatus)

BackupPhase The current phase. Valid values are New, InProgress, Completed, Failed.


ValueDescription

"Completed"

"Deleting"

"Failed"

"InProgress"

"New"

"Running"

BackupPolicyHook

(Appears on:SnapshotPolicy)

BackupPolicyHook defines for the database execute commands before and after backup.


FieldDescription
preCommands
[]string
(Optional)

pre backup to perform commands


postCommands
[]string
(Optional)

post backup to perform commands


image
string
(Optional)

exec command with image


containerName
string
(Optional)

which container can exec command


BackupPolicyPhase(string alias)

(Appears on:BackupPolicyStatus)

BackupPolicyPhase defines phases for BackupPolicy CR.


ValueDescription

"Available"

"Failed"

BackupPolicySecret

(Appears on:TargetCluster)

BackupPolicySecret defines for the target database secret that backup tool can connect.


FieldDescription
name
string

the secret name


usernameKey
string

usernameKey the map key of the user in the connection credential secret


passwordKey
string

passwordKey the map key of the password in the connection credential secret


BackupPolicySpec

(Appears on:BackupPolicy)

BackupPolicySpec defines the desired state of BackupPolicy


FieldDescription
retention
RetentionSpec
(Optional)

retention describe how long the Backup should be retained. if not set, will be retained forever.


schedule
Schedule
(Optional)

schedule policy for backup.


snapshot
SnapshotPolicy
(Optional)

the policy for snapshot backup.


datafile
CommonBackupPolicy
(Optional)

the policy for datafile backup.


logfile
CommonBackupPolicy
(Optional)

the policy for logfile backup.


BackupPolicyStatus

(Appears on:BackupPolicy)

BackupPolicyStatus defines the observed state of BackupPolicy


FieldDescription
observedGeneration
int64
(Optional)

observedGeneration is the most recent generation observed for this
BackupPolicy. It corresponds to the Cluster’s generation, which is
updated on mutation by the API Server.


phase
BackupPolicyPhase
(Optional)

backup policy phase valid value: Available, Failed.


failureReason
string
(Optional)

the reason if backup policy check failed.


lastScheduleTime
Kubernetes meta/v1.Time
(Optional)

information when was the last time the job was successfully scheduled.


lastSuccessfulTime
Kubernetes meta/v1.Time
(Optional)

information when was the last time the job successfully completed.


BackupRepoPhase(string alias)

(Appears on:BackupRepoStatus)

BackupRepoPhase defines phases for BackupRepo CR.


ValueDescription

"Deleting"

"Failed"

"PreChecking"

"Ready"

BackupRepoSpec

(Appears on:BackupRepo)

BackupRepoSpec defines the desired state of BackupRepo


FieldDescription
storageProviderRef
string

The storage provider used by this backup repo.


volumeCapacity
Kubernetes resource.Quantity
(Optional)

The requested capacity for the PVC created by this backup repo.


pvReclaimPolicy
Kubernetes core/v1.PersistentVolumeReclaimPolicy

The reclaim policy for the PV created by this backup repo.


config
map[string]string
(Optional)

Non-secret configurations for the storage provider.


credential
Kubernetes core/v1.SecretReference
(Optional)

A secret that contains the credentials needed by the storage provider.


BackupRepoStatus

(Appears on:BackupRepo)

BackupRepoStatus defines the observed state of BackupRepo


FieldDescription
phase
BackupRepoPhase
(Optional)

Backup repo reconciliation phases. Valid values are PreChecking, Failed, Ready, Deleting.


conditions
[]Kubernetes meta/v1.Condition
(Optional)

conditions describes the current state of the repo.


observedGeneration
int64
(Optional)

observedGeneration is the latest generation observed by the controller.


generatedCSIDriverSecret
Kubernetes core/v1.SecretReference
(Optional)

generatedCSIDriverSecret references the generated secret used by the CSI driver.


generatedStorageClassName
string
(Optional)

generatedStorageClassName indicates the generated storage class name.


backupPVCName
string
(Optional)

backupPVCName is the name of the PVC used to store backup data.


isDefault
bool
(Optional)

isDefault indicates whether this backup repo is the default one.


BackupSnapshotStatus

(Appears on:ManifestsStatus)

FieldDescription
volumeSnapshotName
string
(Optional)

volumeSnapshotName records the volumeSnapshot name.


volumeSnapshotContentName
string
(Optional)

volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent
object representing an existing volume snapshot.
This field should be set if the snapshot already exists and only needs a representation in Kubernetes.
This field is immutable.


BackupSpec

(Appears on:Backup)

BackupSpec defines the desired state of Backup.


FieldDescription
backupPolicyName
string

Which backupPolicy is applied to perform this backup


backupType
BackupType

Backup Type. datafile or logfile or snapshot. If not set, datafile is the default type.


parentBackupName
string
(Optional)

if backupType is incremental, parentBackupName is required.


BackupStatus

(Appears on:Backup)

BackupStatus defines the observed state of Backup.


FieldDescription
phase
BackupPhase
(Optional)
parentBackupName
string
(Optional)

Records parentBackupName if backupType is incremental.


expiration
Kubernetes meta/v1.Time
(Optional)

The date and time when the Backup is eligible for garbage collection.
‘null’ means the Backup is NOT be cleaned except delete manual.


startTimestamp
Kubernetes meta/v1.Time
(Optional)

Date/time when the backup started being processed.


completionTimestamp
Kubernetes meta/v1.Time
(Optional)

Date/time when the backup finished being processed.


duration
Kubernetes meta/v1.Duration
(Optional)

The duration time of backup execution.
When converted to a string, the form is “1h2m0.5s”.


totalSize
string
(Optional)

Backup total size.
A string with capacity units in the form of “1Gi”, “1Mi”, “1Ki”.


failureReason
string
(Optional)

The reason for a backup failure.


persistentVolumeClaimName
string
(Optional)

remoteVolume saves the backup data.


logFilePersistentVolumeClaimName
string
(Optional)

logFilePersistentVolumeClaimName saves the logfile backup data.


backupToolName
string
(Optional)

backupToolName references the backup tool name.


sourceCluster
string

sourceCluster records the source cluster information for this backup.


availableReplicas
int32
(Optional)

availableReplicas available replicas for statefulSet which created by backup.


manifests
ManifestsStatus
(Optional)

manifests determines the backup metadata info.


BackupStatusUpdate

(Appears on:BasePolicy)

FieldDescription
path
string
(Optional)

specify the json path of backup object for patch.
example: manifests.backupLog – means patch the backup json path of status.manifests.backupLog.


containerName
string
(Optional)

which container name that kubectl can execute.


script
string
(Optional)

the shell Script commands to collect backup status metadata.
The script must exist in the container of ContainerName and the output format must be set to JSON.
Note that outputting to stderr may cause the result format to not be in JSON.


useTargetPodServiceAccount
bool
(Optional)

useTargetPodServiceAccount defines whether this job requires the service account of the backup target pod.
if true, will use the service account of the backup target pod. otherwise, will use the system service account.


updateStage
BackupStatusUpdateStage

when to update the backup status, pre: before backup, post: after backup


BackupStatusUpdateStage(string alias)

(Appears on:BackupStatusUpdate)

BackupStatusUpdateStage defines the stage of backup status update.


ValueDescription

"post"

"pre"

BackupToolManifestsStatus

(Appears on:ManifestsStatus)

FieldDescription
filePath
string
(Optional)

filePath records the file path of backup.


logFilePath
string
(Optional)

logFilePath records the log file path of backup.


volumeName
string
(Optional)

volumeName records volume name of backup data pvc.


uploadTotalSize
string
(Optional)

Backup upload total size.
A string with capacity units in the form of “1Gi”, “1Mi”, “1Ki”.


checksum
string
(Optional)

checksum of backup file, generated by md5 or sha1 or sha256.


checkpoint
string
(Optional)

backup checkpoint, for incremental backup.


BackupToolRestoreCommand

(Appears on:LogicalConfig, PhysicalConfig)

BackupToolRestoreCommand defines the restore commands of BackupTool


FieldDescription
restoreCommands
[]string
(Optional)

Array of command that apps can perform database restore.
like xtrabackup, that can performs restore mysql from files.


incrementalRestoreCommands
[]string
(Optional)

Array of incremental restore commands.


BackupToolSpec

(Appears on:BackupTool)

BackupToolSpec defines the desired state of BackupTool


FieldDescription
image
string

Backup tool Container image name.


deployKind
DeployKind

which kind for run a backup tool, supported values: job, statefulSet.


type
string

the type of backup tool, file or pitr


resources
Kubernetes core/v1.ResourceRequirements
(Optional)

Compute Resources required by this container.
Cannot be updated.


env
[]Kubernetes core/v1.EnvVar
(Optional)

List of environment variables to set in the container.


envFrom
[]Kubernetes core/v1.EnvFromSource
(Optional)

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.


backupCommands
[]string

Array of command that apps can do database backup.
from invoke args
the order of commands follows the order of array.


incrementalBackupCommands
[]string
(Optional)

Array of command that apps can do database incremental backup.
like xtrabackup, that can performs an incremental backup file.


physical
PhysicalConfig
(Optional)

backup tool can support physical restore, in this case, restore must be RESTART database.


logical
LogicalConfig
(Optional)

backup tool can support logical restore, in this case, restore NOT RESTART database.


BackupToolStatus

(Appears on:BackupTool)

BackupToolStatus defines the observed state of BackupTool


BackupType(string alias)

(Appears on:BackupSpec)

BackupType the backup type, marked backup set is datafile or logfile or snapshot.


ValueDescription

"datafile"

"logfile"

"snapshot"

BaseBackupType(string alias)

BaseBackupType the base backup type.


BasePolicy

(Appears on:CommonBackupPolicy, SnapshotPolicy)

FieldDescription
target
TargetCluster

target database cluster for backup.


backupsHistoryLimit
int32
(Optional)

the number of automatic backups to retain. Value must be non-negative integer.
0 means NO limit on the number of backups.


onFailAttempted
int32
(Optional)

count of backup stop retries on fail.


backupStatusUpdates
[]BackupStatusUpdate
(Optional)

define how to update metadata for backup status.


CommonBackupPolicy

(Appears on:BackupPolicySpec)

FieldDescription
BasePolicy
BasePolicy

(Members of BasePolicy are embedded into this type.)

persistentVolumeClaim
PersistentVolumeClaim
(Optional)

refer to PersistentVolumeClaim and the backup data will be stored in the corresponding persistent volume.


backupRepoName
string
(Optional)

refer to BackupRepo and the backup data will be stored in the corresponding repo.


backupToolName
string

which backup tool to perform database backup, only support one tool.


CreatePVCPolicy(string alias)

(Appears on:PersistentVolumeClaim)

CreatePVCPolicy the policy how to create the PersistentVolumeClaim for backup.


ValueDescription

"IfNotPresent"

"Never"

DeployKind(string alias)

(Appears on:BackupToolSpec)

DeployKind which kind for run a backup tool.


ValueDescription

"job"

"statefulSet"

LogicalConfig

(Appears on:BackupToolSpec)

FieldDescription
BackupToolRestoreCommand
BackupToolRestoreCommand

(Members of BackupToolRestoreCommand are embedded into this type.)

podScope
PodRestoreScope
(Optional)

podScope defines the pod scope for restore from backup, supported values:
- ‘All’ will exec the restore command on all pods.
- ‘ReadWrite’ will pick a ReadWrite pod to exec the restore command.


ManifestsStatus

(Appears on:BackupStatus)

FieldDescription
backupLog
BackupLogStatus
(Optional)

backupLog records startTime and stopTime of data logging.


target
string
(Optional)

target records the target cluster metadata string, which is in JSON format.


backupSnapshot
BackupSnapshotStatus
(Optional)

snapshot records the volume snapshot metadata.


backupTool
BackupToolManifestsStatus
(Optional)

backupTool records information about backup files generated by the backup tool.


userContext
map[string]string
(Optional)

userContext stores some loosely structured and extensible information.


PersistentVolumeClaim

(Appears on:CommonBackupPolicy)

FieldDescription
name
string
(Optional)

the name of PersistentVolumeClaim to store backup data.


storageClassName
string
(Optional)

storageClassName is the name of the StorageClass required by the claim.


initCapacity
Kubernetes resource.Quantity
(Optional)

initCapacity represents the init storage size of the PersistentVolumeClaim which should be created if not exist.
and the default value is 100Gi if it is empty.


createPolicy
CreatePVCPolicy
(Optional)

createPolicy defines the policy for creating the PersistentVolumeClaim, enum values:
- Never: do nothing if the PersistentVolumeClaim not exists.
- IfNotPresent: create the PersistentVolumeClaim if not present and the accessModes only contains ‘ReadWriteMany’.


persistentVolumeConfigMap
PersistentVolumeConfigMap
(Optional)

persistentVolumeConfigMap references the configmap which contains a persistentVolume template.
key must be “persistentVolume” and value is the “PersistentVolume” struct.
support the following built-in Objects:
- $(GENERATE_NAME): generate a specific format “PVC NAME-PVC NAMESPACE”.
if the PersistentVolumeClaim not exists and CreatePolicy is “IfNotPresent”, the controller
will create it by this template. this is a mutually exclusive setting with “storageClassName”.


PersistentVolumeConfigMap

(Appears on:PersistentVolumeClaim)

FieldDescription
name
string

the name of the persistentVolume ConfigMap.


namespace
string

the namespace of the persistentVolume ConfigMap.


PhysicalConfig

(Appears on:BackupToolSpec)

FieldDescription
BackupToolRestoreCommand
BackupToolRestoreCommand

(Members of BackupToolRestoreCommand are embedded into this type.)

relyOnLogfile
bool
(Optional)

relyOnLogfile defines whether the current recovery relies on log files


PodRestoreScope(string alias)

(Appears on:LogicalConfig)

PodRestoreScope defines the scope pod for restore from backup.


RestoreJobPhase(string alias)

(Appears on:RestoreJobStatus)

RestoreJobPhase The current phase. Valid values are New, InProgressPhy, InProgressLogic, Completed, Failed.


ValueDescription

"Completed"

"Failed"

"InProgressLogic"

"InProgressPhy"

"New"

RestoreJobSpec

(Appears on:RestoreJob)

RestoreJobSpec defines the desired state of RestoreJob


FieldDescription
backupJobName
string

Specified one backupJob to restore.


target
TargetCluster

the target database workload to restore


targetVolumes
[]Kubernetes core/v1.Volume

array of restore volumes .


targetVolumeMounts
[]Kubernetes core/v1.VolumeMount

array of restore volume mounts .


onFailAttempted
int32
(Optional)

count of backup stop retries on fail.


RestoreJobStatus

(Appears on:RestoreJob)

RestoreJobStatus defines the observed state of RestoreJob


FieldDescription
phase
RestoreJobPhase
(Optional)
expiration
Kubernetes meta/v1.Time
(Optional)

The date and time when the Backup is eligible for garbage collection.
‘null’ means the Backup is NOT be cleaned except delete manual.


startTimestamp
Kubernetes meta/v1.Time
(Optional)

Date/time when the backup started being processed.


completionTimestamp
Kubernetes meta/v1.Time
(Optional)

Date/time when the backup finished being processed.


failureReason
string
(Optional)

Job failed reason.


RetentionSpec

(Appears on:BackupPolicySpec)

FieldDescription
ttl
string
(Optional)

ttl is a time string ending with the ’d’|’D’|‘h’|‘H’ character to describe how long
the Backup should be retained. if not set, will be retained forever.


Schedule

(Appears on:BackupPolicySpec)

FieldDescription
startingDeadlineMinutes
int64
(Optional)

startingDeadlineMinutes defines the deadline in minutes for starting the backup job
if it misses scheduled time for any reason.


snapshot
SchedulePolicy
(Optional)

schedule policy for snapshot backup.


datafile
SchedulePolicy
(Optional)

schedule policy for datafile backup.


logfile
SchedulePolicy
(Optional)

schedule policy for logfile backup.


SchedulePolicy

(Appears on:Schedule)

FieldDescription
cronExpression
string

the cron expression for schedule, the timezone is in UTC. see https://en.wikipedia.org/wiki/Cron.


enable
bool

enable or disable the schedule.


SnapshotPolicy

(Appears on:BackupPolicySpec)

FieldDescription
BasePolicy
BasePolicy

(Members of BasePolicy are embedded into this type.)

hooks
BackupPolicyHook
(Optional)

execute hook commands for backup.


TargetCluster

(Appears on:BasePolicy, RestoreJobSpec)

TargetCluster TODO (dsj): target cluster need redefined from Cluster API


FieldDescription
labelsSelector
Kubernetes meta/v1.LabelSelector

labelsSelector is used to find matching pods.
Pods that match this label selector are counted to determine the number of pods
in their corresponding topology domain.


secret
BackupPolicySecret
(Optional)

secret is used to connect to the target database cluster.
If not set, secret will be inherited from backup policy template.
if still not set, the controller will check if any system account for dataprotection has been created.



Generated with gen-crd-api-reference-docs