Merge pull request #55 from mrunalp/status_pod
Populate state in pod status
This commit is contained in:
commit
e548ec17a7
2 changed files with 21 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue