You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: design/backup_cancellation.md
+40-62Lines changed: 40 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,34 +2,49 @@
2
2
# Backup Cancellation Design
3
3
4
4
## Abstract
5
-
This proposal introduces user-initiated backup cancellation functionality to Velero, allowing users to abort running backups through a new `cancel` field in the backup specification.
6
-
The design addresses GitHub issues [#9189](https://github.com/vmware-tanzu/velero/issues/9189
7
-
) and [#2098](https://github.com/vmware-tanzu/velero/issues/2098) by providing a mechanism to cleanly cancel async operations and prevent resource leaks when backups need to be terminated.
5
+
- This proposal introduces user-initiated backup cancellation functionality to Velero, allowing users to abort running backups through a new `cancel` field in the backup specification
6
+
> backup.Spec.Cancel
7
+
8
+
- The design addresses GitHub issues [#9189](https://github.com/vmware-tanzu/velero/issues/9189
9
+
) and [#2098](https://github.com/vmware-tanzu/velero/issues/2098)
10
+
- It is currently not possible to delete an in-progress backup: the deletion controller blocks it
11
+
- Cancellation flow would allow this to happen
8
12
9
13
## Background
10
-
Currently, Velero lacks the ability to cancel running backups, leading to several critical issues.
11
-
When users accidentally submit broad backup jobs (e.g., forgot to narrow resource selectors), the system becomes blocked and scheduled jobs accumulate.
12
-
Additionally, the backup deletion controller prevents running backups from being deleted.
14
+
- Currently, Velero lacks the ability to cancel running backups, leading to several critical issues
15
+
16
+
- When users accidentally submit broad backup jobs (e.g., forgot to narrow resource selectors), the system becomes blocked and scheduled jobs accumulate
17
+
18
+
- Additionally, the backup deletion controller prevents running backups from being deleted
13
19
14
20
15
21
## Goals
16
22
- Enable users to cancel running backups through a `cancel` field in the backup specification
- Cancelling backups that have already completed or failed
22
-
- Rolling back partially completed backup operations
37
+
23
38
- Implementing cancellation for restore operations (future work)
24
39
25
40
26
41
## High-Level Design
27
-
The solution introduces a new `cancel` boolean field to the backup specification that users can set to `true` to request cancellation.
28
-
Existing controllers (backup_controller, backup_operations_controller, backup_finalizer_controller) will check for this field and transition the backup to a `Cancelling` phase before returning early from their reconcile loops.
42
+
- The solution introduces a new `cancel` boolean field to the backup specification that users can set to `true` to request cancellation
43
+
44
+
- Existing controllers `(backup_controller, backup_operations_controller, backup_finalizer_controller)` will check for this field, attempt to cancel async ops and then transition to the `Cancelling` phase
45
+
46
+
- A new dedicated backup cancellation controller will watch for backups in the `Cancelling` phase, trying to cleanup backup data
29
47
30
-
A new dedicated backup cancellation controller will watch for backups in the `Cancelling` phase and coordinate the actual cancellation work.
31
-
This controller will call `Cancel()` methods on all in-progress BackupItemAction operations (which automatically handles DataUpload cancellation), directly cancel PodVolumeBackups by setting their cancel flags, and finally transition the backup to `Cancelled` phase.
32
-
The design uses a 5-second ticker to prevent API overload and ensures clean separation between cancellation detection and execution.
33
48
34
49
## Detailed Design
35
50
@@ -59,40 +74,21 @@ const (
59
74
### Controller Changes
60
75
61
76
#### Existing Controllers
62
-
Modify `backup_controller.go`, `backup_operations_controller.go`, and `backup_finalizer_controller.go` to check for cancellation:
63
-
```go
64
-
// Early in each Reconcile method
65
-
if backup.Spec.Cancel != nil && *backup.Spec.Cancel {
66
-
if backup.Status.Phase != BackupPhaseCancelling && backup.Status.Phase != BackupPhaseCancelled {
return ctrl.Result{}, nil// Skip processing for cancelling/cancelled backups
72
-
}
73
-
```
74
-
In addition, the `backup_operations_controller.go` will have a periodic check around backup progress updates, rather than running every time progress is updated to reduce API load.
0 commit comments