@@ -6,50 +6,25 @@ cleanup() {
66cleanup
77helm_config=${TEST_DIR} /balloons-nrt.cfg helm-launch balloons
88
9- export get_nrt=" kubectl get noderesourcetopologies.topology.node.k8s.io \$ (hostname)"
10-
11- verify-zone-attribute () {
12- local zone_name=$1
13- local attribute_name=$2
14- local expected_value_re=$3
15- echo " "
16- echo " ### Verifying topology zone $zone_name attribute $attribute_name value matches $expected_value_re "
17- vm-command " $get_nrt -o json | jq -r '.zones[] | select (.name == \" $zone_name \" ).attributes[] | select(.name == \" $attribute_name \" ).value'"
18- [[ " $COMMAND_OUTPUT " =~ $expected_value_re ]] ||
19- command-error " expected zone $zone_name attribute $attribute_name value $expected_value , got: $COMMAND_OUTPUT "
20- }
21-
22- verify-zone-resource () {
23- local zone_name=$1
24- local resource_name=$2
25- local resource_field=$3
26- local expected_value=$4
27- echo " "
28- echo " ### Verifying topology zone $zone_name resource $resouce_name field $resource_field equals $expected_value "
29- vm-command " $get_nrt -o json | jq -r '.zones[] | select (.name == \" $zone_name \" ).resources[] | select(.name == \" $resource_name \" ).$resource_field '"
30- [[ " $COMMAND_OUTPUT " == " $expected_value " ]] ||
31- command-error " expected zone $zone_name resource $resource_name .$resource_field $expected_value , got: $COMMAND_OUTPUT "
32- }
33-
349# Print full NRT yaml for debugging
35- vm-command " $get_nrt -o yaml"
10+ vm-command " $nrt_kubectl_get -o yaml"
3611
3712# Verify zones when fullsocket balloons do not include containers.
38- verify-zone-attribute " fullsocket[0]" " cpuset" " [4567]"
39- verify-zone-attribute " fullsocket[0]" " shared cpuset" " 5-7|4,6-7|4-5,7|4-6"
40- verify-zone-attribute " fullsocket[0]" " excess cpus" " 1"
41- verify-zone-attribute " fullsocket[1]" " cpuset" " 0|1"
42- verify-zone-attribute " fullsocket[1]" " shared cpuset" " 1-2|0,2"
43- verify-zone-attribute " fullsocket[1]" " excess cpus" " 1"
44- verify-zone-attribute " reserved[0]" " cpuset" " 3"
45- verify-zone-attribute " reserved[0]" " shared cpuset" " ^\$ "
46-
47- verify-zone-resource " reserved[0]" " cpu" " capacity" " 8"
48- verify-zone-resource " reserved[0]" " cpu" " allocatable" " 6"
49- verify-zone-resource " fullsocket[0]" " cpu" " allocatable" " 4"
50- verify-zone-resource " fullsocket[0]" " cpu" " available" " 4"
51- verify-zone-resource " fullsocket[1]" " cpu" " allocatable" " 4"
52- verify-zone-resource " fullsocket[1]" " cpu" " available" " 4"
13+ nrt- verify-zone-attribute " fullsocket[0]" " cpuset" " [4567]"
14+ nrt- verify-zone-attribute " fullsocket[0]" " shared cpuset" " 5-7|4,6-7|4-5,7|4-6"
15+ nrt- verify-zone-attribute " fullsocket[0]" " excess cpus" " 1"
16+ nrt- verify-zone-attribute " fullsocket[1]" " cpuset" " 0|1"
17+ nrt- verify-zone-attribute " fullsocket[1]" " shared cpuset" " 1-2|0,2"
18+ nrt- verify-zone-attribute " fullsocket[1]" " excess cpus" " 1"
19+ nrt- verify-zone-attribute " reserved[0]" " cpuset" " 3"
20+ nrt- verify-zone-attribute " reserved[0]" " shared cpuset" " ^\$ "
21+
22+ nrt- verify-zone-resource " reserved[0]" " cpu" " capacity" " 8"
23+ nrt- verify-zone-resource " reserved[0]" " cpu" " allocatable" " 6"
24+ nrt- verify-zone-resource " fullsocket[0]" " cpu" " allocatable" " 4"
25+ nrt- verify-zone-resource " fullsocket[0]" " cpu" " available" " 4"
26+ nrt- verify-zone-resource " fullsocket[1]" " cpu" " allocatable" " 4"
27+ nrt- verify-zone-resource " fullsocket[1]" " cpu" " available" " 4"
5328
5429# Create burstable containers without CPU limits
5530CPUREQ=" 750m" MEMREQ=" 100M" CPULIM=" " MEMLIM=" 500M"
@@ -58,28 +33,28 @@ POD_ANNOTATION='cpu.preserve.resource-policy.nri.io/container.pod0c1: "true"
5833CONTCOUNT=3 create balloons-busybox
5934
6035# Print full NRT yaml for debugging
61- vm-command " $get_nrt -o yaml"
36+ vm-command " $nrt_kubectl_get -o yaml"
6237
6338# Verify selected zone attributes
64- verify-zone-resource " default/pod0/pod0c0" " cpu" " capacity" " 4" # balloon's + shared CPUs
65- verify-zone-resource " default/pod0/pod0c0" " cpu" " allocatable" " 750m" # requested CPUs
66- verify-zone-resource " default/pod0/pod0c0" " cpu" " available" " 0" # nothing available on the subzone
67- verify-zone-attribute " default/pod0/pod0c0" " cpuset" " 4-7"
68- verify-zone-attribute " default/pod0/pod0c0" " memory set" " 1"
39+ nrt- verify-zone-resource " default/pod0/pod0c0" " cpu" " capacity" " 4" # balloon's + shared CPUs
40+ nrt- verify-zone-resource " default/pod0/pod0c0" " cpu" " allocatable" " 750m" # requested CPUs
41+ nrt- verify-zone-resource " default/pod0/pod0c0" " cpu" " available" " 0" # nothing available on the subzone
42+ nrt- verify-zone-attribute " default/pod0/pod0c0" " cpuset" " 4-7"
43+ nrt- verify-zone-attribute " default/pod0/pod0c0" " memory set" " 1"
6944
70- verify-zone-resource " default/pod0/pod0c1" " cpu" " capacity" " " # preserve => container should not exist, not assigned into any balloon
45+ nrt- verify-zone-resource " default/pod0/pod0c1" " cpu" " capacity" " " # preserve => container should not exist, not assigned into any balloon
7146
72- verify-zone-resource " default/pod0/pod0c2" " cpu" " capacity" " 4" # expect same balloon as pod0c0
73- verify-zone-resource " default/pod0/pod0c2" " cpu" " allocatable" " 750m"
74- verify-zone-attribute " default/pod0/pod0c2" " memory set" " ^\$ " # preserve memory
47+ nrt- verify-zone-resource " default/pod0/pod0c2" " cpu" " capacity" " 4" # expect same balloon as pod0c0
48+ nrt- verify-zone-resource " default/pod0/pod0c2" " cpu" " allocatable" " 750m"
49+ nrt- verify-zone-attribute " default/pod0/pod0c2" " memory set" " ^\$ " # preserve memory
7550
7651# Create burstable containers with CPU limits
7752CPUREQ=" 200m" MEMREQ=" 100M" CPULIM=" 1500m" MEMLIM=" 500M"
7853POD_ANNOTATION=' '
7954CONTCOUNT=2 create balloons-busybox
8055
8156# Print full NRT yaml for debugging
82- vm-command " $get_nrt -o yaml"
57+ vm-command " $nrt_kubectl_get -o yaml"
8358
84- verify-zone-resource " default/pod1/pod1c0" " cpu" " capacity" " 1500m" # limit < allowed cpus
85- verify-zone-attribute " default/pod1/pod1c0" " cpuset" " 0-2" # expected fullsocket[1]
59+ nrt- verify-zone-resource " default/pod1/pod1c0" " cpu" " capacity" " 1500m" # limit < allowed cpus
60+ nrt- verify-zone-attribute " default/pod1/pod1c0" " cpuset" " 0-2" # expected fullsocket[1]
0 commit comments