Compare commits

..

2 Commits
11.4 ... 11.x

Author SHA1 Message Date
Nikita Tarasov
2e7f715c0d puppet: Use memory limits from cgroup, if set.
This fixes behaviour where a Docker image with a memory limit would
immediately OOM, as it would not detect the container's memory limit,
only the host's.

Fixes: #29794
(cherry picked from commit c75535a154)
2025-10-27 15:43:53 -04:00
Alex Vandiver
8650417cf1 version: Update version after 11.4 release. 2025-10-23 20:08:12 +00:00
3 changed files with 31 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
Facter.add(:container_memory_limit_mb) do
confine kernel: 'Linux'
setcode do
begin
memory_limit_mb = nil
# Check for cgroup v2
if File.exist?('/sys/fs/cgroup/memory.max')
val = File.read('/sys/fs/cgroup/memory.max').strip
memory_limit_mb = val.to_i / 1024 / 1024 unless val == 'max'
# Fallback to cgroup v1
elsif File.exist?('/sys/fs/cgroup/memory/memory.limit_in_bytes')
val = File.read('/sys/fs/cgroup/memory/memory.limit_in_bytes').strip.to_i
memory_limit_mb = val / 1024 / 1024 if val < 9223372036854771712
end
memory_limit_mb
rescue => e
Facter.debug("container_memory_limit_mb error: #{e}")
nil
end
end
end

View File

@@ -39,8 +39,11 @@ class zulip::common {
}
$supervisor_conf_dir = "${supervisor_system_conf_dir}/zulip"
$total_memory_bytes = $facts['memory']['system']['total_bytes']
$total_memory_mb = $total_memory_bytes / 1024 / 1024
if $facts['container_memory_limit_mb'] {
$total_memory_mb = Integer($facts['container_memory_limit_mb'])
} else {
$total_memory_mb = Integer($facts['memory']['system']['total_bytes'] / 1024 / 1024)
}
$goarch = $facts['os']['architecture'] ? {
'amd64' => 'amd64',

View File

@@ -1,6 +1,6 @@
import os
ZULIP_VERSION = "11.4"
ZULIP_VERSION = "11.4+git"
# Add information on number of commits and commit hash to version, if available
zulip_git_version_file = os.path.join(