export restic pod annotation (#2283)

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
This commit is contained in:
Ashish Amarnath
2020-02-19 12:37:40 -07:00
committed by GitHub
parent b4446bd358
commit e681759178
2 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -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
}
+2 -2
View File
@@ -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"},
},
}