Skip to content

Commit 1dada3f

Browse files
Jiaming Xudims
authored andcommitted
add cgroupv2 setup for cos with a flag
Signed-off-by: Jiaming Xu <[email protected]> address feedbacks
1 parent 0631cec commit 1dada3f

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

test/e2e_node/gci-init.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,34 @@
1616

1717
# This script is used to do extra initialization on GCI.
1818

19+
# set up cgroupv2 based on flag CONTAINERD_CGROUPV2 in containerd-env
20+
CONTAINERD_HOME="/home/containerd"
21+
CONTAINERD_ENV_METADATA="containerd-env"
22+
23+
if [ -f "${CONTAINERD_HOME}/${CONTAINERD_ENV_METADATA}" ]; then
24+
source "${CONTAINERD_HOME}/${CONTAINERD_ENV_METADATA}"
25+
fi
26+
27+
if [ "${CONTAINERD_CGROUPV2:-"false"}" == "true" ]; then
28+
# check cos image
29+
if uname -a | grep -q cos; then
30+
if ! grep -q 'systemd.unified_cgroup_hierarchy=true' /proc/cmdline; then
31+
echo "Setting up cgroupv2"
32+
33+
mount_path="/tmp/esp"
34+
mkdir -p "${mount_path}"
35+
esp_partition="/dev/sda12"
36+
mount "${esp_partition}" "${mount_path}"
37+
sed -i 's/systemd.unified_cgroup_hierarchy=false/systemd.unified_cgroup_hierarchy=true/g' "${mount_path}/efi/boot/grub.cfg"
38+
umount "${mount_path}"
39+
rmdir "${mount_path}"
40+
41+
echo "Reconfigured grub; rebooting..."
42+
reboot
43+
fi
44+
fi
45+
fi
46+
1947
mount /tmp /tmp -o remount,exec,suid
2048
#TODO(random-liu): Stop docker and remove this docker thing.
2149
usermod -a -G docker jenkins

0 commit comments

Comments
 (0)