container: Add image ID and name to the container status

Kubelet 1.6 seems to request that those fields must be present.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2017-03-16 10:42:31 +01:00
parent 792f585c44
commit 0169dce585

View file

@ -16,18 +16,27 @@ func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusReq
return nil, err return nil, err
} }
if err := s.runtime.UpdateStatus(c); err != nil { if err = s.runtime.UpdateStatus(c); err != nil {
return nil, err return nil, err
} }
containerID := c.ID() containerID := c.ID()
image := c.Image()
resp := &pb.ContainerStatusResponse{ resp := &pb.ContainerStatusResponse{
Status: &pb.ContainerStatus{ Status: &pb.ContainerStatus{
Id: containerID, Id: containerID,
Metadata: c.Metadata(), Metadata: c.Metadata(),
Image: image,
}, },
} }
status, err := s.images.ImageStatus(s.imageContext, image.Image)
if err != nil {
return nil, err
}
resp.Status.ImageRef = status.ID
cState := s.runtime.ContainerStatus(c) cState := s.runtime.ContainerStatus(c)
rStatus := pb.ContainerState_CONTAINER_UNKNOWN rStatus := pb.ContainerState_CONTAINER_UNKNOWN