Update containerd shim to use OOMKill instead of OOM.

The reason for this is outlined in https://github.com/containerd/containerd/commit/7275411ec811f1294e1b3466bc24e963ea90f002.

TL;DR: K8s sets mem limits on the pod cgroup (slice), which means
the scope cgroup (container) gets OOMKilled, not OOMed.

Fixes #9723

PiperOrigin-RevId: 686543615
This commit is contained in:
Lucas Manning
2024-10-16 09:57:40 -07:00
committed by gVisor bot
parent 291abe6570
commit 78827837d4
+3 -3
View File
@@ -71,15 +71,15 @@ func (w *watcherV2) run(ctx context.Context) {
}
logrus.Debugf("Received OOM event, id: %q, event: %+v", i.id, i.ev)
lastOOM := lastOOMMap[i.id]
if i.ev.OOM > lastOOM {
if i.ev.OOMKill > lastOOM {
if err := w.publisher.Publish(ctx, runtime.TaskOOMEventTopic, &TaskOOM{
ContainerID: i.id,
}); err != nil {
logrus.WithError(err).Error("Publish OOM event")
}
}
if i.ev.OOM > 0 {
lastOOMMap[i.id] = i.ev.OOM
if i.ev.OOMKill > 0 {
lastOOMMap[i.id] = i.ev.OOMKill
}
}
}