Skip to content

Commit

Permalink
e2e: add balloons container match expression tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub committed Feb 14, 2024
1 parent 92a936a commit 3b9fbf9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ metadata:
"; fi)
labels:
app: ${NAME}
$(if [ -n "$POD_LABEL" ]; then echo "
$POD_LABEL
"; fi)
spec:
containers:
$(for contnum in $(seq 1 ${CONTCOUNT}); do echo "
Expand Down
27 changes: 27 additions & 0 deletions test/e2e/policies.test-suite/balloons/match-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
config:
reservedResources:
cpu: 750m
pinCPU: true
pinMemory: true
idleCPUClass: normal
allocatorTopologyBalancing: true
balloonTypes:
- name: special
matchExpressions:
- key: pod/labels/app.kubernetes.io/component
operator: Equals
values: [ "precious" ]
minCPUs: 2
maxCPUs: 2
- name: default
namespaces:
- default
minCPUs: 1
maxCPUs: 1
allocatorPriority: normal
reservedPoolNamespaces:
- kube-system
log:
debug:
- policy
- expression
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Test placing containers with and without annotations to correct balloons
# reserved and shared CPUs.

helm-terminate
helm_config=${TEST_DIR}/../../match-config.yaml helm-launch balloons

cleanup() {
vm-command "kubectl delete pods --all --now"
return 0
}

cleanup

# pod0: run precious workload
POD_LABEL="app.kubernetes.io/component: precious" CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod0c0"]) == 2'

# pod1: run ordinary workload
CONTCOUNT=1 create balloons-busybox
report allowed
verify 'len(cpus["pod1c0"]) == 1'

cleanup

0 comments on commit 3b9fbf9

Please sign in to comment.