From 59295591ca0562d12e807f6d9e6aef4ec0980e0c Mon Sep 17 00:00:00 2001 From: Varsha Varadarajan Date: Tue, 19 Apr 2022 18:35:35 -0400 Subject: [PATCH] delete old backup objects only if successfully completed --- controllers/etcdbackupschedule_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/etcdbackupschedule_controller.go b/controllers/etcdbackupschedule_controller.go index 0ddc7152..1c811ca6 100644 --- a/controllers/etcdbackupschedule_controller.go +++ b/controllers/etcdbackupschedule_controller.go @@ -196,7 +196,7 @@ func (r *EtcdBackupScheduleReconciler) cleanup(resourceNamespacedName types.Name for i, backup := range etcdBackups.Items { backup := backup funcs[i] = func() error { - if cleanAll || backup.Status.Phase != etcdv1alpha1.EtcdBackupPhaseBackingUp { + if cleanAll || backup.Status.Phase == etcdv1alpha1.EtcdBackupPhaseCompleted { if err := r.Delete(ctx, &backup); err != nil { return client.IgnoreNotFound(err) }