Skip to content

Commit 3505c63

Browse files
refactor(rootless): refactor entrypoint to keep it similar to rootfull image (#117)
1 parent 215633e commit 3505c63

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

run.sh

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
#!/bin/bash
22

3+
echo "Entering $0 at $(date) "
4+
5+
if [ ! -f /sys/fs/cgroup/cgroup.controllers ]; then
6+
echo "Using cgroup v1"
7+
else
8+
echo "Using cgroup v2"
9+
CURRENT_CGROUP=$(cat /proc/self/cgroup | sed 's/0:://')
10+
echo "Current cgroup: ${CURRENT_CGROUP}"
11+
12+
MEMORY_OOM_GROUP_VALUE=$(cat "/sys/fs/cgroup/${CURRENT_CGROUP}/memory.oom.group")
13+
echo "Current memory.oom.group value: ${MEMORY_OOM_GROUP_VALUE}"
14+
15+
if [[ "${MEMORY_OOM_GROUP_VALUE}" == "1" ]]; then
16+
echo "Warning! memory.oom.group is set to 1 for the current cgroup, OOM events will not be handled properly by the platform. \
17+
Set singleProcessOOMKill=true for kubelet configuration to fix it." 1>&2;
18+
fi
19+
fi
20+
321
DIR=$(dirname $0)
422

5-
echo "Entering $0 at $(date) "
623
DOCKERD_DATA_ROOT=${DOCKERD_DATA_ROOT:-/home/rootless/.local/share/docker}
724
DIND_VOLUME_STAT_DIR=${DIND_VOLUME_STAT_DIR:-${DOCKERD_DATA_ROOT}/dind-volume}
825
DIND_VOLUME_CREATED_TS_FILE=${DIND_VOLUME_STAT_DIR}/created
@@ -190,22 +207,6 @@ do
190207

191208
echo "Starting dockerd rootless"
192209

193-
if [ ! -f /sys/fs/cgroup/cgroup.controllers ]; then
194-
echo "Using cgroup v1"
195-
else
196-
echo "Using cgroup v2"
197-
CURRENT_CGROUP=$(cat /proc/self/cgroup | sed 's/0:://')
198-
echo "Current cgroup: ${CURRENT_CGROUP}"
199-
200-
MEMORY_OOM_GROUP_VALUE=$(cat "/sys/fs/cgroup/${CURRENT_CGROUP}/memory.oom.group")
201-
echo "Current memory.oom.group value: ${MEMORY_OOM_GROUP_VALUE}"
202-
203-
if [[ "${MEMORY_OOM_GROUP_VALUE}" == "1" ]]; then
204-
echo "Warning! memory.oom.group is set to 1 for the current cgroup, OOM events will not be handled properly by the platform. \
205-
Set singleProcessOOMKill=true for kubelet configuration to fix it." 1>&2;
206-
fi
207-
fi
208-
209210
export DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS="-p 0.0.0.0:1300:1300/tcp" # Expose rooltelsskit port
210211
dockerd-entrypoint.sh dockerd --feature containerd-snapshotter=false ${DOCKERD_PARAMS} <&- &
211212

service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 3.0.10
1+
version: 3.0.11

0 commit comments

Comments
 (0)