Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add systemd delegate config if cpuset is missing #4503

Merged
merged 3 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -125,6 +125,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 @@ -53,6 +53,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
Loading