You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ge...@apache.org on 2022/07/12 11:11:59 UTC
[solr-operator] branch main updated: Recompute NextScheduled backup on each reconcile (#455)
This is an automated email from the ASF dual-hosted git repository.
gerlowskija pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git
The following commit(s) were added to refs/heads/main by this push:
new 340495f Recompute NextScheduled backup on each reconcile (#455)
340495f is described below
commit 340495f5c1b651a5c1aed7e5948e0c5e0444907f
Author: Jason Gerlowski <ge...@apache.org>
AuthorDate: Tue Jul 12 07:11:53 2022 -0400
Recompute NextScheduled backup on each reconcile (#455)
Prior to this commit, the 'NextScheduled' field of a solrbackup's status
was never updated, even if the user the backup schedule in the
solrbackup spec.
This commit changes this: NextScheduled is now recomputed during each
reconciliation, as long as there is not an active backup ongoing.
---
controllers/solrbackup_controller.go | 13 ++++++++-----
helm/solr-operator/Chart.yaml | 7 +++++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/controllers/solrbackup_controller.go b/controllers/solrbackup_controller.go
index 12661cc..b73fd16 100644
--- a/controllers/solrbackup_controller.go
+++ b/controllers/solrbackup_controller.go
@@ -146,14 +146,17 @@ func (r *SolrBackupReconciler) Reconcile(ctx context.Context, req ctrl.Request)
}
// Schedule the next backupTime, if it doesn't have a next scheduled time, it has recurrence and the current backup is finished
- if backup.Status.NextScheduledTime == nil && backup.Spec.Recurrence.IsEnabled() && backup.Status.IndividualSolrBackupStatus.Finished {
+ if backup.Status.IndividualSolrBackupStatus.Finished {
if nextBackupTime, err1 := util.ScheduleNextBackup(backup.Spec.Recurrence.Schedule, backup.Status.IndividualSolrBackupStatus.StartTime.Time); err1 != nil {
- logger.Error(err1, "Could not schedule new backup due to bad cron schedule", "cron", backup.Spec.Recurrence.Schedule)
+ logger.Error(err1, "Could not update backup scheduling due to bad cron schedule", "cron", backup.Spec.Recurrence.Schedule)
} else {
- logger.Info("Scheduling Next Backup", "time", nextBackupTime)
convTime := metav1.NewTime(nextBackupTime)
- backup.Status.NextScheduledTime = &convTime
- updateRequeueAfter(&requeueOrNot, backup.Status.NextScheduledTime.Sub(time.Now()))
+ if backup.Status.NextScheduledTime == nil || convTime != *backup.Status.NextScheduledTime {
+ // Only log out the message if there is a change in NextScheduled
+ logger.Info("(Re)scheduling Next Backup", "time", nextBackupTime)
+ backup.Status.NextScheduledTime = &convTime
+ updateRequeueAfter(&requeueOrNot, backup.Status.NextScheduledTime.Sub(time.Now()))
+ }
}
}
diff --git a/helm/solr-operator/Chart.yaml b/helm/solr-operator/Chart.yaml
index 916fb32..de5e399 100644
--- a/helm/solr-operator/Chart.yaml
+++ b/helm/solr-operator/Chart.yaml
@@ -150,6 +150,13 @@ annotations:
url: https://github.com/apache/solr-operator/issues/448
- name: Github PR
url: https://github.com/apache/solr-operator/pull/451
+ - kind: changed
+ description: SolrBackup.Status' 'Next Scheduled' is now updated on changes to the backup schedule.
+ links:
+ - name: Github Issue
+ url: https://github.com/apache/solr-operator/issues/376
+ - name: Github PR
+ url: https://github.com/apache/solr-operator/pull/455
artifacthub.io/images: |
- name: solr-operator
image: apache/solr-operator:v0.6.0-prerelease