Applying k8s.io v3 API for ocic and ocid
Signed-off-by: Michał Żyłowski <michal.zylowski@intel.com>
This commit is contained in:
parent
a48336f981
commit
5c81217e09
26 changed files with 247 additions and 289 deletions
|
@ -11,7 +11,7 @@ import (
|
|||
func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusRequest) (*pb.ContainerStatusResponse, error) {
|
||||
logrus.Debugf("ContainerStatusRequest %+v", req)
|
||||
s.Update()
|
||||
c, err := s.getContainerFromRequest(req)
|
||||
c, err := s.getContainerFromRequest(req.ContainerId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusReq
|
|||
containerID := c.ID()
|
||||
resp := &pb.ContainerStatusResponse{
|
||||
Status: &pb.ContainerStatus{
|
||||
Id: &containerID,
|
||||
Id: containerID,
|
||||
Metadata: c.Metadata(),
|
||||
},
|
||||
}
|
||||
|
@ -35,25 +35,25 @@ func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusReq
|
|||
case oci.ContainerStateCreated:
|
||||
rStatus = pb.ContainerState_CONTAINER_CREATED
|
||||
created := cState.Created.UnixNano()
|
||||
resp.Status.CreatedAt = int64Ptr(created)
|
||||
resp.Status.CreatedAt = int64(created)
|
||||
case oci.ContainerStateRunning:
|
||||
rStatus = pb.ContainerState_CONTAINER_RUNNING
|
||||
created := cState.Created.UnixNano()
|
||||
resp.Status.CreatedAt = int64Ptr(created)
|
||||
resp.Status.CreatedAt = int64(created)
|
||||
started := cState.Started.UnixNano()
|
||||
resp.Status.StartedAt = int64Ptr(started)
|
||||
resp.Status.StartedAt = int64(started)
|
||||
case oci.ContainerStateStopped:
|
||||
rStatus = pb.ContainerState_CONTAINER_EXITED
|
||||
created := cState.Created.UnixNano()
|
||||
resp.Status.CreatedAt = int64Ptr(created)
|
||||
resp.Status.CreatedAt = int64(created)
|
||||
started := cState.Started.UnixNano()
|
||||
resp.Status.StartedAt = int64Ptr(started)
|
||||
resp.Status.StartedAt = int64(started)
|
||||
finished := cState.Finished.UnixNano()
|
||||
resp.Status.FinishedAt = int64Ptr(finished)
|
||||
resp.Status.ExitCode = int32Ptr(cState.ExitCode)
|
||||
resp.Status.FinishedAt = int64(finished)
|
||||
resp.Status.ExitCode = int32(cState.ExitCode)
|
||||
}
|
||||
|
||||
resp.Status.State = &rStatus
|
||||
resp.Status.State = rStatus
|
||||
|
||||
logrus.Debugf("ContainerStatusResponse: %+v", resp)
|
||||
return resp, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue