Skip to content

Commit

Permalink
Implement retain function in MB reconciler
Browse files Browse the repository at this point in the history
It should be also implemented in MB reconciler as well as expiration.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
  • Loading branch information
toshipp committed Sep 18, 2024
1 parent 2fa4a3b commit 5f82010
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/controller/mantlebackup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const (
labelLocalBackupTargetPVCUID = "mantle.cybozu.io/local-backup-target-pvc-uid"
labelRemoteBackupTargetPVCUID = "mantle.cybozu.io/remote-backup-target-pvc-uid"
annotRemoteUID = "mantle.cybozu.io/remote-uid"
annotRetainIfExpired = "mantle.cybozu.io/retain-if-expired"
)

// MantleBackupReconciler reconciles a MantleBackup object
Expand Down Expand Up @@ -267,6 +268,12 @@ func (r *MantleBackupReconciler) expire(ctx context.Context, backup *mantlev1.Ma
return nil
}

if v, ok := backup.Annotations[annotRetainIfExpired]; ok && v == "true" {
// retain this backup.
// If the annotation is deleted, reconciliation will run, so no need to schedule.
return nil
}

expire, err := strfmt.ParseDuration(backup.Spec.Expire)
if err != nil {
return err
Expand Down

0 comments on commit 5f82010

Please sign in to comment.