Add Prometheus deployment for HV-VES performance tests - cloud 45/92245/6
authorkjaniak <kornel.janiak@nokia.com>
Tue, 30 Jul 2019 07:32:56 +0000 (09:32 +0200)
committerkjaniak <kornel.janiak@nokia.com>
Fri, 6 Sep 2019 06:10:52 +0000 (08:10 +0200)
Script for cloud is updated with proper prometheus config and deployment.

Change-Id: Icf2527e76bc2028807653313c8ec978d779c6ec9
Issue-ID: DCAEGEN2-1692
Signed-off-by: kjaniak <kornel.janiak@nokia.com>
tools/performance/cloud/cloud-based-performance-test.sh
tools/performance/cloud/consumer-deployment.yaml
tools/performance/cloud/producer-pod.yaml
tools/performance/cloud/prometheus-config-map.yaml [new file with mode: 0644]
tools/performance/cloud/prometheus-deployment.yaml [new file with mode: 0644]
tools/performance/cloud/test.properties
tools/performance/local/local-performance-test.sh

index 95bd10a..cc08f4b 100755 (executable)
@@ -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
index 5d382a4..179f246 100755 (executable)
@@ -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
index b3248cb..9381b58 100755 (executable)
@@ -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 (file)
index 0000000..a07bc33
--- /dev/null
@@ -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 (file)
index 0000000..d531f58
--- /dev/null
@@ -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
index 963aaec..bd746a1 100644 (file)
@@ -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
index 2fcd130..82287e6 100755 (executable)
@@ -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}