Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
Add port forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-farache committed Apr 25, 2022
1 parent 601e0db commit cf7a507
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# flotta-scale-tests
The purpose of this project is to test the scalability and performance of [project-flotta](https://github.com/project-flotta/flotta-operator) using [JMeter](https://jmeter.apache.org).

## Install OCP SNO cluster
Clone https://gitlab.cee.redhat.com/jgil/simple-openshift-cluster-provisioner
Run `CLUSTER_NAME=<cluster name> SNO_MASTER_MEMORY=<amount of memory in Mib> SNO_MASTER_CPU=<amount of CPU> make create_sno_cluster`.

Ex: `CLUSTER_NAME=devicemgmt1 SNO_MASTER_MEMORY=64000 SNO_MASTER_CPU=16 make create_sno_cluster`
## Configure K8S/OCP cluster
Follow https://metallb.universe.tf/installation/ to avoid having to create NodePort service to expose the flotta operator
See https://metallb.universe.tf/configuration/#layer-2-configuration. Use `kubectl get nodes -o` or `oc get nodes -o wide` to get the IP adress.

## Running the test plan
Use [./scripts/run_test_plan.sh](./scripts/run_test_plan.sh) to run the test plan.
The script will create the required resources on the cluster for running the test.
Expand Down
20 changes: 20 additions & 0 deletions scripts/run_test_plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,25 @@ fi
kubectl scale --replicas=$REPLICAS deployment flotta-operator-controller-manager -n flotta
kubectl wait --for=condition=available -n flotta deployment.apps/flotta-operator-controller-manager

PORT_FORWARDING_ALREADY_TAKEN=$(ps -eaf | grep "kubectl port-forward service/flotta-operator-controller-manager -n flotta $HTTP_SERVER_PORT --address 0.0.0.0" | wc -l)

if [ $PORT_FORWARDING_ALREADY_TAKEN -gt 2 ]; then
echo $'\n'"Target port ${HTTP_SERVER_PORT} for port-forward is already taken by another port-forward process"
exit 1
fi

echo "Forwarding port to 127.0.0.1"
kubectl port-forward service/flotta-operator-controller-manager -n flotta ${HTTP_SERVER_PORT} --address 0.0.0.0 &
export PORT_FORWARD_PID=$!
ps $PORT_FORWARD_PID
until [[ $? -eq 0 ]]
do
sleep 5
echo "Forwarding port to 127.0.0.1"
kubectl port-forward service/flotta-operator-controller-manager -n flotta ${HTTP_SERVER_PORT} --address 0.0.0.0 &
export PORT_FORWARD_PID=$!
ps $PORT_FORWARD_PID
done
count=0
export CERTS_FOLDER="${test_dir}/certs"
DEVICE_ID='default'
Expand Down Expand Up @@ -448,3 +467,4 @@ log_pods_details
run_test
log_pods_details
collect_results
kill $PORT_FORWARD_PID

0 comments on commit cf7a507

Please sign in to comment.