Skip to content

Commit 09a2b55

Browse files
pooknullhors
andauthored
K8SPS-341: ignore delete-backup finalizer for not finished backups (#654)
https://perconadev.atlassian.net/browse/K8SPS-341 Co-authored-by: Viacheslav Sarzhan <[email protected]>
1 parent 8f27bd7 commit 09a2b55

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/controller/psbackup/controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ func (r *PerconaServerMySQLBackupReconciler) backupConfig(ctx context.Context, c
519519
}
520520

521521
func (r *PerconaServerMySQLBackupReconciler) deleteBackup(ctx context.Context, cr *apiv1alpha1.PerconaServerMySQLBackup) (bool, error) {
522+
if cr.Status.State != apiv1alpha1.BackupSucceeded {
523+
return true, nil
524+
}
525+
522526
backupConf, err := r.backupConfig(ctx, cr)
523527
if err != nil {
524528
return false, errors.Wrap(err, "failed to create sidecar backup config")

pkg/controller/psbackup/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func TestCheckFinalizers(t *testing.T) {
226226
cr.Status.State = apiv1alpha1.BackupFailed
227227
}),
228228
finalizerJobFail: true,
229-
expectedFinalizers: []string{naming.FinalizerDeleteBackup},
229+
expectedFinalizers: []string{},
230230
},
231231
{
232232
name: "with successful finalizer and failed state",

0 commit comments

Comments
 (0)