From e681759178830630728f751cc69c4d31996c439e Mon Sep 17 00:00:00 2001 From: Ashish Amarnath Date: Wed, 19 Feb 2020 11:37:40 -0800 Subject: [PATCH] export restic pod annotation (#2283) Signed-off-by: Ashish Amarnath --- pkg/restic/common.go | 8 +++++--- pkg/restic/common_test.go | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/restic/common.go b/pkg/restic/common.go index 1a78707f1..3e4112d83 100644 --- a/pkg/restic/common.go +++ b/pkg/restic/common.go @@ -49,12 +49,14 @@ const ( // pod volume backups when they're for a PVC. PVCNameAnnotation = "velero.io/pvc-name" + // VolumesToBackupAnnotation is the annotation on a pod whose mounted volumes + // need to be backed up using restic. + VolumesToBackupAnnotation = "backup.velero.io/backup-volumes" + // Deprecated. // // TODO(2.0): remove podAnnotationPrefix = "snapshot.velero.io/" - - volumesToBackupAnnotation = "backup.velero.io/backup-volumes" ) // getPodSnapshotAnnotations returns a map, of volume name -> snapshot id, @@ -115,7 +117,7 @@ func GetVolumesToBackup(obj metav1.Object) []string { return nil } - backupsValue := annotations[volumesToBackupAnnotation] + backupsValue := annotations[VolumesToBackupAnnotation] if backupsValue == "" { return nil } diff --git a/pkg/restic/common_test.go b/pkg/restic/common_test.go index 33500ad92..9b551a4b2 100644 --- a/pkg/restic/common_test.go +++ b/pkg/restic/common_test.go @@ -145,12 +145,12 @@ func TestGetVolumesToBackup(t *testing.T) { }, { name: "one volume to backup", - annotations: map[string]string{"foo": "bar", volumesToBackupAnnotation: "volume-1"}, + annotations: map[string]string{"foo": "bar", VolumesToBackupAnnotation: "volume-1"}, expected: []string{"volume-1"}, }, { name: "multiple volumes to backup", - annotations: map[string]string{"foo": "bar", volumesToBackupAnnotation: "volume-1,volume-2,volume-3"}, + annotations: map[string]string{"foo": "bar", VolumesToBackupAnnotation: "volume-1,volume-2,volume-3"}, expected: []string{"volume-1", "volume-2", "volume-3"}, }, }