Skip to content
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
12 changes: 12 additions & 0 deletions .github/workflows/reusable--e2e-test-jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ jobs:
- run: test "$ImageOS" = "$expected_image_os"
env:
expected_image_os: ${{ inputs.expected-image-os }}
# The pod memory limit applies to job containers only when they are under the pod cgroup.
- name: Test docker run creates the container under the pod cgroup
run: |
pod_cgroup="$(dirname "$(cut -d: -f3 /proc/self/cgroup)")"
cid="$(docker run -d debian:stable sleep 60)"
ls -d "/sys/fs/cgroup${pod_cgroup}/${cid}"
docker rm -f "$cid"

test-actions:
runs-on: ${{ inputs.runner-name }}
Expand Down Expand Up @@ -65,3 +72,8 @@ jobs:
- 8080:80
steps:
- run: curl -sf http://localhost:8080
- name: Test the service container is under the pod cgroup
run: |
pod_cgroup="$(dirname "$(cut -d: -f3 /proc/self/cgroup)")"
cid="$(docker ps -q --no-trunc --filter ancestor=nginx:stable)"
ls -d "/sys/fs/cgroup${pod_cgroup}/${cid}"
14 changes: 13 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
#!/bin/bash
sudo /usr/bin/dockerd --log-level warn &

dockerd_args=(--log-level warn)

# The runner container sees the cgroup tree of the node.
# dockerd would create the cgroups of job containers at the root of the node,
# so the pod memory limit would not apply to them.
# Put them under the pod cgroup, so that the pod limit applies to them.
pod_cgroup="$(dirname "$(cut -d: -f3 /proc/self/cgroup)")"
if [[ -f /sys/fs/cgroup/cgroup.controllers && "$pod_cgroup" == *kubepods* ]]; then
dockerd_args+=(--cgroup-parent "$pod_cgroup")
fi

sudo /usr/bin/dockerd "${dockerd_args[@]}" &
exec "$@"
Loading