Skip to content

Commit

Permalink
add "Deleting" phase for restore display (#6604)
Browse files Browse the repository at this point in the history
Signed-off-by: allenxu404 <[email protected]>
  • Loading branch information
allenxu404 authored Aug 8, 2023
1 parent 81057b9 commit 5f463c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/cmd/cli/restore/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ func NewGetCommand(f client.Factory, use string) *cobra.Command {
cmd.CheckError(err)
}

// Append "(Deleting)" to phase if deletionTimestamp is marked.
for i := range restores.Items {
if !restores.Items[i].DeletionTimestamp.IsZero() {
restores.Items[i].Status.Phase += " (Deleting)"
}
}

if printed, err := output.PrintWithFormat(c, restores); printed || err != nil {
cmd.CheckError(err)
return
Expand Down
6 changes: 6 additions & 0 deletions pkg/cmd/util/output/restore_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func DescribeRestore(ctx context.Context, kbClient kbclient.Client, restore *vel
phase = velerov1api.RestorePhaseNew
}
phaseString := string(phase)

// Append "Deleting" to phaseString if deletionTimestamp is marked.
if !restore.DeletionTimestamp.IsZero() {
phaseString += " (Deleting)"
}

switch phase {
case velerov1api.RestorePhaseCompleted:
phaseString = color.GreenString(phaseString)
Expand Down

0 comments on commit 5f463c5

Please sign in to comment.