Merge pull request #4656 from zhuangqh/fix-unknown-state

CRI: always set unknown to false when handling exit event
This commit is contained in:
Phil Estes 2020-10-27 08:54:30 -04:00 committed by GitHub
commit 839b136992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -325,14 +325,12 @@ func handleContainerExit(ctx context.Context, e *eventtypes.TaskExit, cntr conta
}
}
err = cntr.Status.UpdateSync(func(status containerstore.Status) (containerstore.Status, error) {
// If FinishedAt has been set (e.g. with start failure), keep as
// it is.
if status.FinishedAt != 0 {
return status, nil
if status.FinishedAt == 0 {
status.Pid = 0
status.FinishedAt = e.ExitedAt.UnixNano()
status.ExitCode = int32(e.ExitStatus)
}
status.Pid = 0
status.FinishedAt = e.ExitedAt.UnixNano()
status.ExitCode = int32(e.ExitStatus)
// Unknown state can only transit to EXITED state, so we need
// to handle unknown state here.
if status.Unknown {