Skip to content

Commit

Permalink
Fix cgroup hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
discordianfish committed Mar 31, 2019
1 parent 8784ea9 commit 1975fd8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions files/etc/init.d/k3s
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@ STOP=20
PIDFILE=/var/run/k3s.pid
EXEC="/usr/bin/k3s"

ensure_cgroup_mount() {
# Unmount /sys/fs/cgroup if mounted as cgroup
grep ' /sys/fs/cgroup cgroup' /proc/self/mounts && umount /sys/fs/cgroup

mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mnt="/sys/fs/cgroup/$sys"
grep -q "cgroup $mnt " /proc/self/mounts && continue
mkdir -p "$mnt"
mount -n -t cgroup -o $sys cgroup "$mnt"
done
}

start() {
ensure_cgroup_mount
start-stop-daemon -S -b -x "$EXEC" -m -p "$PIDFILE" \
-- server --no-deploy traefik \
--data-dir $(uci_get k3s.globals.root)
Expand Down

0 comments on commit 1975fd8

Please sign in to comment.