diff --git a/cmd/client/sandbox.go b/cmd/client/sandbox.go index e4adfcd0..b64be46c 100644 --- a/cmd/client/sandbox.go +++ b/cmd/client/sandbox.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "time" "github.com/urfave/cli" "golang.org/x/net/context" @@ -181,6 +182,19 @@ func PodSandboxStatus(client pb.RuntimeServiceClient, ID string) error { if err != nil { return err } - fmt.Println(r) + fmt.Printf("ID: %s\n", *r.Status.Id) + if r.Status.State != nil { + fmt.Printf("Status: %s\n", r.Status.State) + } + if r.Status.CreatedAt != nil { + ctm := time.Unix(*r.Status.CreatedAt, 0) + fmt.Printf("Created: %v\n", ctm) + } + if r.Status.Linux != nil { + fmt.Printf("Network namespace: %s\n", *r.Status.Linux.Namespaces.Network) + } + if r.Status.Network != nil { + fmt.Printf("IP Address: %v\n", *r.Status.Network.Ip) + } return nil } diff --git a/server/sandbox.go b/server/sandbox.go index 08deaca7..8ee1b6ca 100644 --- a/server/sandbox.go +++ b/server/sandbox.go @@ -331,6 +331,11 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR ip = "" } + rStatus := pb.PodSandBoxState_NOTREADY + if cState.Status == "running" { + rStatus = pb.PodSandBoxState_READY + } + return &pb.PodSandboxStatusResponse{ Status: &pb.PodSandboxStatus{ Id: sbID, @@ -341,6 +346,7 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR }, }, Network: &pb.PodSandboxNetworkStatus{Ip: &ip}, + State: &rStatus, }, }, nil }