From b373b4f0e193b84908f1671202a39e20c09a2a47 Mon Sep 17 00:00:00 2001 From: kjaniak Date: Tue, 30 Jul 2019 09:32:56 +0200 Subject: Add Prometheus deployment for HV-VES performance tests - cloud Script for cloud is updated with proper prometheus config and deployment. Change-Id: Icf2527e76bc2028807653313c8ec978d779c6ec9 Issue-ID: DCAEGEN2-1692 Signed-off-by: kjaniak --- .../cloud/cloud-based-performance-test.sh | 37 ++++++++++- tools/performance/cloud/consumer-deployment.yaml | 44 ++++++++++++- tools/performance/cloud/producer-pod.yaml | 6 ++ tools/performance/cloud/prometheus-config-map.yaml | 51 +++++++++++++++ tools/performance/cloud/prometheus-deployment.yaml | 76 ++++++++++++++++++++++ tools/performance/cloud/test.properties | 2 +- tools/performance/local/local-performance-test.sh | 17 +++++ 7 files changed, 226 insertions(+), 7 deletions(-) create mode 100644 tools/performance/cloud/prometheus-config-map.yaml create mode 100644 tools/performance/cloud/prometheus-deployment.yaml (limited to 'tools/performance') diff --git a/tools/performance/cloud/cloud-based-performance-test.sh b/tools/performance/cloud/cloud-based-performance-test.sh index 95bd10a3..cc08f4b0 100755 --- a/tools/performance/cloud/cloud-based-performance-test.sh +++ b/tools/performance/cloud/cloud-based-performance-test.sh @@ -1,4 +1,21 @@ #!/usr/bin/env bash +# ============LICENSE_START======================================================= +# dcaegen2-collectors-veshv +# ================================================================================ +# Copyright (C) 2019 NOKIA +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= SCRIPT_DIRECTORY="$(pwd "$0")" CONTAINERS_COUNT=1 @@ -6,6 +23,8 @@ PROPERTIES_FILE=${SCRIPT_DIRECTORY}/test.properties CONFIG_MAP_NAME=performance-test-config PRODUCER_APPS_LABEL=hv-collector-producer CONSUMER_APPS_LABEL=hv-collector-kafka-consumer +PROMETHEUS_CONF_LABEL=prometheus-server-conf +PROMETHEUS_APPS_LABEL=hv-collector-prometheus ONAP_NAMESPACE=onap MAXIMUM_BACK_OFF_CHECK_ITERATIONS=30 CHECK_NUMBER=0 @@ -14,9 +33,15 @@ NAME_REASON_PATTERN="custom-columns=NAME:.metadata.name,REASON:.status.container function clean() { echo "Cleaning up environment" - echo "Attempting to delete ConfigMap" + echo "Attempting to delete test parameters ConfigMap" kubectl delete configmap ${CONFIG_MAP_NAME} -n ${ONAP_NAMESPACE} + echo "Attempting to delete prometheus ConfigMap" + kubectl delete configmap -l name=${PROMETHEUS_CONF_LABEL} -n ${ONAP_NAMESPACE} + + echo "Attempting to delete prometheus deployment and service" + kubectl delete service,deployments -l app=${PROMETHEUS_APPS_LABEL} -n ${ONAP_NAMESPACE} + echo "Attempting to delete consumer deployments" kubectl delete deployments -l app=${CONSUMER_APPS_LABEL} -n ${ONAP_NAMESPACE} @@ -59,11 +84,17 @@ function usage() { function setup_environment() { echo "Setting up environment" - echo "Creating ConfigMap from: $PROPERTIES_FILE" + echo "Creating test properties ConfigMap from: $PROPERTIES_FILE" kubectl create configmap ${CONFIG_MAP_NAME} --from-env-file=${PROPERTIES_FILE} -n ${ONAP_NAMESPACE} echo "Creating consumer deployment" - kubectl apply -f consumer-deployment.yaml -n ${ONAP_NAMESPACE} + kubectl apply -f consumer-deployment.yaml + + echo "Creating ConfigMap for prometheus deployment" + kubectl apply -f prometheus-config-map.yaml + + echo "Creating prometheus deployment" + kubectl apply -f prometheus-deployment.yaml echo "Waiting for consumers to be running." while [[ $(kubectl get pods -l app=${CONSUMER_APPS_LABEL} -n ${ONAP_NAMESPACE} | grep -c "unhealthy\|starting") -ne 0 ]] ; do diff --git a/tools/performance/cloud/consumer-deployment.yaml b/tools/performance/cloud/consumer-deployment.yaml index 5d382a42..179f246c 100755 --- a/tools/performance/cloud/consumer-deployment.yaml +++ b/tools/performance/cloud/consumer-deployment.yaml @@ -34,6 +34,7 @@ spec: metadata: labels: app: hv-collector-kafka-consumer + name: kafka-counting-consumer annotations: prometheus.io/port: "8080" prometheus.io/scrape: "true" @@ -41,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:1.3.0-SNAPSHOT + image: nexus3.dyn.nesc.nokia.net:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-kafka-consumer:latest ports: - containerPort: 8080 env: @@ -77,6 +78,7 @@ spec: metadata: labels: app: hv-collector-kafka-consumer + name: kafka-processing-consumer annotations: prometheus.io/port: "8080" prometheus.io/scrape: "true" @@ -84,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:1.3.0-SNAPSHOT + image: nexus3.dyn.nesc.nokia.net:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-kafka-consumer:latest ports: - containerPort: 8080 env: @@ -99,4 +101,40 @@ spec: valueFrom: configMapKeyRef: name: performance-test-config - key: consumer.kafka.topics \ No newline at end of file + key: consumer.kafka.topics + +--- + +apiVersion: v1 +kind: Service +metadata: + name: kafka-counting-consumer + namespace: onap + labels: + app: hv-collector-kafka-consumer +spec: + selector: + name: kafka-counting-consumer + type: ClusterIP + ports: + - protocol: TCP + port: 6062 + targetPort: 8080 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: kafka-processing-consumer + namespace: onap + labels: + app: hv-collector-kafka-consumer +spec: + selector: + name: kafka-processing-consumer + type: ClusterIP + ports: + - protocol: TCP + port: 6063 + targetPort: 8080 diff --git a/tools/performance/cloud/producer-pod.yaml b/tools/performance/cloud/producer-pod.yaml index b3248cba..9381b582 100755 --- a/tools/performance/cloud/producer-pod.yaml +++ b/tools/performance/cloud/producer-pod.yaml @@ -48,7 +48,13 @@ spec: configMapKeyRef: name: performance-test-config key: producer.message.interval + - name: CLIENTS_PER_CONTAINER + valueFrom: + configMapKeyRef: + name: performance-test-config + key: producer.client.count args: ["--address", "$(HV_VES_ADDRESS)", + "--clients", "$(CLIENTS_PER_CONTAINER)", "--msgsize", "$(MSG_SIZE)", "--msgcount", "$(MSG_COUNT)", "--intervalms", "$(INTERVAL_MS)"] diff --git a/tools/performance/cloud/prometheus-config-map.yaml b/tools/performance/cloud/prometheus-config-map.yaml new file mode 100644 index 00000000..a07bc336 --- /dev/null +++ b/tools/performance/cloud/prometheus-config-map.yaml @@ -0,0 +1,51 @@ +# ============LICENSE_START======================================================= +# dcaegen2-collectors-veshv +# ================================================================================ +# Copyright (C) 2019 NOKIA +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +apiVersion: v1 +kind: ConfigMap +metadata: + name: prometheus-server-conf + labels: + name: prometheus-server-conf + namespace: onap +data: + prometheus.yml: |- + global: + scrape_interval: 5s + external_labels: + monitor: 'my-monitor' + + scrape_configs: + - job_name: 'prometheus' + static_configs: + - targets: ['localhost:9090'] + + - job_name: 'kafka-processing-consumer' + metrics_path: '/monitoring/prometheus' + static_configs: + - targets: ['kafka-processing-consumer.onap:6063'] + + - job_name: 'kafka-offset-consumer' + metrics_path: '/monitoring/prometheus' + static_configs: + - targets: ['kafka-counting-consumer.onap:6062'] + + - job_name: 'ves-hv-collector' + metrics_path: '/monitoring/prometheus' + static_configs: + - targets: ['dcae-hv-ves-collector.onap:6060'] diff --git a/tools/performance/cloud/prometheus-deployment.yaml b/tools/performance/cloud/prometheus-deployment.yaml new file mode 100644 index 00000000..d531f588 --- /dev/null +++ b/tools/performance/cloud/prometheus-deployment.yaml @@ -0,0 +1,76 @@ +# ============LICENSE_START======================================================= +# dcaegen2-collectors-veshv +# ================================================================================ +# Copyright (C) 2019 NOKIA +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: prometheus-hv-ves-deployment + namespace: onap + labels: + app: hv-collector-prometheus +spec: + replicas: 1 + selector: + matchLabels: + app: hv-collector-prometheus + template: + metadata: + labels: + app: hv-collector-prometheus + spec: + containers: + - name: hv-collector-prometheus + image: prom/prometheus + args: + - "--config.file=/etc/prometheus/prometheus.yml" + - "--storage.tsdb.path=/prometheus/" + ports: + - containerPort: 9090 + volumeMounts: + - name: prometheus-config-volume + mountPath: /etc/prometheus/ + - name: prometheus-storage-volume + mountPath: /prometheus/ + volumes: + - name: prometheus-config-volume + configMap: + defaultMode: 420 + name: prometheus-server-conf + + - name: prometheus-storage-volume + emptyDir: {} +--- +apiVersion: v1 +kind: Service +metadata: + name: prometheus-service + namespace: onap + labels: + app: hv-collector-prometheus + annotations: + prometheus.io/scrape: 'true' + prometheus.io/port: '9090' + +spec: + selector: + app: hv-collector-prometheus + type: NodePort + ports: + - port: 8080 + targetPort: 9090 + nodePort: 30000 diff --git a/tools/performance/cloud/test.properties b/tools/performance/cloud/test.properties index 963aaec2..bd746a15 100644 --- a/tools/performance/cloud/test.properties +++ b/tools/performance/cloud/test.properties @@ -14,6 +14,6 @@ producer.message.interval=0 # CONSUMER CONFIGURATION # Addresses of Kafka services to consume from -consumer.kafka.bootstrapServers=message-router-kafka-0:9092,message-router-kafka-1:9092,message-router-kafka-2:9092 +consumer.kafka.bootstrapServers=message-router-kafka-0:9093,message-router-kafka-1:9093,message-router-kafka-2:9093 # Kafka topics to subscribe to consumer.kafka.topics=HV_VES_PERF3GPP diff --git a/tools/performance/local/local-performance-test.sh b/tools/performance/local/local-performance-test.sh index 2fcd1305..82287e6f 100755 --- a/tools/performance/local/local-performance-test.sh +++ b/tools/performance/local/local-performance-test.sh @@ -1,4 +1,21 @@ #!/usr/bin/env bash +# ============LICENSE_START======================================================= +# dcaegen2-collectors-veshv +# ================================================================================ +# Copyright (C) 2019 NOKIA +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= SCRIPT_DIRECTORY="$(pwd "$0")" CERT_FILE=${CERT_FILE:-/ssl/client.p12} -- cgit 1.2.3-korg