Merge pull request #44892 from corhere/backport-23.0/fix-kata-exec-exit

[23.0 backport] Fix exit-event handling for Kata runtime
This commit is contained in:
Bjorn Neergaard 2023-02-06 12:02:50 -07:00 committed by GitHub
commit bacf32d9ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -148,7 +148,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei
daemon.LogContainerEvent(c, "oom")
case libcontainerdtypes.EventExit:
if int(ei.Pid) == c.Pid {
if ei.ProcessID == libcontainerdtypes.InitProcessName {
return daemon.handleContainerExit(c, &ei)
}

View file

@ -674,7 +674,7 @@ func (c *client) processEvent(ctx context.Context, et libcontainerdtypes.EventTy
}).Error("failed to process event")
}
if et == libcontainerdtypes.EventExit && ei.ProcessID != ei.ContainerID {
if et == libcontainerdtypes.EventExit && ei.ProcessID != libcontainerdtypes.InitProcessName {
p, err := c.getProcess(ctx, ei.ContainerID, ei.ProcessID)
if err != nil {
@ -823,6 +823,9 @@ func (c *client) processEventStream(ctx context.Context, ns string) {
ExitCode: t.ExitStatus,
ExitedAt: t.ExitedAt,
}
if t.ID == t.ContainerID {
ei.ProcessID = libcontainerdtypes.InitProcessName
}
case *apievents.TaskOOM:
et = libcontainerdtypes.EventOOM
ei = libcontainerdtypes.EventInfo{