Skip to content

Commit

Permalink
Add systemd delegate config if cpuset is missing (#4667)
Browse files Browse the repository at this point in the history
* Add delegate config if cpuset is missing
  • Loading branch information
berkayoz authored Sep 10, 2024
1 parent 20e8104 commit 19200c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions microk8s-resources/wrappers/run-kubelite-with-args
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ then
fi
fi

if ! is_strict &&
(systemctl show snap.microk8s.daemon-kubelite.service -p NRestarts | grep -qv "NRestarts=0") &&
(grep -qv cpuset /sys/fs/cgroup/cgroup.subtree_control) &&
[ ! -e /etc/systemd/system/snap.microk8s.daemon-kubelite.service.d/delegate.conf ]
then
mkdir -p /etc/systemd/system/snap.microk8s.daemon-kubelite.service.d
tee /etc/systemd/system/snap.microk8s.daemon-kubelite.service.d/delegate.conf > /dev/null <<EOF
[Service]
Delegate=yes
EOF
systemctl daemon-reload || true
snap restart microk8s || true
fi

# wait for containerd socket
if grep -e "--address " $SNAP_DATA/args/containerd &> /dev/null
then
Expand Down
2 changes: 2 additions & 0 deletions snap/hooks/remove
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ then
# remove custom sysctl parameters
rm -f /etc/sysctl.d/10-microk8s.conf
sysctl --system

rm -rf /etc/systemd/system/snap.microk8s.daemon-kubelite.service.d || true
fi

# Clean the container location so we do not snapshot it.
Expand Down

0 comments on commit 19200c9

Please sign in to comment.