Skip to content

Commit 886db23

Browse files
dkorunicoktalz
authored andcommitted
BUG: Handle Cgroups v2 memory limit set to 0 or max
1 parent f871d67 commit 886db23

File tree

2 files changed

+8
-4
lines changed
  • fs/etc/services.d
    • haproxy
    • ingress-controller

2 files changed

+8
-4
lines changed

fs/etc/services.d/haproxy/run

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ fi
1010
if [ -r "${CG_LIMIT_FILE}" ]; then
1111
MEMLIMIT_CG=$(awk '{print int($1 / 1024 / 1024 * 2 / 3)}' "${CG_LIMIT_FILE}")
1212

13-
if [ ${MEMLIMIT_CG} -lt ${MEMLIMIT} ]; then
14-
MEMLIMIT=${MEMLIMIT_CG}
13+
if [ "${MEMLIMIT_CG}" -gt 0 ]; then
14+
if [ "${MEMLIMIT_CG}" -lt "${MEMLIMIT}" ]; then
15+
MEMLIMIT="${MEMLIMIT_CG}"
16+
fi
1517
fi
1618
fi
1719

fs/etc/services.d/ingress-controller/run

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ fi
1818
if [ -r "${CG_LIMIT_FILE}" ]; then
1919
MEMLIMIT_CG=$(awk '{print int($1 / 1024 / 1024 / 3)}' "${CG_LIMIT_FILE}")
2020

21-
if [ ${MEMLIMIT_CG} -lt ${MEMLIMIT} ]; then
22-
MEMLIMIT=${MEMLIMIT_CG}
21+
if [ "${MEMLIMIT_CG}" -gt 0 ]; then
22+
if [ "${MEMLIMIT_CG}" -lt "${MEMLIMIT}" ]; then
23+
MEMLIMIT="${MEMLIMIT_CG}"
24+
fi
2325
fi
2426
fi
2527

0 commit comments

Comments
 (0)