add "Deleting" phase for restore display (#6604)

Signed-off-by: allenxu404 <qix2@vmware.com>
This commit is contained in:
Qi Xu
2023-08-09 05:16:53 +08:00
committed by GitHub
parent 81057b9983
commit 5f463c59ec
2 changed files with 13 additions and 0 deletions

View File

@@ -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

View File

@@ -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)