Skip to content

Commit 90c8810

Browse files
committed
Improve the resiliance of the nofile-infinity script
1 parent 8c07c7e commit 90c8810

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

containerd-nofile-infinity/containerd-nofile-infinity.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ spec:
4545
- |
4646
set -e
4747
set -u
48-
echo "Generating containerd system drop in config for nofile limit"
49-
nofile_limit_path="/host/etc/systemd/system/containerd.service.d/40-LimitNOFILE-infinity.conf"
50-
cat >> "${nofile_limit_path}" <<EOF
48+
echo "Checking if containerd system drop-in directory exists"
49+
if [ ! -d "/host/etc/systemd/system/containerd.service.d" ]; then
50+
echo "containerd drop-in directory does not exist. Skipping"
51+
exit 0
52+
fi
53+
echo "Generating containerd system drop-in config for nofile limit"
54+
cat > "/host/etc/systemd/system/containerd.service.d/40-LimitNOFILE-infinity.conf" <<EOF
5155
[Service]
5256
LimitNOFILE=infinity
5357
EOF
@@ -57,4 +61,4 @@ spec:
5761
chroot /host systemctl restart containerd
5862
containers:
5963
- name: pause
60-
image: gke.gcr.io/pause:3.8
64+
image: gke.gcr.io/pause:3.8

0 commit comments

Comments
 (0)