-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #278 from askervin/5Tk_balloons_groupby_stacked
balloons: implement groupBy option
- Loading branch information
Showing
10 changed files
with
166 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
test/e2e/policies.test-suite/balloons/n4c16/test04-groupby/balloons-groupby.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
config: | ||
balloonTypes: | ||
- name: grouped-by-label | ||
groupBy: ${pod/namespace}-${pod/labels/balloon-instance} | ||
minCPUs: 2 | ||
minBalloons: 2 | ||
preferNewBalloons: true | ||
- name: default | ||
groupBy: ns=$pod/namespace | ||
preferNewBalloons: true | ||
instrumentation: | ||
httpEndpoint: :8891 | ||
prometheusExport: true | ||
log: | ||
debug: | ||
- policy | ||
klog: | ||
skip_headers: true |
62 changes: 62 additions & 0 deletions
62
test/e2e/policies.test-suite/balloons/n4c16/test04-groupby/code.var.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# This test verifies that the groupby expression in a balloon type | ||
# affects grouping containers into balloon instances of that type. | ||
|
||
helm-terminate | ||
helm_config=$TEST_DIR/balloons-groupby.cfg helm-launch balloons | ||
|
||
testns=e2e-balloons-test04 | ||
|
||
cleanup() { | ||
vm-command "kubectl delete pods --all --now; \ | ||
kubectl delete pods -n $testns --all --now; \ | ||
kubectl delete namespace $testns; \ | ||
true" | ||
} | ||
|
||
cleanup | ||
|
||
POD_ANNOTATION="balloon.balloons.resource-policy.nri.io: grouped-by-label" | ||
# pod0c0 | ||
POD_LABEL='balloon-instance: g1' | ||
create balloons-busybox | ||
|
||
# pod1c0 | ||
POD_LABEL='balloon-instance: g2' | ||
create balloons-busybox | ||
|
||
# pod2c0 | ||
POD_LABEL='balloon-instance: g1' | ||
create balloons-busybox | ||
|
||
# pod3c0 | ||
POD_LABEL='balloon-instance: g1' | ||
vm-command "kubectl create namespace $testns" | ||
namespace=$testns create balloons-busybox | ||
report allowed | ||
|
||
verify 'cpus["pod0c0"] == cpus["pod2c0"]' \ | ||
'disjoint_sets(cpus["pod0c0"], cpus["pod1c0"], cpus["pod3c0"])' | ||
|
||
# Test that pods are grouped by namespaces in separate default | ||
# balloon instances. | ||
POD_ANNOTATION="" | ||
# pod4c0 | ||
namespace=$testns create balloons-busybox | ||
# pod5c0 | ||
create balloons-busybox | ||
# pod6c0 | ||
create balloons-busybox | ||
# pod7c0 | ||
namespace=$testns create balloons-busybox | ||
report allowed | ||
verify 'cpus["pod4c0"] == cpus["pod7c0"]' \ | ||
'cpus["pod5c0"] == cpus["pod6c0"]' \ | ||
'disjoint_sets(cpus["pod4c0"], cpus["pod5c0"])' | ||
|
||
verify-metrics-has-line 'groups="e2e-balloons-test04-g1"' | ||
verify-metrics-has-line 'groups="default-g2"' | ||
verify-metrics-has-line 'groups="default-g1"' | ||
|
||
cleanup | ||
|
||
helm-terminate |