diff options
author | Remigiusz Janeczek <remigiusz.janeczek@nokia.com> | 2020-03-31 15:02:46 +0200 |
---|---|---|
committer | Remigiusz Janeczek <remigiusz.janeczek@nokia.com> | 2020-04-07 13:26:37 +0000 |
commit | ee3dc0ec60a6b425904f41ddd96b5925cba7e1aa (patch) | |
tree | 387df4971a4bbbe449e9dc2779ef413f23f3b545 | |
parent | bec3214db2fa5bf42b776ceda7ea56a492ca3c9a (diff) |
Update performance test cloud scripts
Update kafka commands
Use new path for test certs as the previous is already utilized
by other certs.
Update docker images repository.
Change consul request to be performed internally for cases when
consul is not available externally.
Issue-ID: DCAEGEN2-1576
Change-Id: I7ca38739875b5f0ad7e4eac600508602eea4adb6
Signed-off-by: Remigiusz Janeczek <remigiusz.janeczek@nokia.com>
-rwxr-xr-x | tools/performance/cloud/cloud-based-performance-test.sh | 48 | ||||
-rwxr-xr-x | tools/performance/cloud/configure-consul.sh | 24 | ||||
-rwxr-xr-x | tools/performance/cloud/consumer-deployment.yaml | 4 | ||||
-rwxr-xr-x | tools/performance/cloud/reboot-test-environment.sh | 6 | ||||
-rwxr-xr-x | tools/ssl/gen-certs.sh | 2 |
5 files changed, 47 insertions, 37 deletions
diff --git a/tools/performance/cloud/cloud-based-performance-test.sh b/tools/performance/cloud/cloud-based-performance-test.sh index 1b5f1f90..256a385f 100755 --- a/tools/performance/cloud/cloud-based-performance-test.sh +++ b/tools/performance/cloud/cloud-based-performance-test.sh @@ -37,12 +37,12 @@ CHECK_NUMBER=0 PRODUCERS_TO_RECREATE=0 NAME_REASON_PATTERN="custom-columns=NAME:.metadata.name,REASON:.status.containerStatuses[].state.waiting.reason" HVVES_POD_NAME=$(kubectl -n ${ONAP_NAMESPACE} get pods --no-headers=true -o custom-columns=:metadata.name | grep hv-ves-collector) -HVVES_CERT_PATH=/etc/ves-hv/ssl/ +HVVES_CERT_PATH=/etc/ves-hv/ssl/server KAFKA_RETENTION_TIME_MINUTES=60 MILISECONDS_IN_MINUTE=60000 CALC_RETENTION_TIME_IN_MS_CMD='expr $KAFKA_RETENTION_TIME_MINUTES \* $MILISECONDS_IN_MINUTE' KAFKA_ROUTER_0_POD_NAME=$(kubectl -n ${ONAP_NAMESPACE} get pods --no-headers=true -o custom-columns=:metadata.name | grep router-kafka-0) -KAFKA_SET_TOPIC_RETENTION_TIME_CMD='kafka-topics.sh --zookeeper message-router-zookeeper:2181 --alter --topic HV_VES_PERF3GPP --config retention.ms=' +KAFKA_SET_TOPIC_RETENTION_TIME_CMD='kafka-topics --zookeeper message-router-zookeeper:2181 --alter --topic HV_VES_PERF3GPP --config retention.ms=' HIDE_OUTPUT='grep abc | grep 123' function clean() { @@ -85,12 +85,19 @@ function clean() { } function copy_certs_to_hvves() { - cd ../../ssl - for file in {trust.p12,trust.pass,server.p12,server.pass} - do - echo "Copying file: ${file}" - kubectl cp ${file} ${ONAP_NAMESPACE}/${HVVES_POD_NAME}:${HVVES_CERT_PATH} - done + cd ../../ssl + echo "Attempting to create certs directory in HV-VES" + kubectl exec -n ${ONAP_NAMESPACE} ${HVVES_POD_NAME} 'mkdir' ${HVVES_CERT_PATH} + for file in {trust.p12,trust.pass,server.p12,server.pass} + do + echo "Copying file: ${file}" + kubectl cp ${file} ${ONAP_NAMESPACE}/${HVVES_POD_NAME}:${HVVES_CERT_PATH} + done +} + +function set_kafka_retention_time() { + echo "Setting message retention time" + kubectl exec -it ${KAFKA_ROUTER_0_POD_NAME} -n ${ONAP_NAMESPACE} -- ${KAFKA_SET_TOPIC_RETENTION_TIME_CMD}$(eval $CALC_RETENTION_TIME_IN_MS_CMD) | eval $HIDE_OUTPUT } function create_producers() { @@ -115,14 +122,14 @@ function generate_certs() { } function handle_backoffs() { - IMAGE_PULL_BACK_OFFS=$(kubectl get pods -l app=${PRODUCER_APPS_LABEL} -n ${ONAP_NAMESPACE} -o ${NAME_REASON_PATTERN} | grep -c "ImagePullBackOff \| ErrImagePull") - if [[ ${IMAGE_PULL_BACK_OFFS} -gt 0 ]]; then - CHECK_NUMBER=$((CHECK_NUMBER + 1)) - if [[ ${CHECK_NUMBER} -gt ${MAXIMUM_BACK_OFF_CHECK_ITERATIONS} ]]; then - echo "Error: Image pull problem" - exit 1 - fi + IMAGE_PULL_BACK_OFFS=$(kubectl get pods -l app=${PRODUCER_APPS_LABEL} -n ${ONAP_NAMESPACE} -o ${NAME_REASON_PATTERN} | grep -c "ImagePullBackOff \| ErrImagePull") + if [[ ${IMAGE_PULL_BACK_OFFS} -gt 0 ]]; then + CHECK_NUMBER=$((CHECK_NUMBER + 1)) + if [[ ${CHECK_NUMBER} -gt ${MAXIMUM_BACK_OFF_CHECK_ITERATIONS} ]]; then + echo "Error: Image pull problem" + exit 1 fi + fi } function handle_key_interrupt() { @@ -155,7 +162,7 @@ function usage() { echo " --load : should test keep defined containers number till script interruption (false)" echo " --containers : number of producer containers to create (1)" echo " --properties-file : path to file with benchmark properties (./test.properties)" - echo " --retention-time-minutes : messages retention time on kafka in minutes - only for load tests (60)" + echo " --retention-time-minutes : messages retention time on kafka in minutes (60)" echo " clean : remove ConfigMap, HV-VES consumers and producers" echo " help : print usage" echo "Example invocations:" @@ -223,8 +230,7 @@ function setup_environment() { function start_load_tests() { print_test_setup_info - echo "Setting message retention time" - kubectl exec -it ${KAFKA_ROUTER_0_POD_NAME} -n ${ONAP_NAMESPACE} -- ${KAFKA_SET_TOPIC_RETENTION_TIME_CMD}$(eval $CALC_RETENTION_TIME_IN_MS_CMD) | eval $HIDE_OUTPUT + set_kafka_retention_time echo "CTRL + C to stop/interrupt this script" create_producers @@ -258,13 +264,15 @@ function start_load_tests() { function start_performance_test() { print_test_setup_info + set_kafka_retention_time + create_producers echo "Waiting for producers completion" while :; do COMPLETED_PRODUCERS=$(kubectl get pods -l app=${PRODUCER_APPS_LABEL} -n ${ONAP_NAMESPACE} | grep -c "Completed") handle_backoffs - + [[ ${COMPLETED_PRODUCERS} -eq ${CONTAINERS_COUNT} || ${CHECK_NUMBER} -gt ${MAXIMUM_BACK_OFF_CHECK_ITERATIONS} ]] && break sleep 1 done @@ -330,4 +338,4 @@ else ;; esac done -fi
\ No newline at end of file +fi diff --git a/tools/performance/cloud/configure-consul.sh b/tools/performance/cloud/configure-consul.sh index 3ab298e8..1465a5ff 100755 --- a/tools/performance/cloud/configure-consul.sh +++ b/tools/performance/cloud/configure-consul.sh @@ -18,15 +18,17 @@ # ============LICENSE_END========================================================= SSL=$1 +CERT_PATH=/etc/ves-hv/ssl +ONAP_NAMESPACE=onap if [ "$SSL" != "true" ] && [ "$SSL" != "false" ] ; then SSL=true +elif [ "$SSL" = "false" ] ; then + CERT_PATH=/etc/ves-hv/ssl/server fi -IP=$(kubectl config view -o jsonpath='{.clusters[].cluster.server}') -HTTPS="https://" -IP=${IP[@]//${HTTPS}} -IP=${IP[@]//:*} -STATUS=$(curl -s --header "Content-Type: application/json" \ +HVVES_POD_NAME=$(kubectl -n ${ONAP_NAMESPACE} get pods --no-headers=true -o custom-columns=:metadata.name | grep hv-ves-collector) + +STATUS=$(kubectl exec -n onap ${HVVES_POD_NAME} --container=dcae-hv-ves-collector -- curl -s --header "Content-Type: application/json" \ --request PUT \ --data '{"security.sslDisable": '${SSL}', "logLevel": "INFO", @@ -46,11 +48,11 @@ STATUS=$(curl -s --header "Content-Type: application/json" \ } } }, -"security.keys.trustStoreFile": "/etc/ves-hv/ssl/trust.p12", -"security.keys.keyStoreFile": "/etc/ves-hv/ssl/server.p12", -"security.keys.trustStorePasswordFile":"/etc/ves-hv/ssl/trust.pass", -"security.keys.keyStorePasswordFile": "/etc/ves-hv/ssl/server.pass"}' \ -${IP}:30270/v1/kv/dcae-hv-ves-collector?dc=dc1&token=) +"security.keys.trustStoreFile": "'${CERT_PATH}'/trust.p12", +"security.keys.keyStoreFile": "'${CERT_PATH}'/server.p12", +"security.keys.trustStorePasswordFile":"'${CERT_PATH}'/trust.pass", +"security.keys.keyStorePasswordFile": "'${CERT_PATH}'/server.pass"}' \ +consul-server.onap:8500/v1/kv/dcae-hv-ves-collector?dc=dc1&token=) if [ "$STATUS" = "true" ] ; then if [ "$SSL" = "true" ] ; then @@ -58,4 +60,4 @@ if [ "$STATUS" = "true" ] ; then else echo "SSL turned on" fi -fi
\ No newline at end of file +fi diff --git a/tools/performance/cloud/consumer-deployment.yaml b/tools/performance/cloud/consumer-deployment.yaml index 179f246c..c0692ca3 100755 --- a/tools/performance/cloud/consumer-deployment.yaml +++ b/tools/performance/cloud/consumer-deployment.yaml @@ -42,7 +42,7 @@ spec: spec: containers: - name: kafka-consumer-counting - image: nexus3.dyn.nesc.nokia.net:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-kafka-consumer:latest + image: nexus.onap.dyn.nesc.nokia.net:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-kafka-consumer:latest ports: - containerPort: 8080 env: @@ -86,7 +86,7 @@ spec: spec: containers: - name: kafka-processing-consumer - image: nexus3.dyn.nesc.nokia.net:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-kafka-consumer:latest + image: nexus.onap.dyn.nesc.nokia.net:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-kafka-consumer:latest ports: - containerPort: 8080 env: diff --git a/tools/performance/cloud/reboot-test-environment.sh b/tools/performance/cloud/reboot-test-environment.sh index 5f13cb25..f2dedf50 100755 --- a/tools/performance/cloud/reboot-test-environment.sh +++ b/tools/performance/cloud/reboot-test-environment.sh @@ -20,9 +20,9 @@ ONAP_NAMESPACE=onap HVVES_POD_NAME=$(kubectl -n ${ONAP_NAMESPACE} get pods --no-headers=true -o custom-columns=:metadata.name | grep hv-ves-collector) HVVES_CONTAINER_NAME=dep-dcae-hv-ves-collector -HV_VES_IMAGE="nexus3.dyn.nesc.nokia.net:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main:latest" +HV_VES_IMAGE="nexus.onap.dyn.nesc.nokia.net:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main:latest" KAFKA_ROUTER_0_POD_NAME=$(kubectl -n ${ONAP_NAMESPACE} get pods --no-headers=true -o custom-columns=:metadata.name | grep router-kafka-0) -KAFKA_TOPIC_RESET_CMD='kafka-topics.sh --delete --zookeeper message-router-zookeeper:2181 --topic HV_VES_PERF3GPP' +KAFKA_TOPIC_RESET_CMD='kafka-topics --delete --zookeeper message-router-zookeeper:2181 --topic HV_VES_PERF3GPP' HIDE_OUTPUT='grep abc | grep 123' YELLOW=$(tput setaf 3) GREEN=$(tput setaf 2) @@ -146,4 +146,4 @@ else ;; esac done -fi
\ No newline at end of file +fi diff --git a/tools/ssl/gen-certs.sh b/tools/ssl/gen-certs.sh index bf28ca02..628906d3 100755 --- a/tools/ssl/gen-certs.sh +++ b/tools/ssl/gen-certs.sh @@ -48,7 +48,7 @@ function gen_key() { function gen_ca() { local ca="$1" - keytool -genkeypair ${store_opts} -alias ${ca} -dname "${DNAME_PREFIX}-${ca}" -keystore ${ca}.p12 + keytool -genkeypair ${store_opts} -alias ${ca} -dname "${DNAME_PREFIX}-${ca}" -keystore ${ca}.p12 -ext bc:c keytool -export -alias ${ca} -file ${ca}.crt ${store_opts} -keystore ${ca}.p12 } |