Skip to content

Commit

Permalink
BUG: Handle Cgroups v2 memory limit set to 0 or max
Browse files Browse the repository at this point in the history
  • Loading branch information
dkorunic committed Jul 25, 2023
1 parent b0331ef commit f6685ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions fs/etc/services.d/haproxy/run
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ fi
if [ -r "${CG_LIMIT_FILE}" ]; then
MEMLIMIT_CG=$(awk '{print int($1 / 1024 / 1024 * 2 / 3)}' "${CG_LIMIT_FILE}")

if [ ${MEMLIMIT_CG} -lt ${MEMLIMIT} ]; then
MEMLIMIT=${MEMLIMIT_CG}
if [ "${MEMLIMIT_CG}" -gt 0 ]; then
if [ "${MEMLIMIT_CG}" -lt "${MEMLIMIT}" ]; then
MEMLIMIT="${MEMLIMIT_CG}"
fi
fi
fi

Expand Down
6 changes: 4 additions & 2 deletions fs/etc/services.d/ingress-controller/run
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ fi
if [ -r "${CG_LIMIT_FILE}" ]; then
MEMLIMIT_CG=$(awk '{print int($1 / 1024 / 1024 / 3)}' "${CG_LIMIT_FILE}")

if [ ${MEMLIMIT_CG} -lt ${MEMLIMIT} ]; then
MEMLIMIT=${MEMLIMIT_CG}
if [ "${MEMLIMIT_CG}" -gt 0 ]; then
if [ "${MEMLIMIT_CG}" -lt "${MEMLIMIT}" ]; then
MEMLIMIT="${MEMLIMIT_CG}"
fi
fi
fi

Expand Down

0 comments on commit f6685ce

Please sign in to comment.