v1alpha1

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
	SchemeBuilder runtime.SchemeBuilder

	// AddToScheme applies all the stored functions to the scheme.
	AddToScheme = localSchemeBuilder.AddToScheme
	// Scheme is the scheme instance of operator
	Scheme *runtime.Scheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: groupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects

Functions

func FinishVolumeRestoreStep

func FinishVolumeRestoreStep(volumeRestoreStatus *VolumeRestoreStatus, stepName VolumeRestoreStepType)

func IsVolumeBackupCleanFailed added in v1.5.3

func IsVolumeBackupCleanFailed(volumeBackup *VolumeBackup) bool

IsVolumeBackupCleanFailed returns true if one of Backup CR in data plane has failed to clean up

func IsVolumeBackupCleaned

func IsVolumeBackupCleaned(volumeBackup *VolumeBackup) bool

IsVolumeBackupCleaned returns true if all the Backup CRs in data plane has cleaned

func IsVolumeBackupComplete

func IsVolumeBackupComplete(volumeBackup *VolumeBackup) bool

IsVolumeBackupComplete returns true if VolumeBackup is complete

func IsVolumeBackupFailed

func IsVolumeBackupFailed(volumeBackup *VolumeBackup) bool

IsVolumeBackupFailed returns true if VolumeBackup is failed

func IsVolumeBackupInvalid

func IsVolumeBackupInvalid(volumeBackup *VolumeBackup) bool

IsVolumeBackupInvalid returns true if VolumeBackup is invalid

func IsVolumeBackupRunning

func IsVolumeBackupRunning(volumeBackup *VolumeBackup) bool

IsVolumeBackupRunning returns true if VolumeBackup is running

func IsVolumeBackupSnapshotsCreated added in v1.5.1

func IsVolumeBackupSnapshotsCreated(volumeBackup *VolumeBackup) bool

IsVolumeBackupSnapshotsCreated returns true if VolumeBackup's snapshots are all created

func IsVolumeRestoreCleaned

func IsVolumeRestoreCleaned(volumeRestore *VolumeRestore) bool

func IsVolumeRestoreComplete

func IsVolumeRestoreComplete(volumeRestore *VolumeRestore) bool

func IsVolumeRestoreDataComplete

func IsVolumeRestoreDataComplete(volumeRestore *VolumeRestore) bool

func IsVolumeRestoreFailed

func IsVolumeRestoreFailed(volumeRestore *VolumeRestore) bool

func IsVolumeRestoreRunning

func IsVolumeRestoreRunning(volumeRestore *VolumeRestore) bool

func IsVolumeRestoreTiKVComplete

func IsVolumeRestoreTiKVComplete(volumeRestore *VolumeRestore) bool

func IsVolumeRestoreVolumeComplete

func IsVolumeRestoreVolumeComplete(volumeRestore *VolumeRestore) bool

func IsVolumeRestoreWarmUpComplete added in v1.5.1

func IsVolumeRestoreWarmUpComplete(volumeRestore *VolumeRestore) bool

func IsVolumeRestoreWarmUpStarted added in v1.5.1

func IsVolumeRestoreWarmUpStarted(volumeRestore *VolumeRestore) bool

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns back a Group qualified GroupResource

func StartVolumeRestoreStep

func StartVolumeRestoreStep(volumeRestoreStatus *VolumeRestoreStatus, stepName VolumeRestoreStepType)

func UpdateVolumeBackupCondition

func UpdateVolumeBackupCondition(volumeBackupStatus *VolumeBackupStatus, condition *VolumeBackupCondition)

UpdateVolumeBackupCondition adds new condition or update condition if it exists in status

func UpdateVolumeBackupMemberStatus

func UpdateVolumeBackupMemberStatus(volumeBackupStatus *VolumeBackupStatus, k8sClusterName string, backupMember *pingcapv1alpha1.Backup)

UpdateVolumeBackupMemberStatus adds new data plane backup status or update it if it exists in status

func UpdateVolumeRestoreCondition

func UpdateVolumeRestoreCondition(volumeRestoreStatus *VolumeRestoreStatus, condition *VolumeRestoreCondition)

UpdateVolumeRestoreCondition adds new condition or update condition if it exists in status

func UpdateVolumeRestoreMemberStatus

func UpdateVolumeRestoreMemberStatus(volumeRestoreStatus *VolumeRestoreStatus, k8sClusterName string, restoreMember *pingcapv1alpha1.Restore)

Types

type BRConfig

type BRConfig struct {
	// Concurrency is the size of thread pool on each node that execute the backup task
	Concurrency *uint32 `json:"concurrency,omitempty"`
	// CheckRequirements specifies whether to check requirements
	CheckRequirements *bool `json:"checkRequirements,omitempty"`
	// SendCredToTikv specifies whether to send credentials to TiKV
	SendCredToTikv *bool `json:"sendCredToTikv,omitempty"`
	// Options means options for backup data to remote storage with BR. These options has highest priority.
	Options []string `json:"options,omitempty"`
}

BRConfig contains config for BR +k8s:openapi-gen=true

func (*BRConfig) DeepCopy

func (in *BRConfig) DeepCopy() *BRConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BRConfig.

func (*BRConfig) DeepCopyInto

func (in *BRConfig) DeepCopyInto(out *BRConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BRConfig) ToBRMemberConfig

func (bc *BRConfig) ToBRMemberConfig(tcName, tcNamespace string) *pingcapv1alpha1.BRConfig

ToBRMemberConfig converts BRConfig to BRConfig of data plane

type VolumeBackup

type VolumeBackup struct {
	metav1.TypeMeta `json:",inline"`
	// +k8s:openapi-gen=false
	metav1.ObjectMeta `json:"metadata"`

	Spec VolumeBackupSpec `json:"spec"`

	// +k8s:openapi-gen=false
	Status VolumeBackupStatus `json:"status,omitempty"`

	// SkipGC indicates whether this EBS volume snapshot backup is immune to GC
	// +optional
	// +kubebuilder:default=false
	SkipGC bool `json:"skipGC,omitempty"`
}

VolumeBackup is the control script's spec

+k8s:openapi-gen=true +kubebuilder:resource:shortName="vbk" +genclient:noStatus +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.phase`,description="The current status of the backup" +kubebuilder:printcolumn:name="BackupSize",type=string,JSONPath=`.status.backupSizeReadable`,description="The data size of the backup" +kubebuilder:printcolumn:name="CommitTS",type=string,JSONPath=`.status.commitTs`,description="The commit ts of the backup" +kubebuilder:printcolumn:name="TimeTaken",type=string,JSONPath=`.status.timeTaken`,description="The time that volume backup federation takes" +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*VolumeBackup) DeepCopy

func (in *VolumeBackup) DeepCopy() *VolumeBackup

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackup.

func (*VolumeBackup) DeepCopyInto

func (in *VolumeBackup) DeepCopyInto(out *VolumeBackup)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*VolumeBackup) DeepCopyObject

func (in *VolumeBackup) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*VolumeBackup) GetCombinedTCName added in v1.5.3

func (vb *VolumeBackup) GetCombinedTCName() string

type VolumeBackupCondition

type VolumeBackupCondition struct {
	Status corev1.ConditionStatus    `json:"status"`
	Type   VolumeBackupConditionType `json:"type"`

	// +nullable
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	Reason             string      `json:"reason,omitempty"`
	Message            string      `json:"message,omitempty"`
}

VolumeBackupCondition describes the observed state of a VolumeBackup at a certain point.

func GetVolumeBackupCondition

func GetVolumeBackupCondition(volumeBackupStatus *VolumeBackupStatus, conditionType VolumeBackupConditionType) (index int, condition *VolumeBackupCondition)

GetVolumeBackupCondition gets condition from status, if it doesn't exist, returned index = -1

func (*VolumeBackupCondition) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupCondition.

func (*VolumeBackupCondition) DeepCopyInto

func (in *VolumeBackupCondition) DeepCopyInto(out *VolumeBackupCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeBackupConditionType

type VolumeBackupConditionType string

VolumeBackupConditionType represents a valid condition of a VolumeBackup.

const (
	// VolumeBackupInvalid means the VolumeBackup is invalid
	VolumeBackupInvalid VolumeBackupConditionType = "Invalid"
	// VolumeBackupRunning means the VolumeBackup is running
	VolumeBackupRunning VolumeBackupConditionType = "Running"
	// VolumeBackupSnapshotsCreated means the all the volume snapshots have created, and we have safely resumed GC and PD scheduler
	VolumeBackupSnapshotsCreated VolumeBackupConditionType = "SnapshotsCreated"
	// VolumeBackupComplete means all the backups in data plane are complete and the VolumeBackup is complete
	VolumeBackupComplete VolumeBackupConditionType = "Complete"
	// VolumeBackupFailed means one of backup in data plane is failed and the VolumeBackup is failed
	VolumeBackupFailed VolumeBackupConditionType = "Failed"
	// VolumeBackupCleaned means all the resources about VolumeBackup have cleaned
	VolumeBackupCleaned VolumeBackupConditionType = "Cleaned"
	// VolumeBackupCleanFailed means one of backup cleanup in data plane is failed
	VolumeBackupCleanFailed VolumeBackupConditionType = "CleanFailed"
)

type VolumeBackupList

type VolumeBackupList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []VolumeBackup `json:"items"`
}

VolumeBackupList is VolumeBackup list +k8s:openapi-gen=true

func (*VolumeBackupList) DeepCopy

func (in *VolumeBackupList) DeepCopy() *VolumeBackupList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupList.

func (*VolumeBackupList) DeepCopyInto

func (in *VolumeBackupList) DeepCopyInto(out *VolumeBackupList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*VolumeBackupList) DeepCopyObject

func (in *VolumeBackupList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type VolumeBackupMemberCluster

type VolumeBackupMemberCluster struct {
	// K8sClusterName is the name of the k8s cluster where the tc locates
	K8sClusterName string `json:"k8sClusterName,omitempty"`
	// TCName is the name of the TiDBCluster CR which need to execute volume backup
	TCName string `json:"tcName,omitempty"`
	// TCNamespace is the namespace of the TiDBCluster CR
	TCNamespace string `json:"tcNamespace,omitempty"`
}

VolumeBackupMemberCluster contains the TiDB cluster which need to execute volume backup +k8s:openapi-gen=true

func (*VolumeBackupMemberCluster) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupMemberCluster.

func (*VolumeBackupMemberCluster) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeBackupMemberSpec

type VolumeBackupMemberSpec struct {
	corev1.ResourceRequirements `json:"resources,omitempty"`
	// List of environment variables to set in the container, like v1.Container.Env.
	// Note that the following builtin env vars will be overwritten by values set here
	// - S3_PROVIDER
	// - S3_ENDPOINT
	// - AWS_REGION
	// - AWS_ACL
	// - AWS_STORAGE_CLASS
	// - AWS_DEFAULT_REGION
	// - AWS_ACCESS_KEY_ID
	// - AWS_SECRET_ACCESS_KEY
	// - GCS_PROJECT_ID
	// - GCS_OBJECT_ACL
	// - GCS_BUCKET_ACL
	// - GCS_LOCATION
	// - GCS_STORAGE_CLASS
	// - GCS_SERVICE_ACCOUNT_JSON_KEY
	// - BR_LOG_TO_TERM
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty"`
	// BRConfig is the configs for BR
	BR *BRConfig `json:"br,omitempty"`
	// StorageProvider configures where and how backups should be stored.
	pingcapv1alpha1.StorageProvider `json:",inline"`
	Tolerations                     []corev1.Toleration `json:"tolerations,omitempty"`
	// ToolImage specifies the tool image used in `Backup`, which supports BR.
	// For examples `spec.toolImage: pingcap/br:v6.5.0`
	// For BR image, if it does not contain tag, Pod will use image 'ToolImage:${TiKV_Version}'.
	// +optional
	ToolImage string `json:"toolImage,omitempty"`
	// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.
	// +optional
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
	// Specify service account of backup
	ServiceAccount string `json:"serviceAccount,omitempty"`
	// CleanPolicy denotes whether to clean backup data when the object is deleted from the cluster, if not set, the backup data will be retained
	CleanPolicy pingcapv1alpha1.CleanPolicyType `json:"cleanPolicy,omitempty"`
	// PriorityClassName of Backup Job Pods
	PriorityClassName string `json:"priorityClassName,omitempty"`
	// CalcSizeLevel determines how to size calculation of snapshots for EBS volume snapshot backup
	// +optional
	// +kubebuilder:default="all"
	CalcSizeLevel string `json:"calcSizeLevel,omitempty"`
	// Additional volumes of component pods, and the volume source must support to be attached to multiple pods.
	// +optional
	AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`
	// Additional volume mounts of component pods.
	// +optional
	AdditionalVolumeMounts []corev1.VolumeMount `json:"additionalVolumeMounts,omitempty"`
	// VolumeBackupInitJobMaxActiveSeconds represents the deadline (in seconds) of the vbk init job
	// +kubebuilder:default=600
	VolumeBackupInitJobMaxActiveSeconds int `json:"volumeBackupInitJobMaxActiveSeconds,omitempty"`
	// SnapshotsDeleteRatio represents the number of snapshots deleted per second in every data plane
	// +kubebuilder:default=1
	SnapshotsDeleteRatio float64 `json:"snapshotsDeleteRatio,omitempty"`
}

VolumeBackupMemberSpec contains the backup specification for one tidb cluster +k8s:openapi-gen=true

func (*VolumeBackupMemberSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupMemberSpec.

func (*VolumeBackupMemberSpec) DeepCopyInto

func (in *VolumeBackupMemberSpec) DeepCopyInto(out *VolumeBackupMemberSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeBackupMemberStatus

type VolumeBackupMemberStatus struct {
	// K8sClusterName is the name of the k8s cluster where the tc locates
	K8sClusterName string `json:"k8sClusterName,omitempty"`
	// TCName is the name of the TiDBCluster CR which need to execute volume backup
	TCName string `json:"tcName,omitempty"`
	// TCNamespace is the namespace of the TiDBCluster CR
	TCNamespace string `json:"tcNamespace,omitempty"`
	// BackupName is the name of Backup CR
	BackupName string `json:"backupName"`
	// Phase is the current status of backup member
	Phase pingcapv1alpha1.BackupConditionType `json:"phase"`
	// BackupPath is the location of the backup
	BackupPath string `json:"backupPath,omitempty"`
	// BackupSize is the data size of the backup
	BackupSize int64 `json:"backupSize,omitempty"`
	// CommitTs is the commit ts of the backup
	CommitTs string `json:"commitTs,omitempty"`
	// Reason is the reason why backup member is failed
	Reason string `json:"reason,omitempty"`
	// Message is the error message if backup member is failed
	Message string `json:"message,omitempty"`
}

func (*VolumeBackupMemberStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupMemberStatus.

func (*VolumeBackupMemberStatus) DeepCopyInto

func (in *VolumeBackupMemberStatus) DeepCopyInto(out *VolumeBackupMemberStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeBackupSchedule

type VolumeBackupSchedule struct {
	metav1.TypeMeta `json:",inline"`
	// +k8s:openapi-gen=false
	metav1.ObjectMeta `json:"metadata"`

	Spec VolumeBackupScheduleSpec `json:"spec"`
	// +k8s:openapi-gen=false
	Status VolumeBackupScheduleStatus `json:"status,omitempty"`
}

VolumeBackupSchedule is the control script's spec

+k8s:openapi-gen=true +kubebuilder:resource:shortName="vbks" +kubebuilder:printcolumn:name="Schedule",type=string,JSONPath=`.spec.schedule`,description="The cron format string used for backup scheduling" +kubebuilder:printcolumn:name="MaxBackups",type=integer,JSONPath=`.spec.maxBackups`,description="The max number of backups we want to keep" +kubebuilder:printcolumn:name="MaxReservedTime",type=string,JSONPath=`.spec.maxReservedTime`,description="How long backups we want to keep" +kubebuilder:printcolumn:name="LastBackup",type=string,JSONPath=`.status.lastBackup`,description="The last backup CR name",priority=1 +kubebuilder:printcolumn:name="LastBackupTime",type=date,JSONPath=`.status.lastBackupTime`,description="The last time the backup was successfully created",priority=1 +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*VolumeBackupSchedule) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupSchedule.

func (*VolumeBackupSchedule) DeepCopyInto

func (in *VolumeBackupSchedule) DeepCopyInto(out *VolumeBackupSchedule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*VolumeBackupSchedule) DeepCopyObject

func (in *VolumeBackupSchedule) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*VolumeBackupSchedule) GetBackupCRDName

func (vbks *VolumeBackupSchedule) GetBackupCRDName(timestamp time.Time) string

type VolumeBackupScheduleList

type VolumeBackupScheduleList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []VolumeBackupSchedule `json:"items"`
}

+k8s:openapi-gen=true VolumeBackupScheduleList is VolumeBackupSchedule list

func (*VolumeBackupScheduleList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupScheduleList.

func (*VolumeBackupScheduleList) DeepCopyInto

func (in *VolumeBackupScheduleList) DeepCopyInto(out *VolumeBackupScheduleList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*VolumeBackupScheduleList) DeepCopyObject

func (in *VolumeBackupScheduleList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type VolumeBackupScheduleSpec

type VolumeBackupScheduleSpec struct {
	// Schedule specifies the cron string used for backup scheduling.
	Schedule string `json:"schedule"`
	// Pause means paused backupSchedule
	Pause bool `json:"pause,omitempty"`
	// MaxBackups is to specify how many backups we want to keep
	// 0 is magic number to indicate un-limited backups.
	// if MaxBackups and MaxReservedTime are set at the same time, MaxReservedTime is preferred
	// and MaxBackups is ignored.
	MaxBackups *int32 `json:"maxBackups,omitempty"`
	// MaxReservedTime is to specify how long backups we want to keep.
	MaxReservedTime *string `json:"maxReservedTime,omitempty"`
	// BackupTemplate is the specification of the volume backup structure to get scheduled.
	BackupTemplate VolumeBackupSpec `json:"backupTemplate"`
}

+k8s:openapi-gen=true VolumeBackupScheduleSpec describes the attributes that a user creates on a volume backup schedule.

func (*VolumeBackupScheduleSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupScheduleSpec.

func (*VolumeBackupScheduleSpec) DeepCopyInto

func (in *VolumeBackupScheduleSpec) DeepCopyInto(out *VolumeBackupScheduleSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeBackupScheduleStatus

type VolumeBackupScheduleStatus struct {
	// LastBackup represents the last backup.
	LastBackup string `json:"lastBackup,omitempty"`
	// LastBackupTime represents the last time the backup was successfully created.
	LastBackupTime *metav1.Time `json:"lastBackupTime,omitempty"`
	// AllBackupCleanTime represents the time when all backup entries are cleaned up
	AllBackupCleanTime *metav1.Time `json:"allBackupCleanTime,omitempty"`
}

VolumeBackupScheduleStatus represents the current status of a volume backup schedule.

func (*VolumeBackupScheduleStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupScheduleStatus.

func (*VolumeBackupScheduleStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeBackupSpec

type VolumeBackupSpec struct {
	Clusters []VolumeBackupMemberCluster `json:"clusters,omitempty"`
	Template VolumeBackupMemberSpec      `json:"template,omitempty"`
}

VolumeBackupSpec describes the attributes that a user creates on a volume backup. +k8s:openapi-gen=true

func (*VolumeBackupSpec) DeepCopy

func (in *VolumeBackupSpec) DeepCopy() *VolumeBackupSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupSpec.

func (*VolumeBackupSpec) DeepCopyInto

func (in *VolumeBackupSpec) DeepCopyInto(out *VolumeBackupSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeBackupStatus

type VolumeBackupStatus struct {
	// Backups are volume backups' information in data plane
	Backups []VolumeBackupMemberStatus `json:"backups,omitempty"`
	// TimeStarted is the time at which the backup was started.
	// +nullable
	TimeStarted metav1.Time `json:"timeStarted,omitempty"`
	// TimeCompleted is the time at which the backup was completed.
	// +nullable
	TimeCompleted metav1.Time `json:"timeCompleted,omitempty"`
	// TimeTaken is the time that volume backup federation takes, it is TimeCompleted - TimeStarted
	TimeTaken string `json:"timeTaken,omitempty"`
	// BackupSizeReadable is the data size of the backup.
	// the difference with BackupSize is that its format is human readable
	BackupSizeReadable string `json:"backupSizeReadable,omitempty"`
	// BackupSize is the data size of the backup.
	BackupSize int64 `json:"backupSize,omitempty"`
	// CommitTs is the commit ts of the backup, snapshot ts for full backup or start ts for log backup.
	CommitTs string `json:"commitTs,omitempty"`
	// Phase is a user readable state inferred from the underlying Backup conditions
	Phase VolumeBackupConditionType `json:"phase,omitempty"`
	// +nullable
	Conditions []VolumeBackupCondition `json:"conditions,omitempty"`
}

VolumeBackupStatus represents the current status of a volume backup.

func (*VolumeBackupStatus) DeepCopy

func (in *VolumeBackupStatus) DeepCopy() *VolumeBackupStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupStatus.

func (*VolumeBackupStatus) DeepCopyInto

func (in *VolumeBackupStatus) DeepCopyInto(out *VolumeBackupStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestore

type VolumeRestore struct {
	metav1.TypeMeta `json:",inline"`
	// +k8s:openapi-gen=false
	metav1.ObjectMeta `json:"metadata"`

	Spec VolumeRestoreSpec `json:"spec"`

	// +k8s:openapi-gen=false
	Status VolumeRestoreStatus `json:"status,omitempty"`
}

VolumeRestore is the control script's spec

+k8s:openapi-gen=true +kubebuilder:resource:shortName="vrt" +genclient:noStatus +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.phase`,description="The current status of the backup" +kubebuilder:printcolumn:name="CommitTS",type=string,JSONPath=`.status.commitTs`,description="The commit ts of the restore" +kubebuilder:printcolumn:name="TimeTaken",type=string,JSONPath=`.status.timeTaken`,description="The time that volume restore federation takes" +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*VolumeRestore) DeepCopy

func (in *VolumeRestore) DeepCopy() *VolumeRestore

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestore.

func (*VolumeRestore) DeepCopyInto

func (in *VolumeRestore) DeepCopyInto(out *VolumeRestore)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*VolumeRestore) DeepCopyObject

func (in *VolumeRestore) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type VolumeRestoreCondition

type VolumeRestoreCondition struct {
	Status corev1.ConditionStatus     `json:"status"`
	Type   VolumeRestoreConditionType `json:"type"`

	// +nullable
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	Reason             string      `json:"reason,omitempty"`
	Message            string      `json:"message,omitempty"`
}

VolumeRestoreCondition describes the observed state of a VolumeRestore at a certain point.

func GetVolumeRestoreCondition

func GetVolumeRestoreCondition(volumeRestoreStatus *VolumeRestoreStatus, conditionType VolumeRestoreConditionType) (index int, condition *VolumeRestoreCondition)

func (*VolumeRestoreCondition) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreCondition.

func (*VolumeRestoreCondition) DeepCopyInto

func (in *VolumeRestoreCondition) DeepCopyInto(out *VolumeRestoreCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestoreConditionType

type VolumeRestoreConditionType string
const (
	// VolumeRestoreInvalid means the VolumeRestore is invalid
	VolumeRestoreInvalid VolumeRestoreConditionType = "Invalid"
	// VolumeRestoreRunning means start to create restore members in data planes
	VolumeRestoreRunning VolumeRestoreConditionType = "Running"
	// VolumeRestoreVolumeComplete means all the restore members are volume complete
	VolumeRestoreVolumeComplete VolumeRestoreConditionType = "VolumeComplete"
	// VolumeRestoreWarmUpStarted means the Restore has successfully started warmup pods to
	// initialize volumes restored from snapshots
	VolumeRestoreWarmUpStarted VolumeRestoreConditionType = "WarmUpStarted"
	// VolumeRestoreWarmUpComplete means the Restore has successfully warmed up all TiKV volumes
	VolumeRestoreWarmUpComplete VolumeRestoreConditionType = "WarmUpComplete"
	// VolumeRestoreTiKVComplete means all the restore members are tikv complete
	VolumeRestoreTiKVComplete VolumeRestoreConditionType = "TikvComplete"
	// VolumeRestoreDataComplete means all the restore members are data complete
	VolumeRestoreDataComplete VolumeRestoreConditionType = "DataComplete"
	// VolumeRestoreComplete means all the restore members are complete
	VolumeRestoreComplete VolumeRestoreConditionType = "Complete"
	// VolumeRestoreFailed means one of restore member is failed
	VolumeRestoreFailed VolumeRestoreConditionType = "Failed"
	// VolumeRestoreCleaned means all the restore members are cleaned
	VolumeRestoreCleaned VolumeRestoreConditionType = "Cleaned"
)

type VolumeRestoreList

type VolumeRestoreList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []VolumeRestore `json:"items"`
}

VolumeRestoreList is VolumeRestore list +k8s:openapi-gen=true

func (*VolumeRestoreList) DeepCopy

func (in *VolumeRestoreList) DeepCopy() *VolumeRestoreList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreList.

func (*VolumeRestoreList) DeepCopyInto

func (in *VolumeRestoreList) DeepCopyInto(out *VolumeRestoreList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*VolumeRestoreList) DeepCopyObject

func (in *VolumeRestoreList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type VolumeRestoreMemberBackupInfo

type VolumeRestoreMemberBackupInfo struct {
	pingcapv1alpha1.StorageProvider `json:",inline"`
}

func (*VolumeRestoreMemberBackupInfo) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreMemberBackupInfo.

func (*VolumeRestoreMemberBackupInfo) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestoreMemberCluster

type VolumeRestoreMemberCluster struct {
	// K8sClusterName is the name of the k8s cluster where the tc locates
	K8sClusterName string `json:"k8sClusterName,omitempty"`
	// TCName is the name of the TiDBCluster CR which need to execute volume backup
	TCName string `json:"tcName,omitempty"`
	// TCNamespace is the namespace of the TiDBCluster CR
	TCNamespace string `json:"tcNamespace,omitempty"`
	// AZName is the available zone which the volume snapshots restore to
	AZName string `json:"azName,omitempty"`
	// Backup is the volume backup information
	Backup VolumeRestoreMemberBackupInfo `json:"backup,omitempty"`
}

VolumeRestoreMemberCluster contains the TiDB cluster which need to execute volume restore +k8s:openapi-gen=true

func (*VolumeRestoreMemberCluster) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreMemberCluster.

func (*VolumeRestoreMemberCluster) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestoreMemberSpec

type VolumeRestoreMemberSpec struct {
	corev1.ResourceRequirements `json:"resources,omitempty"`
	// List of environment variables to set in the container, like v1.Container.Env.
	// Note that the following builtin env vars will be overwritten by values set here
	// - S3_PROVIDER
	// - S3_ENDPOINT
	// - AWS_REGION
	// - AWS_ACL
	// - AWS_STORAGE_CLASS
	// - AWS_DEFAULT_REGION
	// - AWS_ACCESS_KEY_ID
	// - AWS_SECRET_ACCESS_KEY
	// - GCS_PROJECT_ID
	// - GCS_OBJECT_ACL
	// - GCS_BUCKET_ACL
	// - GCS_LOCATION
	// - GCS_STORAGE_CLASS
	// - GCS_SERVICE_ACCOUNT_JSON_KEY
	// - BR_LOG_TO_TERM
	// +optional
	Env []corev1.EnvVar `json:"env,omitempty"`
	// BRConfig is the configs for BR
	BR          *BRConfig           `json:"br,omitempty"`
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
	// ToolImage specifies the tool image used in `Restore`, which supports BR image.
	// For examples `spec.toolImage: pingcap/br:v6.5.0`
	// For BR image, if it does not contain tag, Pod will use image 'ToolImage:${TiKV_Version}'.
	// +optional
	ToolImage string `json:"toolImage,omitempty"`
	// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.
	// +optional
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
	// Specify service account of restore
	ServiceAccount string `json:"serviceAccount,omitempty"`
	// PriorityClassName of Restore Job Pods
	PriorityClassName string `json:"priorityClassName,omitempty"`
	// Warmup represents whether to initialize TiKV volumes after volume snapshot restore
	// +optional
	Warmup pingcapv1alpha1.RestoreWarmupMode `json:"warmup,omitempty"`
	// WarmupImage represents using what image to initialize TiKV volumes
	// +optional
	WarmupImage string `json:"warmupImage,omitempty"`
	// WarmupStrategy
	// +kubebuilder:default=hybrid
	WarmupStrategy pingcapv1alpha1.RestoreWarmupStrategy `json:"warmupStrategy,omitempty"`
	// Additional volumes of component pods, and the volume source must support to be attached to multiple pods.
	// +optional
	AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`
	// Additional volume mounts of component pods.
	// +optional
	AdditionalVolumeMounts []corev1.VolumeMount `json:"additionalVolumeMounts,omitempty"`
}

VolumeRestoreMemberSpec contains the restore specification for one tidb cluster +k8s:openapi-gen=true

func (*VolumeRestoreMemberSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreMemberSpec.

func (*VolumeRestoreMemberSpec) DeepCopyInto

func (in *VolumeRestoreMemberSpec) DeepCopyInto(out *VolumeRestoreMemberSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestoreMemberStatus

type VolumeRestoreMemberStatus struct {
	// K8sClusterName is the name of the k8s cluster where the tc locates
	K8sClusterName string `json:"k8sClusterName,omitempty"`
	// TCName is the name of the TiDBCluster CR which need to execute volume backup
	TCName string `json:"tcName,omitempty"`
	// TCNamespace is the namespace of the TiDBCluster CR
	TCNamespace string `json:"tcNamespace,omitempty"`
	// RestoreName is the name of Restore CR
	RestoreName string `json:"restoreName"`
	// Phase is the current status of restore member
	Phase pingcapv1alpha1.RestoreConditionType `json:"phase"`
	// CommitTs is the commit ts of the restored backup
	CommitTs string `json:"commitTs,omitempty"`
	// Reason is the reason why restore member is failed
	Reason string `json:"reason,omitempty"`
	// Message is the error message if restore member is failed
	Message string `json:"message,omitempty"`
}

func (*VolumeRestoreMemberStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreMemberStatus.

func (*VolumeRestoreMemberStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestoreSpec

type VolumeRestoreSpec struct {
	Clusters []VolumeRestoreMemberCluster `json:"clusters,omitempty"`
	Template VolumeRestoreMemberSpec      `json:"template,omitempty"`
}

VolumeRestoreSpec describes the attributes that a user creates on a volume restore. +k8s:openapi-gen=true

func (*VolumeRestoreSpec) DeepCopy

func (in *VolumeRestoreSpec) DeepCopy() *VolumeRestoreSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreSpec.

func (*VolumeRestoreSpec) DeepCopyInto

func (in *VolumeRestoreSpec) DeepCopyInto(out *VolumeRestoreSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestoreStatus

type VolumeRestoreStatus struct {
	// Restores are volume restores' information in data plane
	Restores []VolumeRestoreMemberStatus `json:"restores,omitempty"`
	// Steps are details of every volume restore steps
	Steps []VolumeRestoreStep `json:"steps,omitempty"`
	// TimeStarted is the time at which the restore was started.
	// +nullable
	TimeStarted metav1.Time `json:"timeStarted,omitempty"`
	// TimeCompleted is the time at which the restore was completed.
	// +nullable
	TimeCompleted metav1.Time `json:"timeCompleted,omitempty"`
	// TimeTaken is the time that volume restore federation takes, it is TimeCompleted - TimeStarted
	TimeTaken string `json:"timeTaken,omitempty"`
	// CommitTs is the snapshot time point of tidb cluster.
	CommitTs string `json:"commitTs,omitempty"`
	// Phase is a user readable state inferred from the underlying Restore conditions
	Phase VolumeRestoreConditionType `json:"phase,omitempty"`
	// +nullable
	Conditions []VolumeRestoreCondition `json:"conditions,omitempty"`
}

VolumeRestoreStatus represents the current status of a volume restore.

func (*VolumeRestoreStatus) DeepCopy

func (in *VolumeRestoreStatus) DeepCopy() *VolumeRestoreStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreStatus.

func (*VolumeRestoreStatus) DeepCopyInto

func (in *VolumeRestoreStatus) DeepCopyInto(out *VolumeRestoreStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestoreStep

type VolumeRestoreStep struct {
	// StepName is the name of volume restore step
	StepName VolumeRestoreStepType `json:"stepName"`
	// TimeStarted is the time at which the restore step was started.
	// +nullable
	TimeStarted metav1.Time `json:"timeStarted,omitempty"`
	// TimeCompleted is the time at which the restore step was completed.
	// +nullable
	TimeCompleted metav1.Time `json:"timeCompleted,omitempty"`
	// TimeTaken is the time that all the data planes take, it is TimeCompleted - TimeStarted
	TimeTaken string `json:"timeTaken,omitempty"`
}

func (*VolumeRestoreStep) DeepCopy

func (in *VolumeRestoreStep) DeepCopy() *VolumeRestoreStep

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeRestoreStep.

func (*VolumeRestoreStep) DeepCopyInto

func (in *VolumeRestoreStep) DeepCopyInto(out *VolumeRestoreStep)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeRestoreStepType

type VolumeRestoreStepType string
const (
	// VolumeRestoreStepRestoreVolume is restore volume step
	VolumeRestoreStepRestoreVolume VolumeRestoreStepType = "RestoreVolume"
	// VolumeRestoreStepStartTiKV is start tikv step
	VolumeRestoreStepStartTiKV VolumeRestoreStepType = "StartTiKV"
	// VolumeRestoreStepWarmUp is warm up tikv volumes step
	VolumeRestoreStepWarmUp VolumeRestoreStepType = "WarmUp"
	// VolumeRestoreStepRestoreData is restore data step
	VolumeRestoreStepRestoreData VolumeRestoreStepType = "RestoreData"
	// VolumeRestoreStepRestartTiKV is restart tikv step
	VolumeRestoreStepRestartTiKV VolumeRestoreStepType = "RestartTiKV"
)

Jump to

Keyboard shortcuts

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