mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-18 22:14:29 +00:00
Allow forced backup deletion
Add --force and --confirm to `ark backup delete` to support forced backup deletion. This forcibly removes the Ark GC finalizer (if it's present) from a backup and will orphan any resources associated with the backup, such as backup tarballs in object storage, persistent volume snapshots, and restores for the backup. If a backup has a deletion timestamp, display `Deleting` in `ark backup describe` and `ark backup get`. Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
@@ -32,7 +32,8 @@ func DescribeBackup(backup *v1.Backup) string {
|
||||
DescribeBackupSpec(d, backup.Spec)
|
||||
|
||||
d.Println()
|
||||
DescribeBackupStatus(d, backup.Status)
|
||||
deleting := backup.DeletionTimestamp != nil && !backup.DeletionTimestamp.Time.IsZero()
|
||||
DescribeBackupStatus(d, backup.Status, deleting)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -143,11 +144,14 @@ func DescribeBackupSpec(d *Describer, spec v1.BackupSpec) {
|
||||
|
||||
}
|
||||
|
||||
func DescribeBackupStatus(d *Describer, status v1.BackupStatus) {
|
||||
func DescribeBackupStatus(d *Describer, status v1.BackupStatus, deleting bool) {
|
||||
phase := status.Phase
|
||||
if phase == "" {
|
||||
phase = v1.BackupPhaseNew
|
||||
}
|
||||
if deleting {
|
||||
phase = "Deleting"
|
||||
}
|
||||
d.Printf("Phase:\t%s\n", phase)
|
||||
|
||||
d.Println()
|
||||
|
||||
@@ -87,6 +87,9 @@ func printBackup(backup *v1.Backup, w io.Writer, options printers.PrintOptions)
|
||||
if status == "" {
|
||||
status = v1.BackupPhaseNew
|
||||
}
|
||||
if backup.DeletionTimestamp != nil && !backup.DeletionTimestamp.Time.IsZero() {
|
||||
status = "Deleting"
|
||||
}
|
||||
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s", name, status, backup.CreationTimestamp.Time, humanReadableTimeFromNow(expiration), metav1.FormatLabelSelector(backup.Spec.LabelSelector)); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user