-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add simple tests to verify isolcpus allocation
Signed-off-by: Feruzjon Muyassarov <[email protected]>
- Loading branch information
1 parent
b2f1e06
commit 2478cf9
Showing
3 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
test/e2e/policies.test-suite/balloons/n4c16/test22-isolcpus/balloons-isolcpus.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
config: | ||
balloonTypes: | ||
- name: isolcpus | ||
minCPUs: 1 | ||
minBalloons: 1 | ||
preferIsolCpus: true | ||
namespaces: | ||
- isolcpus | ||
instrumentation: | ||
httpEndpoint: :8891 | ||
prometheusExport: true | ||
log: | ||
debug: | ||
- policy | ||
klog: | ||
skip_headers: true |
58 changes: 58 additions & 0 deletions
58
test/e2e/policies.test-suite/balloons/n4c16/test22-isolcpus/code.var.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
ns=isolcpus | ||
|
||
reboot-node() { | ||
vm-reboot | ||
timeout=3600 host-wait-vm-ssh-server $OUTPUT_DIR | ||
} | ||
|
||
restart-kubelet() { | ||
vm-command "systemctl restart kubelet" | ||
sleep 5 | ||
vm-wait-process --timeout 120 kube-apiserver | ||
vm-command "cilium status --wait --wait-duration=120s --interactive=false" | ||
} | ||
|
||
vm-command "grep isolcpus=0,1 /proc/cmdline" || { | ||
if [[ "$distro" == *fedora* ]]; then | ||
fedora-set-kernel-cmdline "isolcpus=0,1" | ||
else | ||
ubuntu-set-kernel-cmdline "isolcpus=0,1" | ||
fi | ||
reboot-node | ||
vm-command "grep isolcpus=0,1 /proc/cmdline" || { | ||
error "failed to set isolcpus kernel commandline parameter" | ||
} | ||
restart-kubelet | ||
} | ||
|
||
helm-terminate | ||
helm_config=${TEST_DIR}/balloons-isolcpus.cfg helm-launch balloons | ||
vm-command "kubectl create namespace $ns" | ||
|
||
# pod0: runs on system isolated CPUs | ||
CONTCOUNT=2 namespace="$ns" create balloons-busybox | ||
report allowed | ||
verify "cpus['pod0c0'] == {'cpu00', 'cpu01'}" | ||
|
||
# pod1: should run on non-isolated CPUs | ||
CONTCOUNT=1 namespace="$ns" create balloons-busybox | ||
report allowed | ||
verify "cpus['pod1c0'] != {'cpu00', 'cpu01'}" | ||
|
||
cleanup() { | ||
vm-command "kubectl delete namespace $ns" | ||
if [[ "$distro" == *fedora* ]]; then | ||
fedora-set-kernel-cmdline "" | ||
else | ||
ubuntu-set-kernel-cmdline "" | ||
fi | ||
reboot-node | ||
vm-command "grep -v isolcpus /proc/cmdline" | ||
if [ $? -ne 0 ]; then | ||
error "failed to unset isolcpus kernel commandline parameter" | ||
fi | ||
return 0 | ||
restart-kubelet | ||
} | ||
|
||
cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters