-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/e2e: add topology-aware allocation priority test.
Add tests for allocating CPUs for containers with annotated CPU allocation priority. Signed-off-by: Krisztian Litkey <[email protected]>
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
55 changes: 55 additions & 0 deletions
55
test/e2e/policies.test-suite/topology-aware/n4c16/test08-cpuprio-allocation/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,55 @@ | ||
# Test that guaranteed and burstable pods get the CPUs they require | ||
# when there are enough CPUs available. | ||
|
||
# Override CPU type detection, to detect 2 low-power CPUs | ||
helm-terminate | ||
EXTRA_ENV_OVERRIDE_SYS_ATOM_CPUS="4-5" helm_config=$(instantiate helm-config.yaml) helm-launch topology-aware | ||
|
||
# pod0 | ||
# 3 containers, one with normal CPU preference, two with low-prio CPU. | ||
ANN0="prefer-cpu-priority.resource-policy.nri.io/container.pod0c0: low" | ||
ANN2="prefer-cpu-priority.resource-policy.nri.io/container.pod0c2: low" | ||
CONTCOUNT=3 CPU=1 create guaranteed | ||
report allowed | ||
|
||
verify \ | ||
'cpus["pod0c0"] == {"cpu04"}' \ | ||
'cpus["pod0c1"] not in [ {"cpu04"}, {"cpu05"} ]' \ | ||
'cpus["pod0c2"] == {"cpu05"}' | ||
|
||
vm-command "kubectl delete pods --all --now" | ||
|
||
# Override CPU type detection, to detect 3 high-perf CPUs (one extra | ||
# for the reserved CPU allocation for which we currently always prefer | ||
# normal prio CPUs). | ||
helm-terminate | ||
EXTRA_ENV_OVERRIDE_SYS_CORE_CPUS="0-1,4-5" helm_config=$(instantiate helm-config.yaml) helm-launch topology-aware | ||
|
||
# pod1 | ||
# 3 containers, default with low-prio CPU preference, two with high-prio CPU. | ||
ANN0="prefer-cpu-priority.resource-policy.nri.io/pod: low" | ||
ANN0="prefer-cpu-priority.resource-policy.nri.io/container.pod1c0: high" | ||
ANN2="prefer-cpu-priority.resource-policy.nri.io/container.pod1c2: high" | ||
CONTCOUNT=3 CPU=1 create guaranteed | ||
report allowed | ||
|
||
# cpu00 will be allocated for the reserved pool. Our two high-prio | ||
# containers should first take cpu04 (preferred NUMA node with fewer | ||
# containers, lower of the available normal prio cpu04-cpu-5), then | ||
# should take cpu01 (lower ID of NUMA nodes with equal score). The | ||
# low-prio container in between should take some other CPU that | ||
# cpu1,4,5. | ||
# | ||
# However, the only CPU allocation detail of interest here is that | ||
# we want normal prio CPUs (in the lack of high-prio ones) for our | ||
# containers annotated with high-prio CPU preference. So only check | ||
# for that instead of pretending to both understand and remember | ||
# all the various preference details of the allocation pool selection | ||
# and allocation logic. | ||
|
||
verify \ | ||
'cpus["pod1c0"] in [ {"cpu01"}, {"cpu04"}, {"cpu05"} ]' \ | ||
'cpus["pod1c1"] not in [ {"cpu01"}, {"cpu04"}, {"cpu05"} ]' \ | ||
'cpus["pod1c2"] in [ {"cpu01"}, {"cpu04"}, {"cpu05"} ]' \ | ||
|
||
vm-command "kubectl delete pods --all --now" |