cri: memory.memsw.limit_in_bytes: no such file or directory

If kubelet passes the swap limit (default memory limit = swap limit ),
it is configured for container irrespective if the node supports swap.

Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
This commit is contained in:
Qasim Sarfraz 2023-07-21 14:43:33 +02:00
parent 4d2c887990
commit 06f18c69d2

View File

@ -329,7 +329,7 @@ func WithResources(resources *runtime.LinuxContainerResources, tolerateMissingHu
s.Linux.Resources.Memory.Swap = &limit
}
}
if swapLimit != 0 {
if swapLimit != 0 && SwapControllerAvailable() {
s.Linux.Resources.Memory.Swap = &swapLimit
}