display container metadata on the client for container list and status
Signed-off-by: Crazykev <crazykev@zju.edu.cn>
This commit is contained in:
parent
87a83e14b0
commit
ca59eaf1a4
2 changed files with 18 additions and 0 deletions
|
@ -364,6 +364,14 @@ func ContainerStatus(client pb.RuntimeServiceClient, ID string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("ID: %s\n", *r.Status.Id)
|
fmt.Printf("ID: %s\n", *r.Status.Id)
|
||||||
|
if r.Status.Metadata != nil {
|
||||||
|
if r.Status.Metadata.Name != nil {
|
||||||
|
fmt.Printf("Name: %s\n", *r.Status.Metadata.Name)
|
||||||
|
}
|
||||||
|
if r.Status.Metadata.Attempt != nil {
|
||||||
|
fmt.Printf("Attempt: %v\n", *r.Status.Metadata.Attempt)
|
||||||
|
}
|
||||||
|
}
|
||||||
if r.Status.State != nil {
|
if r.Status.State != nil {
|
||||||
fmt.Printf("Status: %s\n", r.Status.State)
|
fmt.Printf("Status: %s\n", r.Status.State)
|
||||||
}
|
}
|
||||||
|
@ -428,6 +436,14 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error {
|
||||||
}
|
}
|
||||||
fmt.Printf("ID: %s\n", *c.Id)
|
fmt.Printf("ID: %s\n", *c.Id)
|
||||||
fmt.Printf("Pod: %s\n", *c.PodSandboxId)
|
fmt.Printf("Pod: %s\n", *c.PodSandboxId)
|
||||||
|
if c.Metadata != nil {
|
||||||
|
if c.Metadata.Name != nil {
|
||||||
|
fmt.Printf("Name: %s\n", *c.Metadata.Name)
|
||||||
|
}
|
||||||
|
if c.Metadata.Attempt != nil {
|
||||||
|
fmt.Printf("Attempt: %v\n", *c.Metadata.Attempt)
|
||||||
|
}
|
||||||
|
}
|
||||||
if c.State != nil {
|
if c.State != nil {
|
||||||
fmt.Printf("Status: %s\n", *c.State)
|
fmt.Printf("Status: %s\n", *c.State)
|
||||||
}
|
}
|
||||||
|
@ -447,6 +463,7 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error {
|
||||||
fmt.Printf("\t%s -> %s\n", k, v)
|
fmt.Printf("\t%s -> %s\n", k, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Println()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,6 +379,7 @@ func ListPodSandboxes(client pb.RuntimeServiceClient, opts listOptions) error {
|
||||||
fmt.Printf("\t%s -> %s\n", k, v)
|
fmt.Printf("\t%s -> %s\n", k, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Println()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue