kata-containers/tests/integration/kubernetes/runtimeclass_workloads/pod-oom.yaml
Xuewei Niu 6aa3517393 tests: Prevent the shim from being killed in k8s-oom test
The actual memory usage on the host is equal to the hypervisor memory usage
plus the user memory usage. An OOM killer might kill the shim when the
memory limit on host is same with that of container and the container
consumes all available memory. In this case, the containerd will never
receive OOM event, but get "task exit" event. That makes the `k8s-oom.bats`
test fail.

The fix is to add a new container to increase the sandbox memory limit.
When the container "oom-test" is killed by OOM killer, there is still
available memory for the shim, so it will not be killed.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2025-07-24 23:44:21 +08:00

35 lines
783 B
YAML

#
# Copyright (c) 2020 Ant Group
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: v1
kind: Pod
metadata:
name: pod-oom
spec:
runtimeClassName: kata
restartPolicy: Never
containers:
- image: quay.io/kata-containers/sysbench-kata:latest
imagePullPolicy: IfNotPresent
name: oom-test
command: ["/bin/sh"]
args: ["-c", "sleep 2; stress --vm 2 --vm-bytes 500M --timeout 30s"]
resources:
limits:
memory: 400Mi
requests:
memory: 400Mi
- image: quay.io/kata-containers/sysbench-kata:latest
imagePullPolicy: IfNotPresent
name: not-oom
command: ["/bin/sh"]
args: ["-c", "sleep inf"]
resources:
limits:
memory: 500Mi
requests:
memory: 500Mi