From 9675748c7c5d566173c0cf2481440cc9a8a97f8e 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/backupstoragelocation_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/backupstoragelocation_controller.go b/pkg/controller/backupstoragelocation_controller.go index fef15545b..8075bf058 100644 --- a/pkg/controller/backupstoragelocation_controller.go +++ b/pkg/controller/backupstoragelocation_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 }