Skip to content

Commit

Permalink
*: Only GC complete or failed vbk
Browse files Browse the repository at this point in the history
Signed-off-by: BornChanger <[email protected]>
  • Loading branch information
BornChanger committed Jun 20, 2023
1 parent 8b7c46c commit 7244a4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ func GetFedVolumeBackupScheduleOwnerRef(vbks *fedv1alpha1.VolumeBackupSchedule)
controller := true
blockOwnerDeletion := true
return metav1.OwnerReference{
APIVersion: backupScheduleControllerKind.GroupVersion().String(),
Kind: backupScheduleControllerKind.Kind,
APIVersion: FedVolumeBackupScheduleControllerKind.GroupVersion().String(),
Kind: FedVolumeBackupScheduleControllerKind.Kind,
Name: vbks.GetName(),
UID: vbks.GetUID(),
Controller: &controller,
Expand Down
6 changes: 3 additions & 3 deletions pkg/fedvolumebackup/backupschedule/backup_schedule_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (bm *backupScheduleManager) backupGCByMaxReservedTime(vbs *v1alpha1.VolumeB

expiredBackups, err = calculateExpiredBackups(ascBackups, reservedTime)
if err != nil {
klog.Errorf("caculate expired backups without log backup, err: %s", err)
klog.Errorf("calculate expired backups without log backup, err: %s", err)
return
}

Expand All @@ -278,8 +278,8 @@ func sortSnapshotBackups(backupsList []*v1alpha1.VolumeBackup) []*v1alpha1.Volum
var ascBackupList = make([]*v1alpha1.VolumeBackup, 0)

for _, backup := range backupsList {
// the backup status CommitTs will be empty after created. without this, all newly created backups will be GC'ed
if v1alpha1.IsVolumeBackupRunning(backup) {
// Only try to GC Completed or Failed VolumeBackup
if !(v1alpha1.IsVolumeBackupFailed(backup) || v1alpha1.IsVolumeBackupComplete(backup)) {
continue
}
ascBackupList = append(ascBackupList, backup)
Expand Down

0 comments on commit 7244a4f

Please sign in to comment.