snapshotter

package
v1.6.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CloudAPIConcurrency = 8
	PVCTagKey           = "CSIVolumeName"
	PodTagKey           = "kubernetes.io/created-for/pvc/name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSSnapshotter

type AWSSnapshotter struct {
	BaseSnapshotter
}

AWSSnapshotter is the snapshotter for creating snapshots from volumes (during a backup) and volumes from snapshots (during a restore) on AWS EBS.

func (*AWSSnapshotter) AddVolumeTags added in v1.5.0

func (s *AWSSnapshotter) AddVolumeTags(pvs []*corev1.PersistentVolume) error

func (*AWSSnapshotter) GenerateBackupMetadata

func (s *AWSSnapshotter) GenerateBackupMetadata(b *v1alpha1.Backup, tc *v1alpha1.TidbCluster) (*CloudSnapBackup, string, error)

func (*AWSSnapshotter) GetVolumeID

func (s *AWSSnapshotter) GetVolumeID(pv *corev1.PersistentVolume) (string, error)

func (*AWSSnapshotter) Init

func (s *AWSSnapshotter) Init(deps *controller.Dependencies, conf map[string]string) error

func (*AWSSnapshotter) PrepareRestoreMetadata

func (s *AWSSnapshotter) PrepareRestoreMetadata(r *v1alpha1.Restore, csb *CloudSnapBackup) (string, error)

func (*AWSSnapshotter) ResetPvAvailableZone added in v1.5.0

func (s *AWSSnapshotter) ResetPvAvailableZone(r *v1alpha1.Restore, pv *corev1.PersistentVolume)

func (*AWSSnapshotter) SetVolumeID

func (s *AWSSnapshotter) SetVolumeID(pv *corev1.PersistentVolume, volumeID string) error

type BaseSnapshotter

type BaseSnapshotter struct {
	// contains filtered or unexported fields
}

func (*BaseSnapshotter) Init

func (s *BaseSnapshotter) Init(deps *controller.Dependencies, conf map[string]string) error

func (*BaseSnapshotter) PrepareCSBK8SMeta

func (s *BaseSnapshotter) PrepareCSBK8SMeta(csb *CloudSnapBackup, tc *v1alpha1.TidbCluster) ([]*corev1.Pod, string, error)

type CloudSnapBackup

type CloudSnapBackup struct {
	TiKV       *TiKVBackup            `json:"tikv"`
	PD         Component              `json:"pd"`
	TiDB       Component              `json:"tidb"`
	Kubernetes *KubernetesBackup      `json:"kubernetes"`
	Options    map[string]interface{} `json:"options"`
}

func NewCloudSnapshotBackup

func NewCloudSnapshotBackup(tc *v1alpha1.TidbCluster) (csb *CloudSnapBackup)

type Component

type Component struct {
	Replicas int32 `json:"replicas"`
}

type GCPSnapshotter

type GCPSnapshotter struct {
	BaseSnapshotter
}

The GCPSnapshotter for creating snapshots from volumes (during a backup) and volumes from snapshots (during a restore) on Google Compute Engine Disks.

func (*GCPSnapshotter) AddVolumeTags added in v1.5.0

func (s *GCPSnapshotter) AddVolumeTags(pvs []*corev1.PersistentVolume) error

func (*GCPSnapshotter) GenerateBackupMetadata

func (s *GCPSnapshotter) GenerateBackupMetadata(b *v1alpha1.Backup, tc *v1alpha1.TidbCluster) (*CloudSnapBackup, string, error)

func (*GCPSnapshotter) GetVolumeID

func (s *GCPSnapshotter) GetVolumeID(pv *corev1.PersistentVolume) (string, error)

func (*GCPSnapshotter) Init

func (s *GCPSnapshotter) Init(deps *controller.Dependencies, conf map[string]string) error

func (*GCPSnapshotter) PrepareRestoreMetadata

func (s *GCPSnapshotter) PrepareRestoreMetadata(r *v1alpha1.Restore, csb *CloudSnapBackup) (string, error)

func (*GCPSnapshotter) ResetPvAvailableZone added in v1.5.0

func (s *GCPSnapshotter) ResetPvAvailableZone(r *v1alpha1.Restore, pv *corev1.PersistentVolume)

func (*GCPSnapshotter) SetVolumeID

func (s *GCPSnapshotter) SetVolumeID(pv *corev1.PersistentVolume, volumeID string) error

type KubernetesBackup

type KubernetesBackup struct {
	PVCs         []*corev1.PersistentVolumeClaim `json:"pvcs"`
	PVs          []*corev1.PersistentVolume      `json:"pvs"`
	TiDBCluster  *v1alpha1.TidbCluster           `json:"crd_tidb_cluster"`
	Unstructured *unstructured.Unstructured      `json:"options"`
}

type NoneSnapshotter

type NoneSnapshotter struct {
}

func (*NoneSnapshotter) AddVolumeTags added in v1.5.0

func (s *NoneSnapshotter) AddVolumeTags(pvs []*corev1.PersistentVolume) error

func (*NoneSnapshotter) GenerateBackupMetadata

func (s *NoneSnapshotter) GenerateBackupMetadata(b *v1alpha1.Backup, tc *v1alpha1.TidbCluster) (*CloudSnapBackup, string, error)

func (*NoneSnapshotter) GetVolumeID

func (s *NoneSnapshotter) GetVolumeID(pv *corev1.PersistentVolume) (string, error)

func (*NoneSnapshotter) Init

func (s *NoneSnapshotter) Init(deps *controller.Dependencies, conf map[string]string) error

func (*NoneSnapshotter) PrepareRestoreMetadata

func (s *NoneSnapshotter) PrepareRestoreMetadata(r *v1alpha1.Restore, csb *CloudSnapBackup) (string, error)

func (*NoneSnapshotter) ResetPvAvailableZone added in v1.5.0

func (s *NoneSnapshotter) ResetPvAvailableZone(r *v1alpha1.Restore, pv *corev1.PersistentVolume)

func (*NoneSnapshotter) SetVolumeID

func (s *NoneSnapshotter) SetVolumeID(pv *corev1.PersistentVolume, volumeID string) error

type Snapshotter

type Snapshotter interface {
	// Init prepares the Snapshotter for usage, it would add
	// specific parameters as config map[string]string in the future.
	Init(deps *controller.Dependencies, conf map[string]string) error

	// GetVolumeID returns the cloud provider specific identifier
	// for the PersistentVolume-PV.
	GetVolumeID(pv *corev1.PersistentVolume) (string, error)

	// GenerateBackupMetadata performs the preparations for creating
	// a snapshot from the used volume for PV/PVC.
	GenerateBackupMetadata(b *v1alpha1.Backup, tc *v1alpha1.TidbCluster) (*CloudSnapBackup, string, error)

	// PrepareRestoreMetadata performs the preparations for creating
	// a volume from the snapshot that has been backed up.
	PrepareRestoreMetadata(r *v1alpha1.Restore, csb *CloudSnapBackup) (string, error)

	// SetVolumeID sets the cloud provider specific identifier
	// for the PersistentVolume-PV.
	SetVolumeID(pv *corev1.PersistentVolume, volumeID string) error

	// ResetPvAvailableZone resets az of pv if the volumes restore to another az
	ResetPvAvailableZone(r *v1alpha1.Restore, pv *corev1.PersistentVolume)

	// AddVolumeTags add operator related tags to volumes
	AddVolumeTags(pvs []*corev1.PersistentVolume) error
}

type StoresBackup

type StoresBackup struct {
	StoreID uint64          `json:"store_id"`
	Volumes []*VolumeBackup `json:"volumes"`
}

type StoresMixture

type StoresMixture struct {
	// contains filtered or unexported fields
}

func NewRestoreStoresMixture

func NewRestoreStoresMixture(s Snapshotter) *StoresMixture

func (*StoresMixture) PrepareCSBStoresMeta

func (m *StoresMixture) PrepareCSBStoresMeta(csb *CloudSnapBackup, pods []*corev1.Pod) (string, error)

func (*StoresMixture) ProcessCSBPVCsAndPVs

func (m *StoresMixture) ProcessCSBPVCsAndPVs(r *v1alpha1.Restore, csb *CloudSnapBackup) (string, error)

func (*StoresMixture) SetPod

func (m *StoresMixture) SetPod(pod *corev1.Pod)

type TiKVBackup

type TiKVBackup struct {
	Component
	Stores []*StoresBackup `json:"stores"`
}

type VolumeBackup

type VolumeBackup struct {
	VolumeID        string `json:"volume_id"`
	Type            string `json:"type"`
	MountPath       string `json:"mount_path"`
	SnapshotID      string `json:"snapshot_id"`
	RestoreVolumeID string `json:"restore_volume_id"`
}

Jump to

Keyboard shortcuts

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