Skip to content

Commit

Permalink
On cgroup v1 systems, assume hybrid setup and try /sys/fs/cgroup/unif…
Browse files Browse the repository at this point in the history
…ied.
  • Loading branch information
adelton committed Mar 20, 2024
1 parent afd19e0 commit 930a746
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/freeipa-k3s.yaml.cgroups-v1.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
mountPath: /data
+ - name: cgroups
+ mountPath: /sys/fs/cgroup
+ readOnly: true
+ readOnly: false
ports:
- containerPort: 80
protocol: TCP
Expand All @@ -16,4 +16,4 @@
claimName: freeipa-data-pvc
+ - name: cgroups
+ hostPath:
+ path: /sys/fs/cgroup
+ path: /sys/fs/cgroup/unified
4 changes: 2 additions & 2 deletions tests/freeipa-k3s.yaml.shm.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@@ -66,6 +66,8 @@
- name: cgroups
mountPath: /sys/fs/cgroup
readOnly: true
readOnly: false
+ - mountPath: /dev/shm
+ name: dshm
ports:
Expand All @@ -12,7 +12,7 @@
@@ -104,3 +106,6 @@
- name: cgroups
hostPath:
path: /sys/fs/cgroup
path: /sys/fs/cgroup/unified
+ - name: dshm
+ emptyDir:
+ medium: Memory
6 changes: 3 additions & 3 deletions tests/freeipa-replica-k3s.yaml.cgroups-v1.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--- tests/freeipa-replica-k3s.yaml
+++ tests/freeipa-replica-k3s.yaml
@@ -77,6 +77,9 @@ spec:
@@ -77,6 +77,8 @@ spec:
volumeMounts:
- name: freeipa-server-data
mountPath: /data
+ - name: cgroups
+ mountPath: /sys/fs/cgroup
+ readOnly: true
+ readOnly: false
ports:
- containerPort: 80
protocol: TCP
Expand All @@ -16,4 +16,4 @@
claimName: freeipa-replica-pvc
+ - name: cgroups
+ hostPath:
+ path: /sys/fs/cgroup
+ path: /sys/fs/cgroup/unified
6 changes: 5 additions & 1 deletion tests/run-master-and-replica.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ function run_ipa_container() {
fi
else
# cgroup v1
OPTS="-v /sys/fs/cgroup:/sys/fs/cgroup:ro"
if [ -e /sys/fs/cgroup/unified ] ; then
OPTS="-v /sys/fs/cgroup/unified:/sys/fs/cgroup:rw"
else
OPTS="-v /sys/fs/cgroup:/sys/fs/cgroup:ro"
fi
fi
OPTS="$OPTS --sysctl net.ipv6.conf.all.disable_ipv6=0"
fi
Expand Down
7 changes: 6 additions & 1 deletion tests/run-partial-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ function run_and_wait_for () {
:
fi
else
OPTS="$OPTS -v /sys/fs/cgroup:/sys/fs/cgroup:ro"
# cgroup v1
if [ -e /sys/fs/cgroup/unified ] ; then
OPTS="$OPTS -v /sys/fs/cgroup/unified:/sys/fs/cgroup:rw"
else
OPTS="$OPTS -v /sys/fs/cgroup:/sys/fs/cgroup:ro"
fi
fi
fi
if [ -n "$seccomp" ] ; then
Expand Down

0 comments on commit 930a746

Please sign in to comment.