Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Container: Add initConfigResourcesMemory and call it in newContainer
The swappiness is not right if just set io.katacontainers.container.resource.swappiness: $ pod_yaml=pod.yaml $ container_yaml=container.yaml $ image="quay.io/prometheus/busybox:latest" $ cat << EOF > "${pod_yaml}" metadata: name: busybox-sandbox1 EOF $ cat << EOF > "${container_yaml}" metadata: name: busybox-killed-vmm annotations: io.katacontainers.container.resource.swappiness: "100" image: image: "$image" command: - top EOF $ sudo crictl pull $image $ podid=$(sudo crictl runp $pod_yaml) $ cid=$(sudo crictl create $podid $container_yaml $pod_yaml) $ sudo crictl start $cid crictl exec $cid cat /sys/fs/cgroup/memory/memory.swappiness 60 The cause of this issue is there are two elements store the resources infomation. They are c.config.Resources for calculateSandboxMemory and c.GetPatchedOCISpec() for agent. This add initConfigResourcesMemory to Container and call it in newContainer to handle the issue. Fixes: #2372 Signed-off-by: Hui Zhu <teawater@antfin.com>
- Loading branch information