Merge pull request #1022 from shubheksha/fix/945-restore-controller-remove-checking-backup-storage-directly

Remove code that checks backup storage directly from restore controller
This commit is contained in:
Steve Kriss
2018-11-06 15:53:13 -08:00
committed by GitHub
3 changed files with 24 additions and 54 deletions

View File

@@ -121,6 +121,27 @@ func shouldSync(location *arkv1api.BackupStorageLocation, now time.Time, backupS
return false, ""
}
// orderedBackupLocations returns a new slice with the default backup location first (if it exists),
// followed by the rest of the locations in no particular order.
func orderedBackupLocations(locations []*arkv1api.BackupStorageLocation, defaultLocationName string) []*arkv1api.BackupStorageLocation {
var result []*arkv1api.BackupStorageLocation
for i := range locations {
if locations[i].Name == defaultLocationName {
// put the default location first
result = append(result, locations[i])
// append everything before the default
result = append(result, locations[:i]...)
// append everything after the default
result = append(result, locations[i+1:]...)
return result
}
}
return locations
}
func (c *backupSyncController) run() {
c.logger.Debug("Checking for existing backup storage locations to sync into cluster")