use backup's defaultRestic flag to identify pod volumes using restic

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
This commit is contained in:
Ashish Amarnath
2020-06-03 17:15:59 -07:00
parent f34aab251e
commit 8a2a852b87
6 changed files with 255 additions and 1 deletions

View File

@@ -71,6 +71,7 @@ type backupController struct {
backupTracker BackupTracker
backupLocationLister velerov1listers.BackupStorageLocationLister
defaultBackupLocation string
defaultRestic bool
defaultBackupTTL time.Duration
snapshotLocationLister velerov1listers.VolumeSnapshotLocationLister
defaultSnapshotLocations map[string]string
@@ -92,6 +93,7 @@ func NewBackupController(
backupTracker BackupTracker,
backupLocationLister velerov1listers.BackupStorageLocationLister,
defaultBackupLocation string,
defaultRestic bool,
defaultBackupTTL time.Duration,
volumeSnapshotLocationLister velerov1listers.VolumeSnapshotLocationLister,
defaultSnapshotLocations map[string]string,
@@ -120,6 +122,7 @@ func NewBackupController(
volumeSnapshotLister: volumeSnapshotLister,
volumeSnapshotContentLister: volumeSnapshotContentLister,
newBackupStore: persistence.NewObjectBackupStore,
defaultRestic: defaultRestic,
}
c.syncHandler = c.processBackup
@@ -339,6 +342,10 @@ func (c *backupController) prepareBackupRequest(backup *velerov1api.Backup) *pkg
request.Spec.StorageLocation = c.defaultBackupLocation
}
if request.Spec.DefaultRestic == nil {
request.Spec.DefaultRestic = &c.defaultRestic
}
// add the storage location as a label for easy filtering later.
if request.Labels == nil {
request.Labels = make(map[string]string)