Skip to content

Commit

Permalink
e2e: test balloons memoryTypes option
Browse files Browse the repository at this point in the history
Signed-off-by: Antti Kervinen <[email protected]>
  • Loading branch information
askervin authored and klihub committed Nov 8, 2024
1 parent 0c18b44 commit 21c7171
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ config:
pinCPU: true
pinMemory: true
balloonTypes:
- name: two-cpu
- name: mem-types
minCPUs: 2
maxCPUs: 2
preferNewBalloons: true
memoryTypes:
- HBM
- PMEM

cpuClass: class4

- name: five-cpu
- name: no-mem-types
maxCPUs: 5
allocatorPriority: none
preferSpreadingPods: true
preferNewBalloons: true
cpuClass: class5

instrumentation:
httpEndpoint: ":8891"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ helm-terminate
helm_config=${TEST_DIR}/balloons-memory-types.cfg helm-launch balloons

cleanup() {
vm-command "kubectl delete pods -n kube-system pod0; kubectl delete pods --all --now"
vm-command "kubectl delete pods --all --now"
return 0
}

Expand All @@ -11,22 +11,28 @@ cleanup
# pod0: all memory combinations when there is enough memory.
# CPUREQ + CONTCOUNT causes ballooon inflation after 5 containers.
POD_ANNOTATION=()
POD_ANNOTATION[bln]="balloon.balloons.resource-policy.nri.io/container.pod0c0: two-cpu"
POD_ANNOTATION[0]="memory-type.resource-policy.nri.io/container.pod0c0: hbm"
POD_ANNOTATION[1]="memory-type.resource-policy.nri.io/container.pod0c1: dram"
POD_ANNOTATION[2]="memory-type.resource-policy.nri.io/container.pod0c2: pmem"
POD_ANNOTATION[3]="memory-type.resource-policy.nri.io/container.pod0c3: hbm,dram"
POD_ANNOTATION[4]="memory-type.resource-policy.nri.io/container.pod0c4: dram,pmem"
POD_ANNOTATION[5]="memory-type.resource-policy.nri.io/container.pod0c5: hbm,dram,pmem"
CPUREQ="200m" MEMREQ="300M" CPULIM="" MEMLIM="300M" CONTCOUNT=7 create balloons-busybox
# pod0c0 and pod0c6 go to the same balloon type and instance that has memoryTypes specified.
# pod0c0's annotation overrides balloon type's memoryTypes. This should be effective
# to pod0c0 only, while pod0c6 should get memory pinning according to the balloon.
POD_ANNOTATION[10]="balloon.balloons.resource-policy.nri.io/container.pod0c0: mem-types"
POD_ANNOTATION[16]="balloon.balloons.resource-policy.nri.io/container.pod0c6: mem-types"
POD_ANNOTATION[17]="balloon.balloons.resource-policy.nri.io/container.pod0c7: no-mem-types"
CPUREQ="200m" MEMREQ="300M" CPULIM="" MEMLIM="300M" CONTCOUNT=8 create balloons-busybox
report allowed
verify 'mems["pod0c0"] == {hbm0} if packages["pod0c0"] == {"package0"} else mems["pod0c0"] == {hbm1}' \
'mems["pod0c1"] == {dram0} if packages["pod0c1"] == {"package0"} else mems["pod0c1"] == {dram1}' \
'mems["pod0c2"] == {pmem0} if packages["pod0c2"] == {"package0"} else mems["pod0c2"] == {pmem1}' \
'mems["pod0c3"] == {hbm0,dram0} if packages["pod0c3"] == {"package0"} else mems["pod0c3"] == {hbm1,dram1}' \
'mems["pod0c4"] == {dram0,pmem0} if packages["pod0c4"] == {"package0"} else mems["pod0c4"] == {dram1,pmem1}' \
'mems["pod0c5"] == {hbm0,dram0,pmem0} if packages["pod0c5"] == {"package0"} else mems["pod0c5"] == {hbm1,dram1,pmem1}' \
'mems["pod0c6"] == {dram0} if packages["pod0c6"] == {"package0"} else mems["pod0c6"] == {dram1}'
'mems["pod0c6"] == {hbm0,pmem0} if packages["pod0c6"] == {"package0"} else mems["pod0c6"] == {hbm1,pmem1}' \
'mems["pod0c7"] == {dram0} if packages["pod0c7"] == {"package0"} else mems["pod0c7"] == {dram1}'

cleanup

Expand Down

0 comments on commit 21c7171

Please sign in to comment.