kuberuntime: report StartedAt for exited containers

This commit is contained in:
Yu-Ju Hong 2017-05-17 10:49:03 -07:00
parent 2cf0169092
commit 7c75f5c551

View File

@ -402,9 +402,12 @@ func (m *kubeGenericRuntimeManager) getPodContainerStatuses(uid kubetypes.UID, n
CreatedAt: time.Unix(0, status.CreatedAt), CreatedAt: time.Unix(0, status.CreatedAt),
} }
if c.State == runtimeapi.ContainerState_CONTAINER_RUNNING { if c.State != runtimeapi.ContainerState_CONTAINER_CREATED {
// If container is not in the created state, we have tried and
// started the container. Set the StartedAt time.
cStatus.StartedAt = time.Unix(0, status.StartedAt) cStatus.StartedAt = time.Unix(0, status.StartedAt)
} else { }
if c.State == runtimeapi.ContainerState_CONTAINER_EXITED {
cStatus.Reason = status.Reason cStatus.Reason = status.Reason
cStatus.Message = status.Message cStatus.Message = status.Message
cStatus.ExitCode = int(status.ExitCode) cStatus.ExitCode = int(status.ExitCode)