Skip to content

Commit 159844c

Browse files
committed
Update backups limit if cron is already added.
1 parent 35aea8d commit 159844c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/controller/clustercontroller/backups.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,24 @@ func (c *Controller) registerClusterInBackupCron(cluster *api.MysqlCluster) erro
7272
j, ok := entry.Job.(job)
7373
if ok && j.Name == cluster.Name && j.Namespace == cluster.Namespace {
7474
glog.V(3).Infof("Cluster %s already added to cron.", cluster.Name)
75+
76+
// change scheduler for already added crons
7577
if !reflect.DeepEqual(entry.Schedule, schedule) {
7678
glog.Infof("Update cluster '%s' scheduler to: %s",
7779
cluster.Name, cluster.Spec.BackupSchedule)
7880
c.cron.Remove(cluster.Name)
7981
break
8082
}
83+
84+
// update backups limit for already added crons
85+
if !reflect.DeepEqual(cluster.Spec.BackupScheduleJobsHistoryLimit, j.BackupScheduleJobsHistoryLimit) {
86+
glog.Infof("Update cluster '%s' backup limit to: %v",
87+
cluster.Name, cluster.Spec.BackupScheduleJobsHistoryLimit)
88+
c.cron.Remove(cluster.Name)
89+
break
90+
}
91+
92+
// nothing to change for this cluster, return
8193
return nil
8294
}
8395
}

0 commit comments

Comments
 (0)