Skip to content

Commit

Permalink
fix(backup): skip StopBackup task when deleting backuppolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Nov 8, 2023
1 parent 0a1d30f commit 54fdf4b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions pkg/resource/obtenantbackuppolicy_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,19 @@ func (m *ObTenantBackupPolicyManager) CheckAndUpdateFinalizers() error {
}

if !finalizerFinished {
tenant, err := m.getOBTenantCR()
if err != nil {
// the tenant is deleted, no need to wait finalizer
if kubeerrors.IsNotFound(err) {
if m.BackupPolicy.Spec.TenantCRName != "" {
tenant, err := m.getOBTenantCR()
if err != nil {
// the tenant is deleted, no need to wait finalizer
if kubeerrors.IsNotFound(err) {
finalizerFinished = true
} else {
return errors.Wrap(err, "Get obtenant failed")
}
} else if !tenant.GetDeletionTimestamp().IsZero() {
// the tenant is being deleted
finalizerFinished = true
} else {
return errors.Wrap(err, "Get obtenant failed")
}
} else if !tenant.GetDeletionTimestamp().IsZero() {
// the tenant is being deleted
finalizerFinished = true
} else {
err := m.StopBackup()
// the policy is being deleted, connection still exists, stop backup
Expand Down

0 comments on commit 54fdf4b

Please sign in to comment.