From 35d25c81ecf6280084c8b449f4fad3a87fdada34 Mon Sep 17 00:00:00 2001 From: Antony S Bett Date: Tue, 13 Oct 2020 15:10:32 -0400 Subject: [PATCH] Fix BSL controller to avoid invoking init() on all BSLs regardless of ValidationFrequency (#2992) Signed-off-by: Bett, Antony --- changelogs/unreleased/2992-betta1 | 1 + pkg/controller/backup_storage_location_controller.go | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/2992-betta1 diff --git a/changelogs/unreleased/2992-betta1 b/changelogs/unreleased/2992-betta1 new file mode 100644 index 000000000..e0e34fca1 --- /dev/null +++ b/changelogs/unreleased/2992-betta1 @@ -0,0 +1 @@ +Fix BSL controller to avoid invoking init() on all BSLs regardless of ValidationFrequency diff --git a/pkg/controller/backup_storage_location_controller.go b/pkg/controller/backup_storage_location_controller.go index 0cdbb4dd4..d5d9e067e 100644 --- a/pkg/controller/backup_storage_location_controller.go +++ b/pkg/controller/backup_storage_location_controller.go @@ -77,14 +77,14 @@ func (r *BackupStorageLocationReconciler) Reconcile(req ctrl.Request) (ctrl.Resu defaultFound = true } - backupStore, err := r.NewBackupStore(location, pluginManager, log) - if err != nil { - log.WithError(err).Error("Error getting a backup store") + if !storage.IsReadyToValidate(location.Spec.ValidationFrequency, location.Status.LastValidationTime, r.DefaultBackupLocationInfo, log) { + log.Debug("Backup location not ready to be validated") continue } - if !storage.IsReadyToValidate(location.Spec.ValidationFrequency, location.Status.LastValidationTime, r.DefaultBackupLocationInfo, log) { - log.Debug("Backup location not ready to be validated") + backupStore, err := r.NewBackupStore(location, pluginManager, log) + if err != nil { + log.WithError(err).Error("Error getting a backup store") continue }