Merge pull request #55 from mrunalp/status_pod

Populate state in pod status
This commit is contained in:
Antonio Murdaca 2016-09-26 20:38:40 +02:00 committed by GitHub
commit e548ec17a7
2 changed files with 21 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"time"
"github.com/urfave/cli" "github.com/urfave/cli"
"golang.org/x/net/context" "golang.org/x/net/context"
@ -181,6 +182,19 @@ func PodSandboxStatus(client pb.RuntimeServiceClient, ID string) error {
if err != nil { if err != nil {
return err 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 return nil
} }

View file

@ -331,6 +331,11 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR
ip = "" ip = ""
} }
rStatus := pb.PodSandBoxState_NOTREADY
if cState.Status == "running" {
rStatus = pb.PodSandBoxState_READY
}
return &pb.PodSandboxStatusResponse{ return &pb.PodSandboxStatusResponse{
Status: &pb.PodSandboxStatus{ Status: &pb.PodSandboxStatus{
Id: sbID, Id: sbID,
@ -341,6 +346,7 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR
}, },
}, },
Network: &pb.PodSandboxNetworkStatus{Ip: &ip}, Network: &pb.PodSandboxNetworkStatus{Ip: &ip},
State: &rStatus,
}, },
}, nil }, nil
} }