forked from intel/cri-resource-manager
-
Notifications
You must be signed in to change notification settings - Fork 2
/
code.var.sh
99 lines (89 loc) · 3.59 KB
/
code.var.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
terminate cri-resmgr
cri_resmgr_cfg=${TEST_DIR}/balloons-numa.cfg launch cri-resmgr
# pod0: besteffort, make sure it still gets at least 1 CPU
CPUREQ="" CPULIM="" MEMREQ="" MEMLIM=""
CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod0c0"]) == 1'
# pod1: guaranteed, make sure it gets the CPU it requested.
# The configuration does not prefer creating new balloons,
# so pod0 and pod1 should be placed in the same balloon.
# Sum of their CPU requests is 1, so they should actually
# run on the same CPU.
CPUREQ="1" CPULIM="1" MEMREQ="50M" MEMLIM="50M"
CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod0c0"]) == 1' \
'len(cpus["pod1c0"]) == 1' \
'cpus["pod0c0"] == cpus["pod1c0"]'
# pod2: guaranteed, make sure it gets the CPU it requested.
CPUREQ="1" CPULIM="1" MEMREQ="50M" MEMLIM="50M"
CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod0c0"]) == 2' \
'len(cpus["pod1c0"]) == 2' \
'len(cpus["pod2c0"]) == 2' \
'cpus["pod0c0"] == cpus["pod1c0"] == cpus["pod2c0"]'
# pod3: guaranteed, make sure it gets the CPU it requested.
CPUREQ="1" CPULIM="1" MEMREQ="50M" MEMLIM="50M"
CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod0c0"]) == 3' \
'len(cpus["pod1c0"]) == 3' \
'len(cpus["pod2c0"]) == 3' \
'len(cpus["pod3c0"]) == 3' \
'cpus["pod0c0"] == cpus["pod1c0"] == cpus["pod2c0"] == cpus["pod3c0"]'
# pod4: guaranteed, fill up a balloon to the MaxCPU
CPUREQ="1" CPULIM="1" MEMREQ="50M" MEMLIM="50M"
CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod0c0"]) == 4' \
'len(cpus["pod1c0"]) == 4' \
'len(cpus["pod2c0"]) == 4' \
'len(cpus["pod3c0"]) == 4' \
'len(cpus["pod4c0"]) == 4' \
'cpus["pod0c0"] == cpus["pod1c0"] == cpus["pod2c0"] == cpus["pod3c0"] == cpus["pod4c0"]'
# pod5: besteffort, no CPU request, should fit into the full balloon
CPUREQ="" CPULIM="" MEMREQ="" MEMLIM=""
CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod0c0"]) == 4' \
'len(cpus["pod1c0"]) == 4' \
'len(cpus["pod2c0"]) == 4' \
'len(cpus["pod3c0"]) == 4' \
'len(cpus["pod4c0"]) == 4' \
'len(cpus["pod5c0"]) == 4' \
'cpus["pod0c0"] == cpus["pod1c0"] == cpus["pod2c0"] == cpus["pod3c0"] == cpus["pod4c0"] == cpus["pod5c0"]'
# pod6: guaranteed, start filling new balloon
CPUREQ="1" CPULIM="1" MEMREQ="50M" MEMLIM="50M"
CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod0c0"]) == 4' \
'len(cpus["pod1c0"]) == 4' \
'len(cpus["pod2c0"]) == 4' \
'len(cpus["pod3c0"]) == 4' \
'len(cpus["pod4c0"]) == 4' \
'len(cpus["pod5c0"]) == 4' \
'len(cpus["pod6c0"]) == 1' \
'cpus["pod0c0"] == cpus["pod1c0"] == cpus["pod2c0"] == cpus["pod3c0"] == cpus["pod4c0"]' \
'disjoint_sets(cpus["pod0c0"], cpus["pod6c0"])'
# Leave only one guaranteed container to the first balloon.
kubectl delete pods pod1 pod2 pod3 --now
report allowed
verify 'len(cpus["pod0c0"]) == 1' \
'len(cpus["pod4c0"]) == 1' \
'len(cpus["pod5c0"]) == 1' \
'len(cpus["pod6c0"]) == 1' \
'cpus["pod0c0"] == cpus["pod4c0"] == cpus["pod5c0"]' \
'disjoint_sets(cpus["pod0c0"], cpus["pod6c0"])'
# Leave only bestefforts to the first balloon. Make sure they still
# have a CPU.
kubectl delete pods pod4 --now
report allowed
verify 'len(cpus["pod0c0"]) == 1' \
'len(cpus["pod5c0"]) == 1' \
'len(cpus["pod6c0"]) == 1' \
'cpus["pod0c0"] == cpus["pod5c0"]' \
'disjoint_sets(cpus["pod0c0"], cpus["pod6c0"])'
terminate cri-resmgr
launch cri-resmgr