Skip to content

Commit

Permalink
Only when backup is going, rollingup updating should pause #790
Browse files Browse the repository at this point in the history
  • Loading branch information
acekingke committed May 30, 2023
1 parent a200843 commit 174b801
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion controllers/backup/backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/tools/record"
Expand Down Expand Up @@ -205,7 +206,12 @@ func (r *BackupReconciler) reconcileManualBackup(ctx context.Context,
backup *v1beta1.Backup, manualBackupJobs []*batchv1.Job, cluster *v1beta1.MysqlCluster) error {
manualStatus := backup.Status.ManualBackup
var currentBackupJob *batchv1.Job

if len(backup.ObjectMeta.Labels["cluster"]) == 0 {
backup.ObjectMeta.Labels = labels.Set{"cluster": backup.Spec.ClusterName}
if err := r.Update(ctx, backup); err != nil {
return err
}
}
if backup.Spec.BackupSchedule != nil {
// if the backup is a scheduled backup, ignore manual backups
return nil
Expand Down

0 comments on commit 174b801

Please sign in to comment.