From 83cca7690f16964dbabed957ee058eca2447dd31 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Fri, 9 Nov 2018 14:22:29 +0100 Subject: [PATCH] crictl inspect: print annotations and labels for table output Signed-off-by: Antonio Murdaca --- cmd/crictl/container.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/crictl/container.go b/cmd/crictl/container.go index 44d3f049b1..ab003ab7c0 100644 --- a/cmd/crictl/container.go +++ b/cmd/crictl/container.go @@ -548,6 +548,18 @@ func ContainerStatus(client pb.RuntimeServiceClient, ID, output string, quiet bo } fmt.Printf("Exit Code: %v\n", r.Status.ExitCode) } + if r.Status.Labels != nil { + fmt.Println("Labels:") + for _, k := range getSortedKeys(r.Status.Labels) { + fmt.Printf("\t%s -> %s\n", k, r.Status.Labels[k]) + } + } + if r.Status.Annotations != nil { + fmt.Println("Annotations:") + for _, k := range getSortedKeys(r.Status.Annotations) { + fmt.Printf("\t%s -> %s\n", k, r.Status.Annotations[k]) + } + } if verbose { fmt.Printf("Info: %v\n", r.GetInfo()) }