util

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	VolumeSnapshotLabel                             = "velero.io/volume-snapshot-name"
	VolumeSnapshotHandleAnnotation                  = "velero.io/csi-volumesnapshot-handle"
	VolumeSnapshotRestoreSize                       = "velero.io/vsi-volumesnapshot-restore-size"
	CSIDriverNameAnnotation                         = "velero.io/csi-driver-name"
	CSIDeleteSnapshotSecretName                     = "velero.io/csi-deletesnapshotsecret-name"
	CSIDeleteSnapshotSecretNamespace                = "velero.io/csi-deletesnapshotsecret-namespace"
	CSIVSCDeletionPolicy                            = "velero.io/csi-vsc-deletion-policy"
	VolumeSnapshotClassSelectorLabel                = "velero.io/csi-volumesnapshot-class"
	VolumeSnapshotClassDriverBackupAnnotationPrefix = "velero.io/csi-volumesnapshot-class"
	VolumeSnapshotClassDriverPVCAnnotation          = "velero.io/csi-volumesnapshot-class"

	// There is no release w/ these constants exported. Using the strings for now.
	// CSI Labels volumesnapshotclass
	// https://github.com/kubernetes-csi/external-snapshotter/blob/master/pkg/utils/util.go#L59-L60
	PrefixedSnapshotterListSecretNameKey      = "csi.storage.k8s.io/snapshotter-list-secret-name"
	PrefixedSnapshotterListSecretNamespaceKey = "csi.storage.k8s.io/snapshotter-list-secret-namespace"

	// CSI Labels volumesnapshotcontents
	PrefixedSnapshotterSecretNameKey      = "csi.storage.k8s.io/snapshotter-secret-name"
	PrefixedSnapshotterSecretNamespaceKey = "csi.storage.k8s.io/snapshotter-secret-namespace"

	// Velero checks this annotation to determine whether to skip resource excluding check.
	MustIncludeAdditionalItemAnnotation = "backup.velero.io/must-include-additional-items"
	// SkippedNoCSIPVAnnotation - Velero checks this annotation on processed PVC to
	// find out if the snapshot was skipped b/c the PV is not provisioned via CSI
	SkippedNoCSIPVAnnotation = "backup.velero.io/skipped-no-csi-pv"
	// ResourceTimeoutAnnotation is the annotation key used to carry the global resoure
	// timeout value for backup to plugins.
	ResourceTimeoutAnnotation = "velero.io/resource-timeout"

	// DynamicPVRestoreLabel is the label key for dynamic PV restore
	DynamicPVRestoreLabel = "velero.io/dynamic-pv-restore"

	// DataUploadNameAnnotation is the label key for the DataUpload name
	DataUploadNameAnnotation = "velero.io/data-upload-name"
)
View Source
const (
	VolumeSnapshotKindName = "VolumeSnapshot"
)

Variables

This section is empty.

Functions

func AddAnnotations

func AddAnnotations(o *metav1.ObjectMeta, vals map[string]string)

AddAnnotations adds the supplied key-values to the annotations on the object

func AddLabels

func AddLabels(o *metav1.ObjectMeta, vals map[string]string)

AddLabels adds the supplied key-values to the labels on the object

func CleanupVolumeSnapshot added in v0.6.0

func CleanupVolumeSnapshot(volSnap *snapshotv1api.VolumeSnapshot, snapshotClient snapshotter.SnapshotV1Interface, log logrus.FieldLogger)

func Contains

func Contains(slice []string, key string) bool

func DeleteVolumeSnapshot added in v0.6.0

deleteVolumeSnapshot is called by deleteVolumeSnapshots and handles the single VolumeSnapshot instance.

func DeleteVolumeSnapshotIfAny added in v0.6.0

func DeleteVolumeSnapshotIfAny(ctx context.Context, snapshotClient snapshotterClientSet.Interface,
	vs snapshotv1api.VolumeSnapshot, log logrus.FieldLogger)

func GetFullClients added in v0.6.0

func GetPodVolumeNameForPVC

func GetPodVolumeNameForPVC(pod corev1api.Pod, pvcName string) (string, error)

func GetPodsUsingPVC

func GetPodsUsingPVC(pvcNamespace, pvcName string, corev1 corev1client.PodsGetter) ([]corev1api.Pod, error)

func GetVolumeSnapshotClass added in v0.6.0

func GetVolumeSnapshotClass(provisioner string, backup *velerov1api.Backup, pvc *corev1api.PersistentVolumeClaim, log logrus.FieldLogger, snapshotClient snapshotter.SnapshotV1Interface) (*snapshotv1api.VolumeSnapshotClass, error)

func GetVolumeSnapshotClassForStorageClass

func GetVolumeSnapshotClassForStorageClass(provisioner string, snapshotClasses *snapshotv1api.VolumeSnapshotClassList) (*snapshotv1api.VolumeSnapshotClass, error)

GetVolumeSnapshotClassForStorageClass returns a VolumeSnapshotClass for the supplied volume provisioner/ driver name.

func GetVolumeSnapshotClassFromBackupAnnotationsForDriver added in v0.6.0

func GetVolumeSnapshotClassFromBackupAnnotationsForDriver(backup *velerov1api.Backup, provisioner string, snapshotClasses *snapshotv1api.VolumeSnapshotClassList) (*snapshotv1api.VolumeSnapshotClass, error)

GetVolumeSnapshotClassFromAnnotationsForDriver returns a VolumeSnapshotClass for the supplied volume provisioner/ driver name from the annotation of the backup

func GetVolumeSnapshotClassFromPVCAnnotationsForDriver added in v0.6.0

func GetVolumeSnapshotClassFromPVCAnnotationsForDriver(pvc *corev1api.PersistentVolumeClaim, provisioner string, snapshotClasses *snapshotv1api.VolumeSnapshotClassList) (*snapshotv1api.VolumeSnapshotClass, error)

func GetVolumeSnapshotContentForVolumeSnapshot

func GetVolumeSnapshotContentForVolumeSnapshot(volSnap *snapshotv1api.VolumeSnapshot, snapshotClient snapshotter.SnapshotV1Interface, log logrus.FieldLogger, shouldWait bool, csiSnapshotTimeout time.Duration) (*snapshotv1api.VolumeSnapshotContent, error)

GetVolumeSnapshotContentForVolumeSnapshot returns the volumesnapshotcontent object associated with the volumesnapshot

func HasBackupLabel added in v0.2.0

func HasBackupLabel(o *metav1.ObjectMeta, backupName string) bool

func IsPVCDefaultToFSBackup added in v0.4.0

func IsPVCDefaultToFSBackup(pvcNamespace, pvcName string, podClient corev1client.PodsGetter, defaultVolumesToFsBackup bool) (bool, error)

func IsVolumeSnapshotClassHasListerSecret

func IsVolumeSnapshotClassHasListerSecret(vc *snapshotv1api.VolumeSnapshotClass) bool

IsVolumeSnapshotClassHasListerSecret returns whether a volumesnapshotclass has a snapshotlister secret

func IsVolumeSnapshotContentHasDeleteSecret

func IsVolumeSnapshotContentHasDeleteSecret(vsc *snapshotv1api.VolumeSnapshotContent) bool

IsVolumeSnapshotContentHasDeleteSecret returns whether a volumesnapshotcontent has a deletesnapshot secret

func IsVolumeSnapshotExists added in v0.1.2

func IsVolumeSnapshotExists(ns, name string, snapshotClient snapshotter.SnapshotV1Interface) bool

IsVolumeSnapshotExists returns whether a specific volumesnapshot object exists.

func IsVolumeSnapshotHasVSCDeleteSecret

func IsVolumeSnapshotHasVSCDeleteSecret(vs *snapshotv1api.VolumeSnapshot) bool

IsVolumeSnapshotHasVSCDeleteSecret returns whether a volumesnapshot should set the deletesnapshot secret for the static volumesnapshotcontent that is created on restore

func SetVolumeSnapshotContentDeletionPolicy added in v0.2.0

func SetVolumeSnapshotContentDeletionPolicy(vscName string, csiClient snapshotter.SnapshotV1Interface) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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