From cf7a507ace314168ddff4695b162462d466fdaef Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Mon, 25 Apr 2022 13:05:21 +0200 Subject: [PATCH] Add port forwarding --- README.md | 9 +++++++++ scripts/run_test_plan.sh | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/README.md b/README.md index 830e9a1..cc4e2e4 100644 --- a/README.md +++ b/README.md @@ -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= SNO_MASTER_MEMORY= SNO_MASTER_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. diff --git a/scripts/run_test_plan.sh b/scripts/run_test_plan.sh index c85e1c8..0ea7100 100755 --- a/scripts/run_test_plan.sh +++ b/scripts/run_test_plan.sh @@ -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' @@ -448,3 +467,4 @@ log_pods_details run_test log_pods_details collect_results +kill $PORT_FORWARD_PID