v1alpha1

package
v2.0.0-...-dd10e7f Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

+groupName=br.pingcap.com +k8s:openapi-gen=true +k8s:deepcopy-gen=package

+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch;create;update;patch;delete

+kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=core,resources=persistentvolumeclaims,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=core,resources=persistentvolumes,verbs=get;list;watch +kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch +kubebuilder:rbac:groups=core,resources=nodes,verbs=get;list;watch +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete

+kubebuilder:rbac:groups=br.pingcap.com,resources=backups,verbs=get;list;watch;update +kubebuilder:rbac:groups=br.pingcap.com,resources=backups/status,verbs=get;update;patch

+kubebuilder:rbac:groups=br.pingcap.com,resources=restores,verbs=get;list;watch;update +kubebuilder:rbac:groups=br.pingcap.com,resources=restores/status,verbs=get;update;patch

+kubebuilder:rbac:groups=br.pingcap.com,resources=backupschedules,verbs=get;list;watch;update +kubebuilder:rbac:groups=br.pingcap.com,resources=backupschedules/status,verbs=get;update;patch

+kubebuilder:rbac:groups=br.pingcap.com,resources=compactbackups,verbs=get;list;watch;update +kubebuilder:rbac:groups=br.pingcap.com,resources=compactbackups/status,verbs=get;update;patch

+kubebuilder:rbac:verbs=get,urls=/metrics

Package v1alpha1 is the v1alpha1 version of br tidb operator api

Index

Constants

View Source
const (
	// Label value for meta.LabelKeyComponent
	LabelValComponentBackup  = "backup"
	LabelValComponentRestore = "restore"
	LabelValComponentTiBR    = "tibr"
)
View Source
const (
	ContainerAutoBackup = "auto-backup" // the container name for auto backup
	ContainerAPIServer  = "api-server"  // the container name for api server

	VolumeTiBRData                 = "data"
	VolumeTiBRDataDefaultMountPath = "/data"
)
View Source
const (
	TiBRCondReady  = "Ready"
	TiBRCondSynced = "Synced"

	// TODO: need to make it more specific
	TiBRReasonNotReady = "NotReady"
	TiBRReasonReady    = "Ready"
	TiBRReasonUnSynced = "UnSynced"
	TiBRReasonSynced   = "Synced"
)
View Source
const (
	// BackupNameTimeFormat is the time format for generate backup CR name
	BackupNameTimeFormat = "2006-01-02t15-04-05"

	BackupTimestampFormat = "2006-01-02 15:04:05"
)
View Source
const (
	// DefaultTidbUser is the default tidb user for login tidb cluster
	DefaultTidbUser = "root"
)
View Source
const (
	// DirPathBRBin is the directory path of br binary
	DirPathBRBin = "/var/lib/br-bin"
)
View Source
const GroupName = "br.pingcap.com"

GroupName specifies the group name used to register the objects.

Variables

View Source
var (
	// BackupControllerKind contains the schema.GroupVersionKind for backup controller type.
	BackupControllerKind = SchemeGroupVersion.WithKind("Backup")

	RestoreControllerKind = SchemeGroupVersion.WithKind("Restore")
)
View Source
var (
	// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
	SchemeBuilder runtime.SchemeBuilder

	// Deprecated: use Install instead
	AddToScheme = localSchemeBuilder.AddToScheme
	Install     = localSchemeBuilder.AddToScheme
)
View Source
var (
	DefaultBatchDeleteOption = BatchDeleteOption{
		BatchConcurrency:   10,
		RoutineConcurrency: 100,
	}
)
View Source
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"}

GroupVersion specifies the group and the version used to register the objects.

View Source
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects Deprecated: use GroupVersion instead.

Functions

func GetBackupCondition

func GetBackupCondition(status *BackupStatus, conditionType BackupConditionType) (int, *metav1.Condition)

GetBackupCondition get the specify type's BackupCondition from the given BackupStatus

func GetBackupOwnerRef

func GetBackupOwnerRef(backup *Backup) metav1.OwnerReference

GetBackupOwnerRef returns Backup's OwnerReference

func GetBackupScheduleOwnerRef

func GetBackupScheduleOwnerRef(bs *BackupSchedule) metav1.OwnerReference

GetBackupScheduleOwnerRef returns BackupSchedule's OwnerReference

func GetLogSubcommandConditionInfo

func GetLogSubcommandConditionInfo(backup *Backup) (reason, message string)

GetLogSubcommandConditionInfo gets log subcommand current phase's reason and message

func GetRestoreCondition

func GetRestoreCondition(status *RestoreStatus, conditionType RestoreConditionType) (int, *metav1.Condition)

GetRestoreCondition get the specify type's RestoreCondition from the given RestoreStatus

func GetRestoreOwnerRef

func GetRestoreOwnerRef(restore *Restore) metav1.OwnerReference

GetRestoreOwnerRef returns Restore's OwnerReference

func GoTimeToTS

func GoTimeToTS(t time.Time) uint64

GoTimeToTS converts a Go time to uint64 timestamp. port from tidb.

func HashContents

func HashContents(contents []byte) string

HashContents hashes the contents using FNV hashing. The returned hash will be a safe encoded string to avoid bad words.

func HaveTruncateUntil

func HaveTruncateUntil(backup *Backup) bool

HaveTruncateUntil returns true if a Backup has truncate until set

func IsBackupClean

func IsBackupClean(backup *Backup) bool

IsBackupClean returns true if a Backup has been successfully cleaned up

func IsBackupCleanFailed

func IsBackupCleanFailed(backup *Backup) bool

IsBackupCleanFailed returns true if a Backup has failed to clean up

func IsBackupComplete

func IsBackupComplete(backup *Backup) bool

IsBackupComplete returns true if a Backup has successfully completed

func IsBackupFailed

func IsBackupFailed(backup *Backup) bool

IsBackupFailed returns true if a Backup has failed

func IsBackupInvalid

func IsBackupInvalid(backup *Backup) bool

IsBackupInvalid returns true if a Backup has invalid condition set

func IsBackupPrepared

func IsBackupPrepared(backup *Backup) bool

IsBackupPrepared returns true if a Backup is Prepare.

func IsBackupRestart

func IsBackupRestart(backup *Backup) bool

IsBackupRestart returns true if a Backup was restarted.

func IsBackupRunning

func IsBackupRunning(backup *Backup) bool

IsBackupRunning returns true if a Backup is Running.

func IsBackupScheduled

func IsBackupScheduled(backup *Backup) bool

IsBackupScheduled returns true if a Backup has successfully scheduled

func IsCleanCandidate

func IsCleanCandidate(backup *Backup) bool

IsCleanCandidate returns true if a Backup should be added to clean candidate according to cleanPolicy

func IsLogBackupAlreadyPaused

func IsLogBackupAlreadyPaused(backup *Backup) bool

IsLogBackupAlreadyPaused return whether log backup has already paused.

func IsLogBackupAlreadyRunning

func IsLogBackupAlreadyRunning(backup *Backup) bool

IsLogBackupAlreadyRunning return whether log backup has already resumed.

func IsLogBackupAlreadyStart

func IsLogBackupAlreadyStart(backup *Backup) bool

IsLogBackupAlreadyStart return whether log backup has already started.

func IsLogBackupAlreadyStop

func IsLogBackupAlreadyStop(backup *Backup) bool

IsLogBackupAlreadyStop return whether log backup has already stopped.

func IsLogBackupAlreadyTruncate

func IsLogBackupAlreadyTruncate(backup *Backup) bool

IsLogBackupAlreadyTruncate return whether log backup has already truncated.

func IsLogBackupOnTrack

func IsLogBackupOnTrack(backup *Backup) bool

IsLogBackupOnTrack returns whether log backup is on track.

func IsLogBackupSubCommandOntheCondition

func IsLogBackupSubCommandOntheCondition(backup *Backup, conditionType BackupConditionType) bool

IsLogBackupSubCommandOntheCondition return whether the log subcommand on the condition.

func IsLogSubcommandAlreadySync

func IsLogSubcommandAlreadySync(backup *Backup, subCommand LogSubCommandType) bool

IsLogSubcommandAlreadySync return whether the log subcommand already sync. It only check start/stop/pause subcommand. Truncate subcommand need to check the `logTruncateUntil` separately.

func IsRestoreComplete

func IsRestoreComplete(restore *Restore) bool

IsRestoreComplete returns true if a Restore has successfully completed

func IsRestoreFailed

func IsRestoreFailed(restore *Restore) bool

IsRestoreFailed returns true if a Restore is Failed

func IsRestoreInvalid

func IsRestoreInvalid(restore *Restore) bool

IsRestoreInvalid returns true if a Restore has invalid condition set

func IsRestoreRunning

func IsRestoreRunning(restore *Restore) bool

IsRestoreRunning returns true if a Restore is Running

func IsRestoreScheduled

func IsRestoreScheduled(restore *Restore) bool

IsRestoreScheduled returns true if a Restore has successfully scheduled

func NeedRetainData

func NeedRetainData(backup *Backup) bool

NeedRetainData returns true if a Backup need not to be cleaned up according to cleanPolicy

func ParseTSString

func ParseTSString(ts string) (uint64, error)

ParseTSString supports TSO or datetime, e.g. '400036290571534337', '2006-01-02 15:04:05'

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

func UpdateBackupCondition

func UpdateBackupCondition(status *BackupStatus, condition *metav1.Condition) bool

UpdateBackupCondition updates existing Backup condition or creates a new one. Sets LastTransitionTime to now if the status has changed. Returns true if Backup condition has changed or has been added.

func UpdateRestoreCondition

func UpdateRestoreCondition(status *RestoreStatus, condition *metav1.Condition) bool

UpdateRestoreCondition updates existing Restore condition or creates a new one. Sets LastTransitionTime to now if the status has changed. Returns true if Restore condition has changed or has been added.

Types

type AzblobStorageProvider

type AzblobStorageProvider struct {
	// Path is the full path where the backup is saved.
	// The format of the path must be: "<container-name>/<path-to-backup-file>"
	Path string `json:"path,omitempty"`
	// Container in which to store the backup data.
	Container string `json:"container,omitempty"`
	// Access tier of the uploaded objects.
	AccessTier string `json:"accessTier,omitempty"`
	// SecretName is the name of secret which stores the
	// azblob service account credentials.
	SecretName string `json:"secretName,omitempty"`
	// StorageAccount is the storage account of the azure blob storage
	// If this field is set, then use this to set backup-manager env
	// Otherwise retrieve the storage account from secret
	StorageAccount string `json:"storageAccount,omitempty"`
	// SasToken is the sas token of the storage account
	SasToken string `json:"sasToken,omitempty"`
	// Prefix of the data path.
	Prefix string `json:"prefix,omitempty"`
}

+k8s:openapi-gen=true AzblobStorageProvider represents the azure blob storage for storing backups.

func (*AzblobStorageProvider) DeepCopy

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

func (*AzblobStorageProvider) DeepCopyInto

func (in *AzblobStorageProvider) DeepCopyInto(out *AzblobStorageProvider)

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

type BRConfig

type BRConfig struct {
	// ClusterName of backup/restore cluster
	Cluster string `json:"cluster"`
	// Namespace of backup/restore cluster
	ClusterNamespace string `json:"clusterNamespace,omitempty"`
	// Deprecated from BR v4.0.3. Please use `Spec.TableFilter` instead. DB is the specific DB which will be backed-up or restored
	DB string `json:"db,omitempty"`
	// Deprecated from BR v4.0.3. Please use `Spec.TableFilter` instead. Table is the specific table which will be backed-up or restored
	Table string `json:"table,omitempty"`
	// LogLevel is the log level
	LogLevel string `json:"logLevel,omitempty"`
	// StatusAddr is the HTTP listening address for the status report service. Set to empty string to disable
	StatusAddr string `json:"statusAddr,omitempty"`
	// Concurrency is the size of thread pool on each node that execute the backup task
	Concurrency *uint32 `json:"concurrency,omitempty"`
	// RateLimit is the rate limit of the backup task, MB/s per node
	RateLimit *uint `json:"rateLimit,omitempty"`
	// TimeAgo is the history version of the backup task, e.g. 1m, 1h
	TimeAgo string `json:"timeAgo,omitempty"`
	// Checksum specifies whether to run checksum after backup
	Checksum *bool `json:"checksum,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"`
	// OnLine specifies whether online during restore
	OnLine *bool `json:"onLine,omitempty"`
	// Options means options for backup data to remote storage with BR. These options has highest priority.
	Options []string `json:"options,omitempty"`
}

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

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.

type BackoffRetryPolicy

type BackoffRetryPolicy struct {
	// MinRetryDuration is the min retry duration, the retry duration will be MinRetryDuration << (retry num -1)
	// format reference, https://golang.org/pkg/time/#ParseDuration
	// +kubebuilder:default="300s"
	MinRetryDuration string `json:"minRetryDuration,omitempty"`
	// MaxRetryTimes is the max retry times
	// +kubebuilder:default=2
	MaxRetryTimes int `json:"maxRetryTimes,omitempty"`
	// RetryTimeout is the retry timeout
	// format reference, https://golang.org/pkg/time/#ParseDuration
	// +kubebuilder:default="30m"
	RetryTimeout string `json:"retryTimeout,omitempty"`
}

BackoffRetryPolicy is the backoff retry policy, currently only valid for snapshot backup. When backup job or pod failed, it will retry in the following way: first time: retry after MinRetryDuration second time: retry after MinRetryDuration * 2 third time: retry after MinRetryDuration * 2 * 2 ... as the limit: 1. the number of retries can not exceed MaxRetryTimes 2. the time from discovery failure can not exceed RetryTimeout

func (*BackoffRetryPolicy) DeepCopy

func (in *BackoffRetryPolicy) DeepCopy() *BackoffRetryPolicy

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

func (*BackoffRetryPolicy) DeepCopyInto

func (in *BackoffRetryPolicy) DeepCopyInto(out *BackoffRetryPolicy)

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

type BackoffRetryRecord

type BackoffRetryRecord struct {
	// RetryNum is the number of retry
	RetryNum int `json:"retryNum,omitempty"`
	// DetectFailedAt is the time when detect failure
	DetectFailedAt *metav1.Time `json:"detectFailedAt,omitempty"`
	// ExpectedRetryAt is the time we calculate and expect retry after it
	ExpectedRetryAt *metav1.Time `json:"expectedRetryAt,omitempty"`
	// RealRetryAt is the time when the retry was actually initiated
	RealRetryAt *metav1.Time `json:"realRetryAt,omitempty"`
	// Reason is the reason of retry
	RetryReason string `json:"retryReason,omitempty"`
	// OriginalReason is the original reason of backup job or pod failed
	OriginalReason string `json:"originalReason,omitempty"`
}

BackoffRetryRecord is the record of backoff retry

func (*BackoffRetryRecord) DeepCopy

func (in *BackoffRetryRecord) DeepCopy() *BackoffRetryRecord

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

func (*BackoffRetryRecord) DeepCopyInto

func (in *BackoffRetryRecord) DeepCopyInto(out *BackoffRetryRecord)

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

func (BackoffRetryRecord) IsTriggered

func (r BackoffRetryRecord) IsTriggered() bool

type Backup

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

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

Backup is a backup of tidb cluster.

func (*Backup) DeepCopy

func (in *Backup) DeepCopy() *Backup

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

func (*Backup) DeepCopyInto

func (in *Backup) DeepCopyInto(out *Backup)

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

func (*Backup) DeepCopyObject

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

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

func (*Backup) GetAllLogBackupJobName

func (bk *Backup) GetAllLogBackupJobName() []string

GetAllLogBackupJobName return the all log backup job name

func (*Backup) GetBackupJobName

func (bk *Backup) GetBackupJobName() string

GetBackupJobName return the backup job name

func (*Backup) GetCleanJobName

func (bk *Backup) GetCleanJobName() string

GetCleanJobName return the clean job name

func (*Backup) GetCleanOption

func (bk *Backup) GetCleanOption() CleanOption

GetCleanOption return the clean option

func (*Backup) GetInstanceName

func (bk *Backup) GetInstanceName() string

GetInstanceName return the backup instance name

func (*Backup) GetStopLogBackupJobName

func (bk *Backup) GetStopLogBackupJobName() string

GetCleanJobName return the clean job name for log backup

func (*Backup) GetVolumeBackupInitializeJobName

func (bk *Backup) GetVolumeBackupInitializeJobName() string

func (*Backup) LastRetryRecord

func (b *Backup) LastRetryRecord() (BackoffRetryRecord, bool)

func (*Backup) PostRetry

func (b *Backup) PostRetry(now time.Time) error

PostRetry records the retry result, in other words, the retry is triggered

func (*Backup) Retry

func (b *Backup) Retry(reason, originalReason string, now time.Time) (nextRunAfter *time.Duration, _ error)

TODO(ideascf): extract this to a common function Retry creates and records the next retry time and reason, the real retry will happen at record.ExpectedRetryAt

type BackupCondition

type BackupCondition struct {
	Command LogSubCommandType `json:"command,omitempty"`

	metav1.Condition `json:",inline"`
}

BackupCondition describes the observed state of a Backup at a certain point.

func (*BackupCondition) DeepCopy

func (in *BackupCondition) DeepCopy() *BackupCondition

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

func (*BackupCondition) DeepCopyInto

func (in *BackupCondition) DeepCopyInto(out *BackupCondition)

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

type BackupConditionType

type BackupConditionType string

BackupConditionType represents a valid condition of a Backup.

const (
	// BackupScheduled means the backup related job has been created
	BackupScheduled BackupConditionType = "Scheduled"
	// BackupRunning means the backup is currently being executed.
	BackupRunning BackupConditionType = "Running"
	// BackupComplete means the backup has successfully executed and the
	// resulting artifact has been stored in backend storage.
	BackupComplete BackupConditionType = "Complete"
	// BackupClean means the clean job has been created to clean backup data
	BackupClean BackupConditionType = "Clean"
	// BackupRepeatable should ONLY be used in log backup
	// It means some log backup sub-command completed and the log backup can be re-run
	BackupRepeatable BackupConditionType = "Repeatable"
	// BackupFailed means the backup has failed.
	BackupFailed BackupConditionType = "Failed"
	// BackupRetryTheFailed means this failure can be retried
	BackupRetryTheFailed BackupConditionType = "RetryFailed"
	// BackupCleanFailed means the clean job has failed
	BackupCleanFailed BackupConditionType = "CleanFailed"
	// BackupInvalid means invalid backup CR
	BackupInvalid BackupConditionType = "Invalid"
	// BackupPrepare means the backup prepare backup process
	BackupPrepare BackupConditionType = "Prepare"
	// BackupPaused means the backup was paused
	BackupPaused BackupConditionType = "Paused"
	// BackupStopped means the backup was stopped, just log backup has this condition
	BackupStopped BackupConditionType = "Stopped"
	// BackupRestart means the backup was restarted, now just support snapshot backup
	BackupRestart BackupConditionType = "Restart"
)

type BackupList

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

	Items []Backup `json:"items"`
}

+k8s:openapi-gen=true BackupList contains a list of Backup.

func (*BackupList) DeepCopy

func (in *BackupList) DeepCopy() *BackupList

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

func (*BackupList) DeepCopyInto

func (in *BackupList) DeepCopyInto(out *BackupList)

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

func (*BackupList) DeepCopyObject

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

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

type BackupMode

type BackupMode string

BackupType represents the backup mode, such as snapshot backup or log backup. +k8s:openapi-gen=true

const (
	// BackupModeSnapshot represents the snapshot backup of tidb cluster.
	BackupModeSnapshot BackupMode = "snapshot"
	// BackupModeLog represents the log backup of tidb cluster.
	BackupModeLog BackupMode = "log"
)

type BackupSchedule

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

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

BackupSchedule is a backup schedule of tidb cluster.

+k8s:openapi-gen=true +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories=br +kubebuilder:resource:shortName="bks" +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 (*BackupSchedule) DeepCopy

func (in *BackupSchedule) DeepCopy() *BackupSchedule

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

func (*BackupSchedule) DeepCopyInto

func (in *BackupSchedule) DeepCopyInto(out *BackupSchedule)

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

func (*BackupSchedule) DeepCopyObject

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

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

func (*BackupSchedule) GetBackupCRDName

func (bs *BackupSchedule) GetBackupCRDName(timestamp time.Time) string

func (*BackupSchedule) GetCompactBackupCRDName

func (bs *BackupSchedule) GetCompactBackupCRDName(timestamp time.Time) string

func (*BackupSchedule) GetLogBackupCRDName

func (bs *BackupSchedule) GetLogBackupCRDName() string

type BackupScheduleList

type BackupScheduleList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []BackupSchedule `json:"items"`
}

+k8s:openapi-gen=true BackupScheduleList contains a list of BackupSchedule.

func (*BackupScheduleList) DeepCopy

func (in *BackupScheduleList) DeepCopy() *BackupScheduleList

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

func (*BackupScheduleList) DeepCopyInto

func (in *BackupScheduleList) DeepCopyInto(out *BackupScheduleList)

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

func (*BackupScheduleList) DeepCopyObject

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

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

type BackupScheduleSpec

type BackupScheduleSpec 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"`
	// CompactSpan is to specify how long backups we want to compact.
	CompactSpan *string `json:"compactSpan,omitempty"`
	// BackupTemplate is the specification of the backup structure to get scheduled.
	BackupTemplate BackupSpec `json:"backupTemplate"`
	// LogBackupTemplate is the specification of the log backup structure to get scheduled.
	// +optional
	LogBackupTemplate *BackupSpec `json:"logBackupTemplate"`
	// CompactBackupTemplate is the specification of the compact backup structure to get scheduled.
	// +optional
	CompactBackupTemplate *CompactSpec `json:"compactBackupTemplate"`
	// The storageClassName of the persistent volume for Backup data storage if not storage class name set in BackupSpec.
	// Defaults to Kubernetes default storage class.
	// +optional
	StorageClassName *string `json:"storageClassName,omitempty"`
	// StorageSize is the request storage size for backup job
	StorageSize string `json:"storageSize,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"`
	// BRConfig is the configs for BR
	// +optional
	BR *BRConfig `json:"br,omitempty"`
	// StorageProvider configures where and how backups should be stored.
	// +optional
	StorageProvider `json:",inline"`
}

+k8s:openapi-gen=true BackupScheduleSpec contains the backup schedule specification for a tidb cluster.

func (*BackupScheduleSpec) DeepCopy

func (in *BackupScheduleSpec) DeepCopy() *BackupScheduleSpec

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

func (*BackupScheduleSpec) DeepCopyInto

func (in *BackupScheduleSpec) DeepCopyInto(out *BackupScheduleSpec)

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

type BackupScheduleStatus

type BackupScheduleStatus struct {
	// LastBackup represents the last backup.
	LastBackup string `json:"lastBackup,omitempty"`
	// LastCompact represents the last compact
	LastCompact string `json:"lastCompact,omitempty"`
	// logBackup represents the name of log backup.
	LogBackup *string `json:"logBackup,omitempty"`
	// LogBackupStartTs represents the start time of log backup
	LogBackupStartTs *metav1.Time `json:"logBackupStartTs,omitempty"`
	// LastBackupTime represents the last time the backup was successfully created.
	LastBackupTime *metav1.Time `json:"lastBackupTime,omitempty"`
	// LastCompactTs represents the endTs of the last compact
	LastCompactTs *metav1.Time `json:"lastCompactTs,omitempty"`
	// NextCompactEndTs represents the scheduled endTs of next compact
	NextCompactEndTs *metav1.Time `json:"nextCompactEndTs,omitempty"`
	// AllBackupCleanTime represents the time when all backup entries are cleaned up
	AllBackupCleanTime *metav1.Time `json:"allBackupCleanTime,omitempty"`
}

BackupScheduleStatus represents the current state of a BackupSchedule.

func (*BackupScheduleStatus) DeepCopy

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

func (*BackupScheduleStatus) DeepCopyInto

func (in *BackupScheduleStatus) DeepCopyInto(out *BackupScheduleStatus)

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

type BackupSpec

type BackupSpec 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"`
	// Type is the backup type for tidb cluster and only used when Mode = snapshot, such as full, db, table.
	Type BackupType `json:"backupType,omitempty"`
	// Mode is the backup mode, such as snapshot backup or log backup.
	// +kubebuilder:default=snapshot
	Mode BackupMode `json:"backupMode,omitempty"`
	// StorageProvider configures where and how backups should be stored.
	// *** Note: This field should generally not be left empty, unless you are certain the storage provider
	// *** can be obtained from another source, such as a schedule CR.
	StorageProvider `json:",inline"`
	// BRConfig is the configs for BR
	// *** Note: This field should generally not be left empty, unless you are certain the BR config
	// *** can be obtained from another source, such as a schedule CR.
	BR *BRConfig `json:"br,omitempty"`

	// The storageClassName of the persistent volume for Backup data storage.
	// Defaults to Kubernetes default storage class.
	// +optional
	StorageClassName *string `json:"storageClassName,omitempty"`
	// StorageSize is the request storage size for backup job
	StorageSize string `json:"storageSize,omitempty"`

	// CommitTs is the commit ts of the backup, snapshot ts for full backup or start ts for log backup.
	// Format supports TSO or datetime, e.g. '400036290571534337', '2018-05-11 01:42:23'.
	// Default is current timestamp.
	// +optional
	CommitTs string `json:"commitTs,omitempty"`
	// Subcommand is the subcommand for BR, such as start, stop, pause etc.
	// +optional
	// +kubebuilder:validation:Enum:="log-start";"log-stop";"log-pause";"log-resume";"log-truncate"
	LogSubcommand LogSubCommandType `json:"logSubcommand,omitempty"`
	// LogTruncateUntil is log backup truncate until timestamp.
	// Format supports TSO or datetime, e.g. '400036290571534337', '2018-05-11 01:42:23'.
	// It's required when LogSubcommand is "log-truncate".
	// +optional
	LogTruncateUntil string `json:"logTruncateUntil,omitempty"`
	// Deprecated: use LogSubcommand instead. it will be removed later.
	// LogStop indicates that will stop the log backup.
	// +optional
	LogStop bool `json:"logStop,omitempty"`

	// Base tolerations of backup Pods, components may add more tolerations upon this respectively
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
	// ToolImage specifies the tool image used in `Backup`, which supports BR and Dumpling images.
	// For examples `spec.toolImage: pingcap/br:v4.0.8` or `spec.toolImage: pingcap/dumpling:v4.0.8`
	// 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"`
	// TableFilter means Table filter expression for 'db.table' matching. BR supports this from v4.0.3.
	TableFilter []string `json:"tableFilter,omitempty"`
	// Affinity of backup Pods
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
	// Use KMS to decrypt the secrets
	UseKMS bool `json:"useKMS,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
	// +kubebuilder:validation:Enum:=Retain;OnFailure;Delete
	// +kubebuilder:default=Retain
	CleanPolicy CleanPolicyType `json:"cleanPolicy,omitempty"`
	// CleanOption controls the behavior of clean.
	CleanOption *CleanOption `json:"cleanOption,omitempty"`

	// PodSecurityContext of the component
	// +optional
	PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`

	// PriorityClassName of Backup Job Pods
	PriorityClassName string `json:"priorityClassName,omitempty"`

	// BackoffRetryPolicy the backoff retry policy, currently only valid for snapshot backup
	BackoffRetryPolicy BackoffRetryPolicy `json:"backoffRetryPolicy,omitempty"`

	// Additional volumes of component pod.
	// +optional
	AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`
	// Additional volume mounts of component pod.
	// +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"`
}

BackupSpec contains the backup specification for a tidb cluster. +k8s:openapi-gen=true +kubebuilder:validation:XValidation:rule="has(self.logSubcommand) ? !has(self.logStop) : true",message="Field `logStop` is the old version field, please use `logSubcommand` instead" +kubebuilder:validation:XValidation:rule="has(self.logStop) ? !has(self.logSubcommand) : true",message="Field `logStop` is the old version field, please use `logSubcommand` instead"

func (*BackupSpec) DeepCopy

func (in *BackupSpec) DeepCopy() *BackupSpec

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

func (*BackupSpec) DeepCopyInto

func (in *BackupSpec) DeepCopyInto(out *BackupSpec)

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

type BackupStatus

type BackupStatus struct {
	// BackupPath is the location of the backup.
	BackupPath string `json:"backupPath,omitempty"`
	// TimeStarted is the time at which the backup was started.
	// TODO: remove nullable, https://github.com/kubernetes/kubernetes/issues/86811
	// +nullable
	TimeStarted metav1.Time `json:"timeStarted,omitempty"`
	// TimeCompleted is the time at which the backup was completed.
	// TODO: remove nullable, https://github.com/kubernetes/kubernetes/issues/86811
	// +nullable
	TimeCompleted metav1.Time `json:"timeCompleted,omitempty"`
	// TimeTaken is the time that backup 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"`
	// LogSuccessTruncateUntil is log backup already successfully truncate until timestamp.
	LogSuccessTruncateUntil string `json:"logSuccessTruncateUntil,omitempty"`
	// LogCheckpointTs is the ts of log backup process.
	LogCheckpointTs string `json:"logCheckpointTs,omitempty"`
	// Phase is a user readable state inferred from the underlying Backup conditions
	Phase BackupConditionType `json:"phase,omitempty"`
	// +nullable
	// Conditions []BackupCondition `json:"conditions,omitempty"`
	Conditions []metav1.Condition `json:"conditions,omitempty"`
	// LogSubCommandStatuses is the detail status of log backup subcommands, record each command separately, but only record the last command.
	LogSubCommandStatuses map[LogSubCommandType]LogSubCommandStatus `json:"logSubCommandStatuses,omitempty"`
	// Progresses is the progress of backup.
	// +nullable
	Progresses []Progress `json:"progresses,omitempty"`
	// BackoffRetryStatus is status of the backoff retry, it will be used when backup pod or job exited unexpectedly
	BackoffRetryStatus []BackoffRetryRecord `json:"backoffRetryStatus,omitempty"`
}

BackupStatus represents the current status of a backup.

func (*BackupStatus) DeepCopy

func (in *BackupStatus) DeepCopy() *BackupStatus

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

func (*BackupStatus) DeepCopyInto

func (in *BackupStatus) DeepCopyInto(out *BackupStatus)

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

type BackupStorageType

type BackupStorageType string

+k8s:openapi-gen=true BackupStorageType represents the backend storage type of backup.

const (
	// BackupStorageTypeS3 represents all storage that compatible with the Amazon S3.
	BackupStorageTypeS3 BackupStorageType = "s3"
	// BackupStorageTypeGcs represents the google cloud storage
	BackupStorageTypeGcs BackupStorageType = "gcs"
	// BackupStorageType represents the azure blob storage
	BackupStorageTypeAzblob BackupStorageType = "azblob"
	// BackupStorageTypeLocal represents local volume storage type
	BackupStorageTypeLocal BackupStorageType = "local"
	// BackupStorageTypeUnknown represents the unknown storage type
	BackupStorageTypeUnknown BackupStorageType = "unknown"
)

type BackupType

type BackupType string

BackupType represents the backup type. +k8s:openapi-gen=true

const (
	// BackupTypeFull represents the full backup of tidb cluster.
	BackupTypeFull BackupType = "full"
	// BackupTypeRaw represents the raw backup of tidb cluster.
	BackupTypeRaw BackupType = "raw"
	// BackupTypeDB represents the backup of one DB for the tidb cluster.
	BackupTypeDB BackupType = "db"
	// BackupTypeTable represents the backup of one table for the tidb cluster.
	BackupTypeTable BackupType = "table"
	// BackupTypeTiFlashReplica represents restoring the tiflash replica removed by a failed restore of the older version BR
	BackupTypeTiFlashReplica BackupType = "tiflash-replica"
)

type BatchDeleteOption

type BatchDeleteOption struct {
	// DisableBatchConcurrency disables the batch deletions with S3 API and the deletion will be done by goroutines.
	DisableBatchConcurrency bool `json:"disableBatchConcurrency,omitempty"`
	// BatchConcurrency represents the number of batch deletions in parallel.
	// It is used when the storage provider supports the batch delete API, currently, S3 only.
	// default is 10
	BatchConcurrency uint32 `json:"batchConcurrency,omitempty"`
	// RoutineConcurrency represents the number of goroutines that used to delete objects
	// default is 100
	RoutineConcurrency uint32 `json:"routineConcurrency,omitempty"`
}

BatchDeleteOption controls the options to delete the objects in batches during the cleanup of backups

+k8s:openapi-gen=true

func (*BatchDeleteOption) DeepCopy

func (in *BatchDeleteOption) DeepCopy() *BatchDeleteOption

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

func (*BatchDeleteOption) DeepCopyInto

func (in *BatchDeleteOption) DeepCopyInto(out *BatchDeleteOption)

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

type CleanOption

type CleanOption struct {
	// PageSize represents the number of objects to clean at a time.
	// default is 10000
	PageSize uint64 `json:"pageSize,omitempty"`
	// RetryCount represents the number of retries in pod when the cleanup fails.
	// +kubebuilder:default=5
	RetryCount int `json:"retryCount,omitempty"`
	// BackoffEnabled represents whether to enable the backoff when a deletion API fails.
	// It is useful when the deletion API is rate limited.
	BackoffEnabled bool `json:"backoffEnabled,omitempty"`

	BatchDeleteOption `json:",inline"`
}

CleanOption defines the configuration for cleanup backup

+k8s:openapi-gen=true

func (*CleanOption) DeepCopy

func (in *CleanOption) DeepCopy() *CleanOption

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

func (*CleanOption) DeepCopyInto

func (in *CleanOption) DeepCopyInto(out *CleanOption)

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

type CleanPolicyType

type CleanPolicyType string

+k8s:openapi-gen=true CleanPolicyType represents the clean policy of backup data in remote storage

const (
	// CleanPolicyTypeRetain represents that the backup data in remote storage will be retained when the Backup CR is deleted
	CleanPolicyTypeRetain CleanPolicyType = "Retain"
	// CleanPolicyTypeOnFailure represents that the backup data in remote storage will be cleaned only for the failed backups when the Backup CR is deleted
	CleanPolicyTypeOnFailure CleanPolicyType = "OnFailure"
	// CleanPolicyTypeDelete represents that the backup data in remote storage will be cleaned when the Backup CR is deleted
	CleanPolicyTypeDelete CleanPolicyType = "Delete"
)

type CompactBackup

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

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

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +k8s:openapi-gen=true +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories=br +kubebuilder:resource:shortName="cpbk" +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.state`,description="The current status of the compact backup" +kubebuilder:printcolumn:name="Progress",type=string,JSONPath=`.status.progress`,description="The progress of the compact backup" +kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.message`,description="The message of the compact backup"

func (*CompactBackup) DeepCopy

func (in *CompactBackup) DeepCopy() *CompactBackup

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

func (*CompactBackup) DeepCopyInto

func (in *CompactBackup) DeepCopyInto(out *CompactBackup)

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

func (*CompactBackup) DeepCopyObject

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

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

type CompactBackupList

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

	Items []CompactBackup `json:"items"`
}

+k8s:openapi-gen=true CompactList contains a list of Compact Backup.

func (*CompactBackupList) DeepCopy

func (in *CompactBackupList) DeepCopy() *CompactBackupList

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

func (*CompactBackupList) DeepCopyInto

func (in *CompactBackupList) DeepCopyInto(out *CompactBackupList)

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

func (*CompactBackupList) DeepCopyObject

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

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

type CompactRetryRecord

type CompactRetryRecord struct {
	// RetryNum is the number of retry
	RetryNum int `json:"retryNum,omitempty"`
	// DetectFailedAt is the time when detect failure
	DetectFailedAt metav1.Time `json:"detectFailedAt,omitempty"`
	// Reason is the reason of retry
	RetryReason string `json:"retryReason,omitempty"`
}

CompactRetryRecord is the record of compact backoff retry

func (*CompactRetryRecord) DeepCopy

func (in *CompactRetryRecord) DeepCopy() *CompactRetryRecord

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

func (*CompactRetryRecord) DeepCopyInto

func (in *CompactRetryRecord) DeepCopyInto(out *CompactRetryRecord)

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

type CompactSpec

type CompactSpec 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"`
	// StorageProvider configures where and how backups should be stored.
	// *** Note: This field should generally not be left empty, unless you are certain the storage provider
	// *** can be obtained from another source, such as a schedule CR.
	StorageProvider `json:",inline"`
	// StartTs is the start ts of the compact backup.
	// Format supports TSO or datetime, e.g. '400036290571534337', '2018-05-11 01:42:23'.
	StartTs string `json:"startTs,omitempty"`
	// EndTs is the end ts of the compact backup.
	// Format supports TSO or datetime, e.g. '400036290571534337', '2018-05-11 01:42:23'.
	// Default is current timestamp.
	// +optional
	EndTs string `json:"endTs,omitempty"`
	// Concurrency is the concurrency of compact backup job
	// +kubebuilder:default=4
	Concurrency int `json:"concurrency,omitempty"`
	// Base tolerations of backup Pods, components may add more tolerations upon this respectively
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
	// BrImage specifies the br image used in compact `Backup`.
	// For examples `spec.brImage: pingcap/br:v4.0.8`
	// For BR image, if it does not contain tag, Pod will use image 'BrImage:${TiKV_Version}'.
	// +optional
	ToolImage string `json:"toolImage,omitempty"`
	// BRConfig is the configs for BR
	// *** Note: This field should generally not be left empty, unless you are certain the BR config
	// *** can be obtained from another source, such as a schedule CR.
	BR *BRConfig `json:"br,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"`
	// Affinity of backup Pods
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
	// Use KMS to decrypt the secrets
	UseKMS bool `json:"useKMS,omitempty"`
	// Specify service account of backup
	ServiceAccount string `json:"serviceAccount,omitempty"`

	// PodSecurityContext of the component
	// +optional
	PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`

	// PriorityClassName of Backup Job Pods
	PriorityClassName string `json:"priorityClassName,omitempty"`

	// BackoffRetryPolicy the backoff retry policy, currently only valid for snapshot backup
	// +kubebuilder:default=6
	MaxRetryTimes int32 `json:"maxRetryTimes,omitempty"`

	// Additional volumes of component pod.
	// +optional
	AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`
	// Additional volume mounts of component pod.
	// +optional
	AdditionalVolumeMounts []corev1.VolumeMount `json:"additionalVolumeMounts,omitempty"`
}

CompactSpec contains the backup specification for a tidb cluster. +k8s:openapi-gen=true

func (*CompactSpec) DeepCopy

func (in *CompactSpec) DeepCopy() *CompactSpec

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

func (*CompactSpec) DeepCopyInto

func (in *CompactSpec) DeepCopyInto(out *CompactSpec)

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

type CompactStatus

type CompactStatus struct {
	// State is the current state of the backup
	State string `json:"state,omitempty"`
	// Progress is the progress of the backup
	Progress string `json:"progress,omitempty"`
	// Message is the error message of the backup
	Message string `json:"message,omitempty"`
	// RetryStatus is status of the backoff retry, it will be used when backup pod or job exited unexpectedly
	RetryStatus []CompactRetryRecord `json:"backoffRetryStatus,omitempty"`
}

func (*CompactStatus) DeepCopy

func (in *CompactStatus) DeepCopy() *CompactStatus

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

func (*CompactStatus) DeepCopyInto

func (in *CompactStatus) DeepCopyInto(out *CompactStatus)

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

type GcsStorageProvider

type GcsStorageProvider struct {
	// ProjectId represents the project that organizes all your Google Cloud Platform resources
	ProjectId string `json:"projectId"`
	// Location in which the gcs bucket is located.
	Location string `json:"location,omitempty"`
	// Path is the full path where the backup is saved.
	// The format of the path must be: "<bucket-name>/<path-to-backup-file>"
	Path string `json:"path,omitempty"`
	// Bucket in which to store the backup data.
	Bucket string `json:"bucket,omitempty"`
	// StorageClass represents the storage class
	StorageClass string `json:"storageClass,omitempty"`
	// ObjectAcl represents the access control list for new objects
	ObjectAcl string `json:"objectAcl,omitempty"`
	// BucketAcl represents the access control list for new buckets
	BucketAcl string `json:"bucketAcl,omitempty"`
	// SecretName is the name of secret which stores the
	// gcs service account credentials JSON.
	SecretName string `json:"secretName,omitempty"`
	// Prefix of the data path.
	Prefix string `json:"prefix,omitempty"`
}

+k8s:openapi-gen=true GcsStorageProvider represents the google cloud storage for storing backups.

func (*GcsStorageProvider) DeepCopy

func (in *GcsStorageProvider) DeepCopy() *GcsStorageProvider

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

func (*GcsStorageProvider) DeepCopyInto

func (in *GcsStorageProvider) DeepCopyInto(out *GcsStorageProvider)

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

type LocalStorageProvider

type LocalStorageProvider struct {
	Volume      corev1.Volume      `json:"volume"`
	VolumeMount corev1.VolumeMount `json:"volumeMount"`
	Prefix      string             `json:"prefix,omitempty"`
}

LocalStorageProvider defines local storage options, which can be any k8s supported mounted volume

func (*LocalStorageProvider) DeepCopy

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

func (*LocalStorageProvider) DeepCopyInto

func (in *LocalStorageProvider) DeepCopyInto(out *LocalStorageProvider)

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

type LogSubCommandStatus

type LogSubCommandStatus struct {
	// Command is the log backup subcommand.
	Command LogSubCommandType `json:"command,omitempty"`
	// TimeStarted is the time at which the command was started.
	// TODO: remove nullable, https://github.com/kubernetes/kubernetes/issues/86811
	// +nullable
	TimeStarted metav1.Time `json:"timeStarted,omitempty"`
	// TimeCompleted is the time at which the command was completed.
	// TODO: remove nullable, https://github.com/kubernetes/kubernetes/issues/86811
	// +nullable
	TimeCompleted metav1.Time `json:"timeCompleted,omitempty"`
	// LogTruncatingUntil is log backup truncate until timestamp which is used to mark the truncate command.
	LogTruncatingUntil string `json:"logTruncatingUntil,omitempty"`
	// Phase is the command current phase.
	Phase BackupConditionType `json:"phase,omitempty"`
	// +nullable
	Conditions []BackupCondition `json:"conditions,omitempty"`
}

LogSubCommandStatus is the log backup subcommand's status.

func (*LogSubCommandStatus) DeepCopy

func (in *LogSubCommandStatus) DeepCopy() *LogSubCommandStatus

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

func (*LogSubCommandStatus) DeepCopyInto

func (in *LogSubCommandStatus) DeepCopyInto(out *LogSubCommandStatus)

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

type LogSubCommandType

type LogSubCommandType string

LogSubCommandType is the log backup subcommand type.

const (
	// LogStartCommand is the start command of log backup.
	LogStartCommand LogSubCommandType = "log-start"
	// LogTruncateCommand is the truncate command of log backup.
	LogTruncateCommand LogSubCommandType = "log-truncate"
	// LogStopCommand is the stop command of log backup.
	LogStopCommand LogSubCommandType = "log-stop"
	// LogPauseCommand is the pause command of log backup.
	LogPauseCommand LogSubCommandType = "log-pause"
	// LogResumeCommand is the resume command of log backup.
	LogResumeCommand LogSubCommandType = "log-resume"
	// LogUnknownCommand is the unknown command of log backup.
	LogUnknownCommand LogSubCommandType = "log-unknown"
)

func ParseLogBackupSubcommand

func ParseLogBackupSubcommand(backup *Backup) LogSubCommandType

ParseLogBackupSubcommand parse the log backup subcommand from cr.

type Progress

type Progress struct {
	// Step is the step name of progress
	Step string `json:"step,omitempty"`
	// Progress is the backup progress value
	Progress int `json:"progress,omitempty"`
	// LastTransitionTime is the update time
	// +nullable
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}

func (*Progress) DeepCopy

func (in *Progress) DeepCopy() *Progress

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

func (*Progress) DeepCopyInto

func (in *Progress) DeepCopyInto(out *Progress)

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

type Restore

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

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

Restore represents the restoration of backup of a tidb cluster.

+k8s:openapi-gen=true +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories=br +kubebuilder:resource:shortName="rt" +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.phase`,description="The current status of the restore" +kubebuilder:printcolumn:name="Started",type=date,JSONPath=`.status.timeStarted`,description="The time at which the restore was started",priority=1 +kubebuilder:printcolumn:name="Completed",type=date,JSONPath=`.status.timeCompleted`,description="The time at which the restore was completed",priority=1 +kubebuilder:printcolumn:name="TimeTaken",type=string,JSONPath=`.status.timeTaken`,description="The time that the restore takes" +kubebuilder:printcolumn:name="CommitTS",type=string,JSONPath=`.status.commitTs`,description="The commit ts of tidb cluster restore" +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

func (*Restore) DeepCopy

func (in *Restore) DeepCopy() *Restore

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

func (*Restore) DeepCopyInto

func (in *Restore) DeepCopyInto(out *Restore)

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

func (*Restore) DeepCopyObject

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

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

func (*Restore) GetInstanceName

func (rs *Restore) GetInstanceName() string

GetInstanceName return the restore instance name

func (*Restore) GetRestoreJobName

func (rs *Restore) GetRestoreJobName() string

GetRestoreJobName return the restore job name

type RestoreCondition

type RestoreCondition struct {
	Type   RestoreConditionType   `json:"type"`
	Status corev1.ConditionStatus `json:"status"`

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

RestoreCondition describes the observed state of a Restore at a certain point.

func (*RestoreCondition) DeepCopy

func (in *RestoreCondition) DeepCopy() *RestoreCondition

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

func (*RestoreCondition) DeepCopyInto

func (in *RestoreCondition) DeepCopyInto(out *RestoreCondition)

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

type RestoreConditionType

type RestoreConditionType string

RestoreConditionType represents a valid condition of a Restore.

const (
	// RestoreScheduled means the restore job has been created to do tidb cluster restore
	RestoreScheduled RestoreConditionType = "Scheduled"
	// RestoreRunning means the Restore is currently being executed.
	RestoreRunning RestoreConditionType = "Running"
	// RestoreComplete means the Restore has successfully executed and the
	// backup data has been loaded into tidb cluster.
	RestoreComplete RestoreConditionType = "Complete"
	// RestoreFailed means the Restore has failed.
	RestoreFailed RestoreConditionType = "Failed"
	// RestoreRetryFailed means this failure can be retried
	RestoreRetryFailed RestoreConditionType = "RetryFailed"
	// RestoreInvalid means invalid restore CR.
	RestoreInvalid RestoreConditionType = "Invalid"
)

type RestoreList

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

	Items []Restore `json:"items"`
}

+k8s:openapi-gen=true RestoreList contains a list of Restore.

func (*RestoreList) DeepCopy

func (in *RestoreList) DeepCopy() *RestoreList

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

func (*RestoreList) DeepCopyInto

func (in *RestoreList) DeepCopyInto(out *RestoreList)

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

func (*RestoreList) DeepCopyObject

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

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

type RestoreMode

type RestoreMode string

RestoreMode represents the restore mode, such as snapshot or pitr. +k8s:openapi-gen=true

const (
	// RestoreModeSnapshot represents restore from a snapshot backup.
	RestoreModeSnapshot RestoreMode = "snapshot"
	// RestoreModePiTR represents PiTR restore which is from a snapshot backup and log backup.
	RestoreModePiTR RestoreMode = "pitr"
)

type RestoreSpec

type RestoreSpec 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"`
	// Type is the backup type for tidb cluster and only used when Mode = snapshot, such as full, db, table.
	Type BackupType `json:"backupType,omitempty"`
	// Mode is the restore mode. such as snapshot or pitr.
	// +kubebuilder:default=snapshot
	Mode RestoreMode `json:"restoreMode,omitempty"`
	// StorageProvider configures where and how backups should be stored.
	StorageProvider `json:",inline"`
	// BR is the configs for BR.
	BR *BRConfig `json:"br,omitempty"`

	// PitrRestoredTs is the pitr restored ts.
	PitrRestoredTs string `json:"pitrRestoredTs,omitempty"`
	// LogRestoreStartTs is the start timestamp which log restore from.
	// +optional
	LogRestoreStartTs string `json:"logRestoreStartTs,omitempty"`
	// PitrFullBackupStorageProvider configures where and how pitr dependent full backup should be stored.
	// +optional
	PitrFullBackupStorageProvider StorageProvider `json:"pitrFullBackupStorageProvider,omitempty"`

	// The storageClassName of the persistent volume for Restore data storage.
	// Defaults to Kubernetes default storage class.
	// +optional
	StorageClassName *string `json:"storageClassName,omitempty"`
	// StorageSize is the request storage size for backup job
	StorageSize string `json:"storageSize,omitempty"`

	// Base tolerations of restore Pods, components may add more tolerations upon this respectively
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
	// Affinity of restore Pods
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
	// Use KMS to decrypt the secrets
	UseKMS bool `json:"useKMS,omitempty"`
	// Specify service account of restore
	ServiceAccount string `json:"serviceAccount,omitempty"`
	// ToolImage specifies the tool image used in `Restore`, which supports BR and TiDB Lightning images.
	// For examples `spec.toolImage: pingcap/br:v4.0.8` or `spec.toolImage: pingcap/tidb-lightning:v4.0.8`
	// 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"`
	// TableFilter means Table filter expression for 'db.table' matching. BR supports this from v4.0.3.
	TableFilter []string `json:"tableFilter,omitempty"`

	// PodSecurityContext of the component
	// +optional
	PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`

	// PriorityClassName of Restore Job Pods
	PriorityClassName string `json:"priorityClassName,omitempty"`

	// Additional volumes of component pod.
	// +optional
	AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`
	// Additional volume mounts of component pod.
	// +optional
	AdditionalVolumeMounts []corev1.VolumeMount `json:"additionalVolumeMounts,omitempty"`
	// TolerateSingleTiKVOutage indicates whether to tolerate a single failure of a store without data loss
	// +kubebuilder:default=false
	TolerateSingleTiKVOutage bool `json:"tolerateSingleTiKVOutage,omitempty"`
}

+k8s:openapi-gen=true RestoreSpec contains the specification for a restore of a tidb cluster backup.

func (*RestoreSpec) DeepCopy

func (in *RestoreSpec) DeepCopy() *RestoreSpec

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

func (*RestoreSpec) DeepCopyInto

func (in *RestoreSpec) DeepCopyInto(out *RestoreSpec)

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

type RestoreStatus

type RestoreStatus struct {
	// 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 restore 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 RestoreConditionType `json:"phase,omitempty"`
	// +nullable
	Conditions []metav1.Condition `json:"conditions,omitempty"`
	// Progresses is the progress of restore.
	// +nullable
	Progresses []Progress `json:"progresses,omitempty"`
}

RestoreStatus represents the current status of a tidb cluster restore.

func (*RestoreStatus) DeepCopy

func (in *RestoreStatus) DeepCopy() *RestoreStatus

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

func (*RestoreStatus) DeepCopyInto

func (in *RestoreStatus) DeepCopyInto(out *RestoreStatus)

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

type S3StorageProvider

type S3StorageProvider struct {
	// Provider represents the specific storage provider that implements the S3 interface
	Provider S3StorageProviderType `json:"provider"`
	// Region in which the S3 compatible bucket is located.
	Region string `json:"region,omitempty"`
	// Path is the full path where the backup is saved.
	// The format of the path must be: "<bucket-name>/<path-to-backup-file>"
	Path string `json:"path,omitempty"`
	// Bucket in which to store the backup data.
	Bucket string `json:"bucket,omitempty"`
	// Endpoint of S3 compatible storage service
	Endpoint string `json:"endpoint,omitempty"`
	// StorageClass represents the storage class
	StorageClass string `json:"storageClass,omitempty"`
	// Acl represents access control permissions for this bucket
	Acl string `json:"acl,omitempty"`
	// SecretName is the name of secret which stores
	// S3 compliant storage access key and secret key.
	SecretName string `json:"secretName,omitempty"`
	// Prefix of the data path.
	Prefix string `json:"prefix,omitempty"`
	// SSE Sever-Side Encryption.
	SSE string `json:"sse,omitempty"`
	// Options Rclone options for backup and restore with dumpling and lightning.
	Options []string `json:"options,omitempty"`
}

S3StorageProvider represents a S3 compliant storage for storing backups. +k8s:openapi-gen=true

func (*S3StorageProvider) DeepCopy

func (in *S3StorageProvider) DeepCopy() *S3StorageProvider

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

func (*S3StorageProvider) DeepCopyInto

func (in *S3StorageProvider) DeepCopyInto(out *S3StorageProvider)

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

type S3StorageProviderType

type S3StorageProviderType string

+k8s:openapi-gen=true S3StorageProviderType represents the specific storage provider that implements the S3 interface

const (
	// S3StorageProviderTypeCeph represents the S3 compliant storage provider is ceph
	S3StorageProviderTypeCeph S3StorageProviderType = "ceph"
	// S3StorageProviderTypeAWS represents the S3 compliant storage provider is aws
	S3StorageProviderTypeAWS S3StorageProviderType = "aws"
)

type StorageProvider

type StorageProvider struct {
	S3     *S3StorageProvider     `json:"s3,omitempty"`
	Gcs    *GcsStorageProvider    `json:"gcs,omitempty"`
	Azblob *AzblobStorageProvider `json:"azblob,omitempty"`
	Local  *LocalStorageProvider  `json:"local,omitempty"`
}

StorageProvider defines the configuration for storing a backup in backend storage. +k8s:openapi-gen=true

func (*StorageProvider) DeepCopy

func (in *StorageProvider) DeepCopy() *StorageProvider

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

func (*StorageProvider) DeepCopyInto

func (in *StorageProvider) DeepCopyInto(out *StorageProvider)

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

type TiBR

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

	Spec   TiBRSpec   `json:"spec,omitempty"`
	Status TiBRStatus `json:"status,omitempty"`
}

TiBR is the Schema for the tibr API. 1. Allows user to define auto backup schedule. 2. Provides http server for user to query backup records, execute restore and query restore progress.

func (*TiBR) DeepCopy

func (in *TiBR) DeepCopy() *TiBR

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

func (*TiBR) DeepCopyInto

func (in *TiBR) DeepCopyInto(out *TiBR)

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

func (*TiBR) DeepCopyObject

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

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

type TiBRAutoSchedule

type TiBRAutoSchedule struct {
	// Type defines the schedule type, such as per-day, per-hour, per-minute
	// +kubebuilder:validation:Enum=per-day;per-hour;per-minute
	Type TiBRAutoScheduleType `json:"type"`
	// FIXME: it's hard to control the time in current auto backup runtime binary, this parameter is not actually works currently.
	// At defines the schedule time of backup
	At uint32 `json:"at"`
}

+kubebuilder:validation:XValidation:rule="(self.type== 'per-day' && self.at >= 0 && self.at <= 23)|| (self.type == 'per-hour' && self.at >= 0 && self.at <= 59) || (self.type == 'per-minute' && self.at == 0)" +kubebuilder:validation:Message="if type is per-day, at is the hour of day; if type is per-hour, at is the minute of hour; if type is per-minute, it should be 0"

func (*TiBRAutoSchedule) DeepCopy

func (in *TiBRAutoSchedule) DeepCopy() *TiBRAutoSchedule

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

func (*TiBRAutoSchedule) DeepCopyInto

func (in *TiBRAutoSchedule) DeepCopyInto(out *TiBRAutoSchedule)

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

type TiBRAutoScheduleType

type TiBRAutoScheduleType string
const (
	TiBRAutoScheduleTypePerDay    TiBRAutoScheduleType = "per-day"
	TiBRAutoScheduleTypePerHour   TiBRAutoScheduleType = "per-hour"
	TiBRAutoScheduleTypePerMinute TiBRAutoScheduleType = "per-minute"
)

type TiBRGC

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

	Spec   TiBRGCSpec   `json:"spec,omitempty"`
	Status TiBRGCStatus `json:"status,omitempty"`
}

TiBRGC is the Schema for the tibrgc API. It allows users to set backup gc strategy and configure resources fo gc workloads.

func (*TiBRGC) DeepCopy

func (in *TiBRGC) DeepCopy() *TiBRGC

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

func (*TiBRGC) DeepCopyInto

func (in *TiBRGC) DeepCopyInto(out *TiBRGC)

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

func (*TiBRGC) DeepCopyObject

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

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

type TiBRGCList

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

TiBRGCList contains a list of TiBRGC.

func (*TiBRGCList) DeepCopy

func (in *TiBRGCList) DeepCopy() *TiBRGCList

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

func (*TiBRGCList) DeepCopyInto

func (in *TiBRGCList) DeepCopyInto(out *TiBRGCList)

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

func (*TiBRGCList) DeepCopyObject

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

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

type TiBRGCOverlay

type TiBRGCOverlay struct {
	// +listType=map
	// +listMapKey=name
	// +kubebuilder:validation:MaxItems=2
	Pods []TiBRGCPodOverlay `json:"pods,omitempty"`
}

func (*TiBRGCOverlay) DeepCopy

func (in *TiBRGCOverlay) DeepCopy() *TiBRGCOverlay

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

func (*TiBRGCOverlay) DeepCopyInto

func (in *TiBRGCOverlay) DeepCopyInto(out *TiBRGCOverlay)

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

type TiBRGCPodOverlay

type TiBRGCPodOverlay struct {
	// +kubebuilder:validation:Enum=to-t2-storage;to-t3-storage
	Name    TieredStorageStrategyName `json:"name"`
	Overlay *v1alpha1.Overlay         `json:"overlay,omitempty"`
}

func (*TiBRGCPodOverlay) DeepCopy

func (in *TiBRGCPodOverlay) DeepCopy() *TiBRGCPodOverlay

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

func (*TiBRGCPodOverlay) DeepCopyInto

func (in *TiBRGCPodOverlay) DeepCopyInto(out *TiBRGCPodOverlay)

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

type TiBRGCSpec

type TiBRGCSpec struct {
	// Cluster is a reference of tidb cluster
	Cluster    v1alpha1.ClusterReference `json:"cluster"`
	GCStrategy TiBRGCStrategy            `json:"gcStrategy,omitempty"`
	// Image is image of br gc, default is pingcap/tikv
	Image   *string       `json:"image,omitempty"`
	Overlay TiBRGCOverlay `json:"overlay,omitempty"`
}

TiBRGCSpec defines the desired state of TiBRGC.

func (*TiBRGCSpec) DeepCopy

func (in *TiBRGCSpec) DeepCopy() *TiBRGCSpec

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

func (*TiBRGCSpec) DeepCopyInto

func (in *TiBRGCSpec) DeepCopyInto(out *TiBRGCSpec)

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

type TiBRGCStatus

type TiBRGCStatus struct {
	v1alpha1.CommonStatus `json:",inline"`
}

TiBRGCStatus defines the observed state of TiBRGC.

func (*TiBRGCStatus) DeepCopy

func (in *TiBRGCStatus) DeepCopy() *TiBRGCStatus

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

func (*TiBRGCStatus) DeepCopyInto

func (in *TiBRGCStatus) DeepCopyInto(out *TiBRGCStatus)

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

type TiBRGCStrategy

type TiBRGCStrategy struct {
	// +kubebuilder:validation:Enum=tiered-storage
	Type TiBRGCStrategyType `json:"type"`
	// +listType=map
	// +listMapKey=name
	// +kubebuilder:validation:MaxItems=2
	TieredStrategies []TieredStorageStrategy `json:"tieredStrategies,omitempty"`
}

func (*TiBRGCStrategy) DeepCopy

func (in *TiBRGCStrategy) DeepCopy() *TiBRGCStrategy

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

func (*TiBRGCStrategy) DeepCopyInto

func (in *TiBRGCStrategy) DeepCopyInto(out *TiBRGCStrategy)

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

type TiBRGCStrategyType

type TiBRGCStrategyType string
const (
	TiBRGCStrategyTypeTieredStorage TiBRGCStrategyType = "tiered-storage"
)

type TiBRList

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

TiBRList contains a list of TiBR.

func (*TiBRList) DeepCopy

func (in *TiBRList) DeepCopy() *TiBRList

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

func (*TiBRList) DeepCopyInto

func (in *TiBRList) DeepCopyInto(out *TiBRList)

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

func (*TiBRList) DeepCopyObject

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

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

type TiBRSpec

type TiBRSpec struct {
	// Cluster is a reference of tidb cluster
	Cluster v1alpha1.ClusterReference `json:"cluster"`
	// AutoSchedule define auto backup strategy for TiBR, it's optional
	AutoSchedule *TiBRAutoSchedule `json:"autoSchedule,omitempty"`
	// Image is image of br service, default is pingcap/tikv
	Image  *string             `json:"image,omitempty"`
	Config v1alpha1.ConfigFile `json:"config,omitempty"`
	// Resources defines resource required by TiBR.
	Resources v1alpha1.ResourceRequirements `json:"resources,omitempty"`
	// Volumes defines persistence data volume for TiBR, it is optional. please use it when need to restore a lot of data
	// In TiBR use case, there should be at most one Volume, name as VolumeTiBRData with at most one Mount.
	// Define this as array for future extension
	// +listType=map
	// +listMapKey=name
	// +kubebuilder:validation:MaxItems=1
	Volumes []v1alpha1.Volume `json:"volumes,omitempty"`
	// Overlay defines a k8s native resource template patch
	// Notice: there will be two containers in the pod, one for auto backup, one as api server,if you want to overlay them please use the right name
	Overlay *v1alpha1.Overlay `json:"overlay,omitempty"`
}

TiBRSpec defines the desired state of TiBR.

func (*TiBRSpec) DeepCopy

func (in *TiBRSpec) DeepCopy() *TiBRSpec

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

func (*TiBRSpec) DeepCopyInto

func (in *TiBRSpec) DeepCopyInto(out *TiBRSpec)

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

type TiBRStatus

type TiBRStatus struct {
	v1alpha1.CommonStatus `json:",inline"`
}

TiBRStatus defines the observed state of TiBR.

func (*TiBRStatus) DeepCopy

func (in *TiBRStatus) DeepCopy() *TiBRStatus

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

func (*TiBRStatus) DeepCopyInto

func (in *TiBRStatus) DeepCopyInto(out *TiBRStatus)

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

type TieredStorageStrategy

type TieredStorageStrategy struct {
	// +kubebuilder:validation:Enum=to-t2-storage;to-t3-storage
	Name TieredStorageStrategyName `json:"name"`
	// +kubebuilder:validation:Minimum=1
	TimeThresholdDays uint32 `json:"timeThresholdDays"`
}

func (*TieredStorageStrategy) DeepCopy

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

func (*TieredStorageStrategy) DeepCopyInto

func (in *TieredStorageStrategy) DeepCopyInto(out *TieredStorageStrategy)

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

type TieredStorageStrategyName

type TieredStorageStrategyName string
const (
	TieredStorageStrategyNameToT2Storage TieredStorageStrategyName = "to-t2-storage"
	TieredStorageStrategyNameToT3Storage TieredStorageStrategyName = "to-t3-storage"
)

Jump to

Keyboard shortcuts

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