support restoring/deleting legacy backups with .status.volumeBackups

Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
Steve Kriss
2018-10-23 09:55:40 -06:00
parent 6ef155ddff
commit 90d9be59d3
10 changed files with 589 additions and 166 deletions
+16 -1
View File
@@ -105,6 +105,21 @@ func (b *TestBackup) WithSnapshot(pv string, snapshot string) *TestBackup {
return b
}
func (b *TestBackup) WithVolumeBackupInfo(pv, snapshotID, volumeType, az string, iops *int64) *TestBackup {
if b.Status.VolumeBackups == nil {
b.Status.VolumeBackups = make(map[string]*v1.VolumeBackupInfo)
}
b.Status.VolumeBackups[pv] = &v1.VolumeBackupInfo{
SnapshotID: snapshotID,
Type: volumeType,
AvailabilityZone: az,
Iops: iops,
}
return b
}
func (b *TestBackup) WithSnapshotVolumes(value bool) *TestBackup {
b.Spec.SnapshotVolumes = &value
return b
@@ -141,7 +156,7 @@ func (b *TestBackup) WithStorageLocation(location string) *TestBackup {
return b
}
func (b *TestBackup) WithVolumeSnapshotLocations(locations []string) *TestBackup {
func (b *TestBackup) WithVolumeSnapshotLocations(locations ...string) *TestBackup {
b.Spec.VolumeSnapshotLocations = locations
return b
}
@@ -45,6 +45,11 @@ func (location *TestVolumeSnapshotLocation) WithName(name string) *TestVolumeSna
return location
}
func (location *TestVolumeSnapshotLocation) WithProvider(name string) *TestVolumeSnapshotLocation {
location.Spec.Provider = name
return location
}
func (location *TestVolumeSnapshotLocation) WithProviderConfig(info []LocationInfo) []*TestVolumeSnapshotLocation {
var locations []*TestVolumeSnapshotLocation