Skip to content

Commit

Permalink
Add script to find the limit for openshift.
Browse files Browse the repository at this point in the history
May be used as an example for other platforms.

Signed-off-by: Nadia Pinaeva <npinaeva@redhat.com>
  • Loading branch information
npinaeva committed Feb 26, 2024
1 parent 3f96697 commit aef24ec
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kube-burner-workload/openshift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
`kube-burner init -m ./openshift/metrics.yml -c ./network-policy.yaml -u https://$(oc get route prometheus-k8s -n openshift-monitoring -o jsonpath="{.spec.host}") --log-level=debug --token=$(oc create token prometheus-k8s -n openshift-monitoring)`
8. When the test finishes, metrics should be collected by the ES_SERVER

## Finding the limit

To automate finding the limit, [test_limit.sh](./test_limit.sh) script may be used.
It can run multiple iterations increasing the number of network policies until test fails.
It waits for full cleanup after every iteration to ensure the cluster is ready for the next one.

## Metrics and Dashboards

Expand Down
44 changes: 44 additions & 0 deletions kube-burner-workload/openshift/test_limit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

wait_cleanup () {
POD_NAMES=$(oc get pods -n openshift-ovn-kubernetes -l app=ovnkube-node -o jsonpath='{.items[*].metadata.name}')
FLOW_COUNT=0
for POD_NAME in ${POD_NAMES[@]}; do
POD_FLOW_COUNT=$(oc exec -n openshift-ovn-kubernetes $POD_NAME -c ovn-controller -- curl -s "127.0.0.1:29105/metrics"|grep ovs_vswitchd_bridge_flows_total|grep br-int|rev|cut -f1 -d' '|rev)
if [ $POD_FLOW_COUNT -gt $FLOW_COUNT ]; then
FLOW_COUNT=$POD_FLOW_COUNT
fi
done
echo $FLOW_COUNT

while [ $FLOW_COUNT -ge 10000 ]; do
FLOW_COUNT=0
for POD_NAME in ${POD_NAMES[@]}; do
POD_FLOW_COUNT=$(oc exec -n openshift-ovn-kubernetes $POD_NAME -c ovn-controller -- curl -s "127.0.0.1:29105/metrics"|grep ovs_vswitchd_bridge_flows_total|grep br-int|rev|cut -f1 -d' '|rev)
if [ $POD_FLOW_COUNT -gt $FLOW_COUNT ]; then
FLOW_COUNT=$POD_FLOW_COUNT
fi
done
echo $FLOW_COUNT
sleep 60
done
echo "shutdown succeeded"
}

PLATFORM=openshift
source ./env
NETPOLS_PER_NAMESPACE=50
STEP=50
expectedStatus=0
status=$expectedStatus
while [ $status -eq $expectedStatus ]; do
echo $NETPOLS_PER_NAMESPACE
wait_cleanup
kube-burner init -m ./metrics.yml -c ../network-policy.yaml -u https://$(oc get route prometheus-k8s -n openshift-monitoring -o jsonpath="{.spec.host}") --token=$(oc create token prometheus-k8s -n openshift-monitoring)
status=$?
if [ $STEP -eq 0 ]; then
echo "One iteration is finished"
exit 0
fi
NETPOLS_PER_NAMESPACE=$((NETPOLS_PER_NAMESPACE + STEP))
done

0 comments on commit aef24ec

Please sign in to comment.