volume

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldValueIsUnknown string = "unknown"

	CSIDriverNameAnnotation        = "velero.io/csi-driver-name"
	VolumeSnapshotHandleAnnotation = "velero.io/csi-volumesnapshot-handle"
)

Variables

This section is empty.

Functions

func RestoredPVCFromRestoredResourceList added in v1.14.0

func RestoredPVCFromRestoredResourceList(restoredResourceList map[string][]string) map[string]struct{}

RestoredPVCFromRestoredResourceList returns a set of PVCs that were restored from the given restoredResourceList.

func UpdateVolumeSnapshotLocationWithCredentialConfig

func UpdateVolumeSnapshotLocationWithCredentialConfig(location *velerov1api.VolumeSnapshotLocation, credentialStore credentials.FileStore) error

UpdateVolumeSnapshotLocationWithCredentialConfig adds the credentials file path to the config if the VSL specifies a credential

Types

type BackupVolumeInfo added in v1.14.0

type BackupVolumeInfo struct {
	// The PVC's name.
	PVCName string `json:"pvcName,omitempty"`

	// The PVC's namespace
	PVCNamespace string `json:"pvcNamespace,omitempty"`

	// The PV name.
	PVName string `json:"pvName,omitempty"`

	// The way the volume data is backed up. The valid value includes `VeleroNativeSnapshot`, `PodVolumeBackup` and `CSISnapshot`.
	BackupMethod Method `json:"backupMethod,omitempty"`

	// Whether the volume's snapshot data is moved to specified storage.
	SnapshotDataMoved bool `json:"snapshotDataMoved"`

	// Whether the local snapshot is preserved after snapshot is moved.
	// The local snapshot may be a result of CSI snapshot backup(no data movement)
	// or a CSI snapshot data movement plus preserve local snapshot.
	PreserveLocalSnapshot bool `json:"preserveLocalSnapshot"`

	// Whether the Volume is skipped in this backup.
	Skipped bool `json:"skipped"`

	// The reason for the volume is skipped in the backup.
	SkippedReason string `json:"skippedReason,omitempty"`

	// Snapshot starts timestamp.
	StartTimestamp *metav1.Time `json:"startTimestamp,omitempty"`

	// Snapshot completes timestamp.
	CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`

	CSISnapshotInfo          *CSISnapshotInfo          `json:"csiSnapshotInfo,omitempty"`
	SnapshotDataMovementInfo *SnapshotDataMovementInfo `json:"snapshotDataMovementInfo,omitempty"`
	NativeSnapshotInfo       *NativeSnapshotInfo       `json:"nativeSnapshotInfo,omitempty"`
	PVBInfo                  *PodVolumeInfo            `json:"pvbInfo,omitempty"`
	PVInfo                   *PVInfo                   `json:"pvInfo,omitempty"`
}

type BackupVolumesInformation added in v1.14.0

type BackupVolumesInformation struct {
	SkippedPVs       map[string]string
	NativeSnapshots  []*Snapshot
	PodVolumeBackups []*velerov1api.PodVolumeBackup
	BackupOperations []*itemoperation.BackupOperation
	BackupName       string
	// contains filtered or unexported fields
}

BackupVolumesInformation contains the information needs by generating the backup BackupVolumeInfo array.

func (*BackupVolumesInformation) Init added in v1.14.0

func (v *BackupVolumesInformation) Init()

func (*BackupVolumesInformation) InsertPVMap added in v1.14.0

func (v *BackupVolumesInformation) InsertPVMap(pv corev1api.PersistentVolume, pvcName, pvcNamespace string)

func (*BackupVolumesInformation) Result added in v1.14.0

func (v *BackupVolumesInformation) Result(
	csiVolumeSnapshots []snapshotv1api.VolumeSnapshot,
	csiVolumeSnapshotContents []snapshotv1api.VolumeSnapshotContent,
	csiVolumesnapshotClasses []snapshotv1api.VolumeSnapshotClass,
	crClient kbclient.Client,
	logger logrus.FieldLogger,
) []*BackupVolumeInfo

type CSISnapshotInfo

type CSISnapshotInfo struct {
	// It's the storage provider's snapshot ID for CSI.
	SnapshotHandle string `json:"snapshotHandle"`

	// The snapshot corresponding volume size.
	Size int64 `json:"size"`

	// The name of the CSI driver.
	Driver string `json:"driver"`

	// The name of the VolumeSnapshotContent.
	VSCName string `json:"vscName"`

	// The Async Operation's ID.
	OperationID string `json:"operationID,omitempty"`
}

CSISnapshotInfo is used for displaying the CSI snapshot status

type Method added in v1.14.0

type Method string
const (
	NativeSnapshot   Method = "NativeSnapshot"
	PodVolumeBackup  Method = "PodVolumeBackup"
	CSISnapshot      Method = "CSISnapshot"
	PodVolumeRestore Method = "PodVolumeRestore"
)

type NativeSnapshotInfo

type NativeSnapshotInfo struct {
	// It's the storage provider's snapshot ID for the Velero-native snapshot.
	SnapshotHandle string `json:"snapshotHandle"`

	// The cloud provider snapshot volume type.
	VolumeType string `json:"volumeType"`

	// The cloud provider snapshot volume's availability zones.
	VolumeAZ string `json:"volumeAZ"`

	// The cloud provider snapshot volume's IOPS.
	IOPS string `json:"iops"`
}

NativeSnapshotInfo is used for displaying the Velero native snapshot status. A Velero Native Snapshot is a cloud storage snapshot taken by the Velero native plugins, e.g. velero-plugin-for-aws, velero-plugin-for-gcp, and velero-plugin-for-microsoft-azure.

type PVInfo

type PVInfo struct {
	// ReclaimPolicy of PV. It could be different from the referenced StorageClass.
	ReclaimPolicy string `json:"reclaimPolicy"`

	// The PV's labels should be kept after recreation.
	Labels map[string]string `json:"labels"`
}

PVInfo is used to store some PV information modified after creation. Those information are lost after PV recreation.

type PodVolumeInfo added in v1.14.0

type PodVolumeInfo struct {
	// It's the file-system uploader's snapshot ID for PodVolumeBackup/PodVolumeRestore.
	SnapshotHandle string `json:"snapshotHandle,omitempty"`

	// The snapshot corresponding volume size.
	Size int64 `json:"size,omitempty"`

	// The type of the uploader that uploads the data. The valid values are `kopia` and `restic`.
	UploaderType string `json:"uploaderType"`

	// The PVC's corresponding volume name used by Pod
	// https://github.com/kubernetes/kubernetes/blob/e4b74dd12fa8cb63c174091d5536a10b8ec19d34/pkg/apis/core/types.go#L48
	VolumeName string `json:"volumeName"`

	// The Pod name mounting this PVC.
	PodName string `json:"podName"`

	// The Pod namespace
	PodNamespace string `json:"podNamespace"`

	// The PVB-taken k8s node's name.
	// This field will be empty when the struct is used to represent a podvolumerestore.
	NodeName string `json:"nodeName,omitempty"`
}

PodVolumeInfo is used for displaying the PodVolumeBackup/PodVolumeRestore snapshot status.

type RestoreVolumeInfo added in v1.14.0

type RestoreVolumeInfo struct {
	// The name of the restored PVC
	PVCName string `json:"pvcName,omitempty"`

	// The namespace of the restored PVC
	PVCNamespace string `json:"pvcNamespace,omitempty"`

	// The name of the restored PV, it is possible that in one item there is only PVC or PV info.
	// But if both PVC and PV exist in one item of volume info, they should matched, and if the PV is bound to a PVC,
	// they should coexist in one item.
	PVName string `json:"pvName,omitempty"`

	// The way the volume data is restored.
	RestoreMethod Method `json:"restoreMethod,omitempty"`

	// Whether the volume's data are restored via data movement
	SnapshotDataMoved bool `json:"snapshotDataMoved"`

	CSISnapshotInfo          *CSISnapshotInfo          `json:"csiSnapshotInfo,omitempty"`
	SnapshotDataMovementInfo *SnapshotDataMovementInfo `json:"snapshotDataMovementInfo,omitempty"`
	NativeSnapshotInfo       *NativeSnapshotInfo       `json:"nativeSnapshotInfo,omitempty"`
	PVRInfo                  *PodVolumeInfo            `json:"pvrInfo,omitempty"`
}

type RestoreVolumeInfoTracker added in v1.14.0

type RestoreVolumeInfoTracker struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

RestoreVolumeInfoTracker is used to track the volume information during restore. It is used to generate the RestoreVolumeInfo array.

func NewRestoreVolInfoTracker added in v1.14.0

func NewRestoreVolInfoTracker(restore *velerov1api.Restore, logger logrus.FieldLogger, client kbclient.Client) *RestoreVolumeInfoTracker

func (*RestoreVolumeInfoTracker) Populate added in v1.14.0

func (t *RestoreVolumeInfoTracker) Populate(ctx context.Context, restoredResourceList map[string][]string)

Populate data objects in the tracker, which will be used to generate the RestoreVolumeInfo array in Result() The input param resourceList should be the final result of the restore.

func (*RestoreVolumeInfoTracker) RenamePVForNativeSnapshot added in v1.14.0

func (t *RestoreVolumeInfoTracker) RenamePVForNativeSnapshot(oldName, newName string)

func (*RestoreVolumeInfoTracker) Result added in v1.14.0

Result generates the RestoreVolumeInfo array, the data should come from the Tracker itself and it should not connect tokkkk API server again.

func (*RestoreVolumeInfoTracker) TrackNativeSnapshot added in v1.14.0

func (t *RestoreVolumeInfoTracker) TrackNativeSnapshot(pvName string, snapshotHandle, volumeType, volumeAZ string, iops int64)

func (*RestoreVolumeInfoTracker) TrackPodVolume added in v1.14.0

func (t *RestoreVolumeInfoTracker) TrackPodVolume(pvr *velerov1api.PodVolumeRestore)

type Snapshot added in v1.14.0

type Snapshot struct {
	Spec SnapshotSpec `json:"spec"`

	Status SnapshotStatus `json:"status"`
}

Snapshot stores information about a persistent volume snapshot taken as part of a Velero backup.

type SnapshotDataMovementInfo

type SnapshotDataMovementInfo struct {
	// The data mover used by the backup. The valid values are `velero` and “(equals to `velero`).
	DataMover string `json:"dataMover"`

	// The type of the uploader that uploads the snapshot data. The valid values are `kopia` and `restic`.
	UploaderType string `json:"uploaderType"`

	// The name or ID of the snapshot associated object(SAO).
	// SAO is used to support local snapshots for the snapshot data mover,
	// e.g. it could be a VolumeSnapshot for CSI snapshot data movement.
	RetainedSnapshot string `json:"retainedSnapshot,omitempty"`

	// It's the filesystem repository's snapshot ID.
	SnapshotHandle string `json:"snapshotHandle"`

	// The Async Operation's ID.
	OperationID string `json:"operationID"`

	// Moved snapshot data size.
	Size int64 `json:"size"`
}

SnapshotDataMovementInfo is used for displaying the snapshot data mover status.

type SnapshotPhase added in v1.14.0

type SnapshotPhase string

SnapshotPhase is the lifecycle phase of a Velero volume snapshot.

const (
	// SnapshotPhaseNew means the volume snapshot has been created but not
	// yet processed by the VolumeSnapshotController.
	SnapshotPhaseNew SnapshotPhase = "New"

	// SnapshotPhaseCompleted means the volume snapshot was successfully created and can be restored from..
	SnapshotPhaseCompleted SnapshotPhase = "Completed"

	// SnapshotPhaseFailed means the volume snapshot was unable to execute.
	SnapshotPhaseFailed SnapshotPhase = "Failed"
)

type SnapshotSpec added in v1.14.0

type SnapshotSpec struct {
	// BackupName is the name of the Velero backup this snapshot
	// is associated with.
	BackupName string `json:"backupName"`

	// BackupUID is the UID of the Velero backup this snapshot
	// is associated with.
	BackupUID string `json:"backupUID"`

	// Location is the name of the VolumeSnapshotLocation where this snapshot is stored.
	Location string `json:"location"`

	// PersistentVolumeName is the Kubernetes name for the volume.
	PersistentVolumeName string `json:"persistentVolumeName"`

	// ProviderVolumeID is the provider's ID for the volume.
	ProviderVolumeID string `json:"providerVolumeID"`

	// VolumeType is the type of the disk/volume in the cloud provider
	// API.
	VolumeType string `json:"volumeType"`

	// VolumeAZ is the where the volume is provisioned
	// in the cloud provider.
	VolumeAZ string `json:"volumeAZ,omitempty"`

	// VolumeIOPS is the optional value of provisioned IOPS for the
	// disk/volume in the cloud provider API.
	VolumeIOPS *int64 `json:"volumeIOPS,omitempty"`
}

type SnapshotStatus added in v1.14.0

type SnapshotStatus struct {
	// ProviderSnapshotID is the ID of the snapshot taken in the cloud
	// provider API of this volume.
	ProviderSnapshotID string `json:"providerSnapshotID,omitempty"`

	// Phase is the current state of the VolumeSnapshot.
	Phase SnapshotPhase `json:"phase,omitempty"`
}

Jump to

Keyboard shortcuts

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