mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 19:54:35 +00:00
bugfix: plus default_memory when calculating mem size
We've noticed this caused regressions with the k8s-oom tests, and then
decided to take a step back and do this in the same way it was done
before 67972ec48a
.
Moreover, this step back is also more reasonable in terms of the
controlling logic.
And by doing this we can re-enable the k8s-oom.bats tests, which is done
as part of this PR.
Fixes: #7271
Depends-on: github.com/kata-containers/tests#5705
Signed-off-by: Yushuo <y-shuo@linux.alibaba.com>
This commit is contained in:
parent
afbc1f94d7
commit
28c29b248d
@ -105,7 +105,12 @@ impl InitialSizeManager {
|
||||
hv.cpu_info.default_vcpus = self.resource.vcpu as i32
|
||||
}
|
||||
if self.resource.mem_mb > 0 {
|
||||
hv.memory_info.default_memory = self.resource.mem_mb;
|
||||
// since the memory overhead introduced by kata-agent and system components
|
||||
// will really affect the amount of memory the user can use, so we choose to
|
||||
// plus the default_memory here, instead of overriding it.
|
||||
// (if we override the default_memory here, and user apllications still
|
||||
// use memory as they orignally expected, it would be easy to OOM.)
|
||||
hv.memory_info.default_memory += self.resource.mem_mb;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -9,15 +9,11 @@ load "${BATS_TEST_DIRNAME}/../../common.bash"
|
||||
load "${BATS_TEST_DIRNAME}/tests_common.sh"
|
||||
|
||||
setup() {
|
||||
[ "${KATA_HYPERVISOR}" == "dragonball" ] && skip "Test is currently failing, see: https://github.com/kata-containers/kata-containers/issues/7271"
|
||||
|
||||
pod_name="pod-oom"
|
||||
get_pod_config_dir
|
||||
}
|
||||
|
||||
@test "Test OOM events for pods" {
|
||||
[ "${KATA_HYPERVISOR}" == "dragonball" ] && skip "Test is currently failing, see: https://github.com/kata-containers/kata-containers/issues/7271"
|
||||
|
||||
# Create pod
|
||||
kubectl create -f "${pod_config_dir}/$pod_name.yaml"
|
||||
|
||||
@ -33,8 +29,6 @@ setup() {
|
||||
}
|
||||
|
||||
teardown() {
|
||||
[ "${KATA_HYPERVISOR}" == "dragonball" ] && skip "Test is currently failing, see: https://github.com/kata-containers/kata-containers/issues/7271"
|
||||
|
||||
# Debugging information
|
||||
kubectl describe "pod/$pod_name"
|
||||
kubectl get "pod/$pod_name" -o yaml
|
||||
|
Loading…
Reference in New Issue
Block a user