diff --git a/test/e2e/policies.test-suite/balloons/balloons-busybox.yaml.in b/test/e2e/policies.test-suite/balloons/balloons-busybox.yaml.in index 8bc86de3e..41413bf9c 100644 --- a/test/e2e/policies.test-suite/balloons/balloons-busybox.yaml.in +++ b/test/e2e/policies.test-suite/balloons/balloons-busybox.yaml.in @@ -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 " diff --git a/test/e2e/policies.test-suite/balloons/match-config.yaml b/test/e2e/policies.test-suite/balloons/match-config.yaml new file mode 100644 index 000000000..29d68649e --- /dev/null +++ b/test/e2e/policies.test-suite/balloons/match-config.yaml @@ -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 diff --git a/test/e2e/policies.test-suite/balloons/n4c16/test11-match-expression/code.var.sh b/test/e2e/policies.test-suite/balloons/n4c16/test11-match-expression/code.var.sh new file mode 100644 index 000000000..70b065532 --- /dev/null +++ b/test/e2e/policies.test-suite/balloons/n4c16/test11-match-expression/code.var.sh @@ -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