This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 2d67d15b5 Add deployment of Prometheus and Grafana to K8s (#1978)
2d67d15b5 is described below

commit 2d67d15b5de10c08ad88c59fcb5a6b631309a4f9
Author: Zhenyu Luo <[email protected]>
AuthorDate: Mon Oct 2 19:58:35 2023 +0800

    Add deployment of Prometheus and Grafana to K8s (#1978)
    
    * Add deployment of Prometheus with Grafana for K8s
    
    * fix missing file
    
    * Fix couchdb auto-generated password
---
 installer/k8s/README.md                            |  36 +++++++
 .../k8s/templates/core/backend-deployment.yaml     |   2 +
 .../core/extensions-all-iiot-deployment.yaml       |   2 +
 .../grafana/grafana-deployment.yml}                |  53 +++++-----
 .../k8s/templates/monitor/grafana/grafana-pv.yml   |  23 +++--
 .../k8s/templates/monitor/grafana/grafana-pvc.yml  |  23 +++--
 .../templates/monitor/grafana/grafana-service.yml  |  22 +++--
 .../monitor/prometheus/prometheus-configmap.yaml   |  49 ++++++++++
 .../monitor/prometheus/prometheus-deployment.yml   | 108 +++++++++++++++++++++
 .../templates/monitor/prometheus/prometheus-pv.yml |  23 +++--
 .../monitor/prometheus/prometheus-pvc.yml          |  23 +++--
 .../monitor/prometheus/prometheus-service.yml      |  21 ++--
 .../k8s/templates/monitor/prometheus/token-pvc.yml |  21 ++--
 installer/k8s/values.yaml                          |  36 +++++++
 .../streampipes-extensions-all-jvm/Dockerfile      |   2 +-
 15 files changed, 358 insertions(+), 86 deletions(-)

diff --git a/installer/k8s/README.md b/installer/k8s/README.md
index ac93dab55..42e0dc8d6 100644
--- a/installer/k8s/README.md
+++ b/installer/k8s/README.md
@@ -89,6 +89,7 @@ rm -rf ${HOME}/streampipes-k8s
 
|--------------------------------------------------|---------------------------------------------------------|-----------------------------------------|
 | deployment                                       | Deployment type (lite or 
full)                          | lite                                    |
 | preferredBroker                                  | Preferred broker for 
deployment                         | "nats"                                  |
+| monitoringSystem                                 | Enable monitoring system 
(true/false)                   | false                                   |
 | pullPolicy                                       | Image pull policy         
                              | "Always"                                |
 | restartPolicy                                    | Restart policy for the 
container                        | Always                                  |
 | persistentVolumeReclaimPolicy                    | Reclaim policy for 
persistent volumes                   | "Delete"                                |
@@ -259,6 +260,41 @@ rm -rf ${HOME}/streampipes-k8s
 | external.pulsar.persistence.claimName           | Name of the pulsar 
PersistentVolumeClaim                 | "pulsar-pvc"                            
 |
 | external.pulsar.persistence.pvName              | Name of the pulsar 
PersistentVolume                      | "pulsar-pv"                             
 |
 
+###Monitoring common parameters
+
+#### Monitoring - Prometheus
+| Parameter Name                                  | Description                
                              | Value                                    |
+|-------------------------------------------------|----------------------------------------------------------|------------------------------------------|
+| prometheus.appName                              | Prometheus application 
name                              | "prometheus"                             |
+| prometheus.version                              | Prometheus version         
                              | 2.45.0                                   |
+| prometheus.port                                 | Prometheus port            
                              | 9090                                     |
+| prometheus.service.name                         | Prometheus service name    
                              | "prometheus"                             |
+| prometheus.service.port                         | Prometheus service port    
                              | 9090                                     |
+| prometheus.persistence.storageClassName         | Prometheus storage class 
name                            | "hostpath"                               |
+| prometheus.persistence.storageSize              | Prometheus storage size    
                              | "2Gi"                                    |
+| prometheus.persistence.claimName                | Prometheus PVC claim name  
                              | "prometheus-pvc"                         |
+| prometheus.persistence.pvName                   | Prometheus PV name         
                              | "prometheus-pv"                          |
+| prometheus.persistence.tokenStorageSize         | Prometheus token storage 
size                            | "16Ki"                                   |
+| prometheus.config.scrapeInterval                | Prometheus scrape interval 
                              | 10s                                      |
+| prometheus.config.evaluationInterval            | Prometheus evaluation 
interval                           | 15s                                      |
+| prometheus.config.backendJobName                | Prometheus backend job 
name                              | "backend"                                |
+| prometheus.config.extensionsName                | Prometheus extensions job 
name                           | "extensions-all-iiot"                    |
+| prometheus.config.tokenFileName                 | Prometheus token file name 
                              | "token"                                  |
+| prometheus.config.tokenFileDir                  | Prometheus token file 
directory                          | "/opt/data/"
+
+#### Monitoring - Grafana
+| Parameter Name                                  | Description                
                              | Value                                    |
+|-------------------------------------------------|----------------------------------------------------------|------------------------------------------|
+| grafana.appName                                 | Grafana application name   
                              | "grafana"                                |
+| grafana.version                                 | Grafana version            
                              | 10.1.2                                   |
+| grafana.port                                    | Grafana port               
                              | 3000                                     |
+| grafana.service.name                            | Grafana service name       
                              | "grafana"                                |
+| grafana.service.port                            | Grafana service port       
                              | 3000                                     |
+| grafana.persistence.storageClassName            | Grafana storage class name 
                              | "hostpath"                               |
+| grafana.persistence.storageSize                 | Grafana storage size       
                              | "1Gi"                                    |
+| grafana.persistence.claimName                   | Grafana PVC claim name     
                              | "grafana-pvc"                            |
+| grafana.persistence.pvName                      | Grafana PV name            
                              | "grafana-pv"                             |
+
 ## Bugs and Feature Requests
 
 If you've found a bug or have a feature that you'd love to see in StreamPipes, 
feel free to create an issue on 
[GitHub](https://github.com/apache/streampipes/issues).
diff --git a/installer/k8s/templates/core/backend-deployment.yaml 
b/installer/k8s/templates/core/backend-deployment.yaml
index 59bb2f57d..a8d4e8e26 100644
--- a/installer/k8s/templates/core/backend-deployment.yaml
+++ b/installer/k8s/templates/core/backend-deployment.yaml
@@ -45,6 +45,8 @@ spec:
           image: {{ .Values.streampipes.registry }}/backend:{{ 
.Values.streampipes.version }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           env:
+            - name: SP_SETUP_PROMETHEUS_ENDPOINT
+              value: "{{ .Values.monitoringSystem }}"
             - name: SP_PRIORITIZED_PROTOCOL
             {{- if eq .Values.preferredBroker "pulsar" }}
               value: "pulsar"
diff --git a/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml 
b/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml
index f48d5512f..16a1e88bf 100644
--- a/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml
+++ b/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml
@@ -39,6 +39,8 @@ spec:
           ports:
             - containerPort: {{ .Values.extensions.iiot.port }}
           env:
+            - name: SP_SETUP_PROMETHEUS_ENDPOINT
+              value: "{{ .Values.monitoringSystem }}"
             - name: SP_CLIENT_USER
               value: "{{ .Values.streampipes.auth.users.service.user }}"
             - name: SP_CLIENT_SECRET
diff --git a/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml 
b/installer/k8s/templates/monitor/grafana/grafana-deployment.yml
similarity index 56%
copy from installer/k8s/templates/core/extensions-all-iiot-deployment.yaml
copy to installer/k8s/templates/monitor/grafana/grafana-deployment.yml
index f48d5512f..11743fed4 100644
--- a/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml
+++ b/installer/k8s/templates/monitor/grafana/grafana-deployment.yml
@@ -13,64 +13,57 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+{{- if eq .Values.monitoringSystem true }}
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  name: {{ .Values.extensions.iiot.appName }}
+  name: {{ .Values.monitoring.grafana.appName }}
+  labels:
+    app: {{ .Values.monitoring.grafana.appName }}
 spec:
+  replicas: 1
   selector:
     matchLabels:
-      app: {{ .Values.extensions.iiot.appName }}
-  replicas: 1
+      app: {{ .Values.monitoring.grafana.appName }}
   template:
     metadata:
       labels:
-        app: {{ .Values.extensions.iiot.appName }}
+        app: {{ .Values.monitoring.grafana.appName }}
     spec:
+      volumes:
+        - name: {{ .Values.monitoring.grafana.persistence.pvName }}
+          persistentVolumeClaim:
+            claimName:  {{ .Values.monitoring.grafana.persistence.claimName }}
       restartPolicy: {{ .Values.restartPolicy }}
       initContainers:
-        - name: init-wait-{{.Values.streampipes.core.service.name}}
+        - name: init-wait-consul-couchdb-core
           image: alpine
-          command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 
{{.Values.streampipes.core.service.name}} {{ 
.Values.streampipes.core.service.port }} && exit 0 || sleep 3; done; exit 1"]
+          command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 {{ 
.Values.streampipes.core.service.name }} {{ 
.Values.streampipes.core.service.port }} && nc -zvw1 {{ 
.Values.extensions.iiot.service.name }} {{ .Values.extensions.iiot.service.port 
}} && exit 0 || sleep 3; done; exit 1"]
       containers:
-        - name: extensions-all-iiot
-          image: {{ .Values.streampipes.registry }}/extensions-all-iiot:{{ 
.Values.streampipes.version }}
+        - name: {{ .Values.monitoring.grafana.appName }}
+          image: grafana/grafana:{{ .Values.monitoring.grafana.version }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           ports:
-            - containerPort: {{ .Values.extensions.iiot.port }}
-          env:
-            - name: SP_CLIENT_USER
-              value: "{{ .Values.streampipes.auth.users.service.user }}"
-            - name: SP_CLIENT_SECRET
-              valueFrom:
-                secretKeyRef:
-                  name: "{{ .Values.streampipes.auth.secretName }}"
-                  key: sp-initial-client-secret
-            - name: SP_COUCHDB_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: {{ .Values.streampipes.auth.secretName }}
-                  key: sp-couchdb-password
-            - name: SP_TS_STORAGE_TOKEN
-              valueFrom:
-                secretKeyRef:
-                  name: "{{ .Values.streampipes.auth.secretName }}"
-                  key: sp-ts-storage-token
+            - containerPort: {{ .Values.monitoring.grafana.port }}
+          volumeMounts:
+            - name: {{ .Values.monitoring.grafana.persistence.pvName }}
+              mountPath: /var/lib/grafana
           livenessProbe:
             tcpSocket:
-              port: {{ .Values.extensions.iiot.port }}
+              port: {{ .Values.monitoring.grafana.port }}
             initialDelaySeconds: {{ .Values.initialDelaySeconds }}
             periodSeconds: {{ .Values.periodSeconds }}
             failureThreshold: {{ .Values.failureThreshold }}
           readinessProbe:
             tcpSocket:
-              port: {{ .Values.extensions.iiot.port }}
+              port: {{ .Values.monitoring.grafana.port }}
             initialDelaySeconds: {{ .Values.initialDelaySeconds }}
             periodSeconds: {{ .Values.periodSeconds }}
             failureThreshold: {{ .Values.failureThreshold }}
           startupProbe:
             tcpSocket:
-              port: {{ .Values.extensions.iiot.port }}
+              port: {{ .Values.monitoring.grafana.port }}
             initialDelaySeconds: {{ .Values.initialDelaySeconds }}
             periodSeconds: {{ .Values.periodSeconds }}
             failureThreshold: {{ .Values.failureThreshold }}
+{{- end }}
\ No newline at end of file
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/installer/k8s/templates/monitor/grafana/grafana-pv.yml
similarity index 59%
copy from streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
copy to installer/k8s/templates/monitor/grafana/grafana-pv.yml
index d84e5bcea..773bad160 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/installer/k8s/templates/monitor/grafana/grafana-pv.yml
@@ -13,11 +13,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-# needed pkgs processors-image-processing-jvm
-RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
-
-COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: {{ .Values.monitoring.grafana.persistence.pvName }}
+spec:
+  storageClassName: {{ .Values.monitoring.grafana.persistence.storageClassName 
}}
+  capacity:
+    storage: {{ .Values.monitoring.grafana.persistence.storageSize }}
+  accessModes:
+    - {{ .Values.persistentVolumeAccessModes }}
+  persistentVolumeReclaimPolicy: {{ .Values.persistentVolumeReclaimPolicy }}
+  hostPath:
+    path: {{ .Values.hostPath }}/grafana
+{{- end }}
\ No newline at end of file
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/installer/k8s/templates/monitor/grafana/grafana-pvc.yml
similarity index 61%
copy from streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
copy to installer/k8s/templates/monitor/grafana/grafana-pvc.yml
index d84e5bcea..a5ed88670 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/installer/k8s/templates/monitor/grafana/grafana-pvc.yml
@@ -13,11 +13,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-# needed pkgs processors-image-processing-jvm
-RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
-
-COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  labels:
+    app: {{ .Values.monitoring.grafana.appName }}
+  name: {{ .Values.monitoring.grafana.persistence.claimName }}
+spec:
+  storageClassName: {{ .Values.monitoring.grafana.persistence.storageClassName 
}}
+  accessModes:
+    - {{ .Values.persistentVolumeAccessModes }}
+  resources:
+    requests:
+      storage: {{ .Values.monitoring.grafana.persistence.storageSize }}
+{{- end }}
\ No newline at end of file
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/installer/k8s/templates/monitor/grafana/grafana-service.yml
similarity index 68%
copy from streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
copy to installer/k8s/templates/monitor/grafana/grafana-service.yml
index d84e5bcea..7c4dac309 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/installer/k8s/templates/monitor/grafana/grafana-service.yml
@@ -13,11 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-# needed pkgs processors-image-processing-jvm
-RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
-
-COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ .Values.monitoring.grafana.service.name }}
+spec:
+  selector:
+    app: {{ .Values.monitoring.grafana.appName }}
+  ports:
+    - name: main
+      protocol: TCP
+      port: {{ .Values.monitoring.grafana.port }}
+      targetPort: {{ .Values.monitoring.grafana.port }}
+{{- end }}
\ No newline at end of file
diff --git 
a/installer/k8s/templates/monitor/prometheus/prometheus-configmap.yaml 
b/installer/k8s/templates/monitor/prometheus/prometheus-configmap.yaml
new file mode 100644
index 000000000..dbb2e9246
--- /dev/null
+++ b/installer/k8s/templates/monitor/prometheus/prometheus-configmap.yaml
@@ -0,0 +1,49 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: prometheus-conf
+
+data:
+  prometheus.yml: |
+    global:
+      scrape_interval: {{ .Values.monitoring.prometheus.config.scrapeInterval 
}}
+      evaluation_interval: {{ 
.Values.monitoring.prometheus.config.evaluationInterval }}
+    alerting:
+      alertmanagers:
+        - static_configs:
+            - targets:
+    rule_files:
+
+    scrape_configs:
+      - job_name: "{{ .Values.monitoring.prometheus.appName }}"
+        static_configs:
+          - targets: ["{{ .Values.monitoring.prometheus.service.name }}:{{ 
.Values.monitoring.prometheus.service.port }}"]
+
+      - job_name: "{{ .Values.monitoring.prometheus.config.backendJobName }}"
+        metrics_path: "/streampipes-backend/actuator/prometheus"
+        bearer_token_file: "{{ 
.Values.monitoring.prometheus.config.tokenFileDir }}{{ 
.Values.monitoring.prometheus.config.tokenFileName }}{{ 
.Values.monitoring.prometheus.config.tokenFileName }}"
+        static_configs:
+          - targets: [ "{{ .Values.streampipes.core.service.name }}:{{ 
.Values.streampipes.core.service.port }}" ]
+
+
+      - job_name: "{{ .Values.monitoring.prometheus.config.extensionsName }}"
+        metrics_path: "/actuator/prometheus"
+        static_configs:
+          - targets: ["{{ .Values.extensions.iiot.service.name }}:{{ 
.Values.extensions.iiot.service.port }}"]
+{{- end }}
\ No newline at end of file
diff --git 
a/installer/k8s/templates/monitor/prometheus/prometheus-deployment.yml 
b/installer/k8s/templates/monitor/prometheus/prometheus-deployment.yml
new file mode 100644
index 000000000..260de082a
--- /dev/null
+++ b/installer/k8s/templates/monitor/prometheus/prometheus-deployment.yml
@@ -0,0 +1,108 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ .Values.monitoring.prometheus.appName }}
+  labels:
+    app: {{ .Values.monitoring.prometheus.appName }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: {{ .Values.monitoring.prometheus.appName }}
+  template:
+    metadata:
+      labels:
+        app: {{ .Values.monitoring.prometheus.appName }}
+    spec:
+      volumes:
+        - name: shared-token
+          persistentVolumeClaim:
+            claimName: token
+        - name: {{ .Values.monitoring.prometheus.persistence.pvName }}
+          persistentVolumeClaim:
+            claimName:  {{ .Values.monitoring.prometheus.persistence.claimName 
}}
+        - name: prometheus-conf
+          configMap:
+            name: prometheus-conf
+      restartPolicy: {{ .Values.restartPolicy }}
+      initContainers:
+        - name: init-wait-consul-couchdb-core
+          image: alpine
+          command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 {{ 
.Values.streampipes.core.service.name }} {{ 
.Values.streampipes.core.service.port }} && nc -zvw1 {{ 
.Values.extensions.iiot.service.name }} {{ .Values.extensions.iiot.service.port 
}} && exit 0 || sleep 3; done; exit 1"]
+      containers:
+        - name: prometheus-token-refresher
+          image: luoluoyuyu/prometheus-token-refresher:1.0.0
+          imagePullPolicy: "IfNotPresent"
+          env:
+            - name: SP_HOST
+              value: "backend"
+            - name: SP_PORT
+              value: "{{ .Values.streampipes.core.service.port }}"
+            - name: SP_USERNAME
+              value: "{{ .Values.streampipes.auth.users.admin.user }}"
+            - name: SP_PASSWORD
+              valueFrom:
+                secretKeyRef:
+                  name: {{ .Values.streampipes.auth.secretName}}
+                  key: sp-encryption-passcode
+            - name: PROMETHEUS_HOST
+              value: "{{ .Values.monitoring.prometheus.service.name }}"
+            - name: PROMETHEUS_PORT
+              value: "{{ .Values.monitoring.prometheus.service.port }}"
+            - name: TOKEN_FILE
+              value: "{{ .Values.monitoring.prometheus.config.tokenFileDir 
}}{{ .Values.monitoring.prometheus.config.tokenFileName }}"
+          volumeMounts:
+            - name: shared-token
+              mountPath: {{ .Values.monitoring.prometheus.config.tokenFileDir 
}}
+              readOnly: false
+        - name: {{ .Values.monitoring.prometheus.appName }}
+          image: bitnami/prometheus:{{ .Values.monitoring.prometheus.version }}
+          imagePullPolicy: {{ .Values.pullPolicy }}
+          args:
+            - --web.enable-lifecycle
+          ports:
+            - containerPort: {{ .Values.monitoring.prometheus.port }}
+          volumeMounts:
+            - name: prometheus-conf
+              mountPath: /opt/bitnami/prometheus/prometheus.yml
+              subPath: prometheus.yml
+            - name: {{ .Values.monitoring.prometheus.persistence.pvName }}
+              mountPath: /opt/bitnami/prometheus/data
+            - name: shared-token
+              mountPath: {{ .Values.monitoring.prometheus.config.tokenFileDir 
}}
+              readOnly: false
+          livenessProbe:
+            tcpSocket:
+              port: {{ .Values.monitoring.prometheus.port }}
+            initialDelaySeconds: {{ .Values.initialDelaySeconds }}
+            periodSeconds: {{ .Values.periodSeconds }}
+            failureThreshold: {{ .Values.failureThreshold }}
+          readinessProbe:
+            tcpSocket:
+              port: {{ .Values.monitoring.prometheus.port }}
+            initialDelaySeconds: {{ .Values.initialDelaySeconds }}
+            periodSeconds: {{ .Values.periodSeconds }}
+            failureThreshold: {{ .Values.failureThreshold }}
+          startupProbe:
+            tcpSocket:
+              port: {{ .Values.monitoring.prometheus.port }}
+            initialDelaySeconds: {{ .Values.initialDelaySeconds }}
+            periodSeconds: {{ .Values.periodSeconds }}
+            failureThreshold: {{ .Values.failureThreshold }}
+{{- end }}
\ No newline at end of file
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/installer/k8s/templates/monitor/prometheus/prometheus-pv.yml
similarity index 59%
copy from streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
copy to installer/k8s/templates/monitor/prometheus/prometheus-pv.yml
index d84e5bcea..4ded896c2 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/installer/k8s/templates/monitor/prometheus/prometheus-pv.yml
@@ -13,11 +13,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-# needed pkgs processors-image-processing-jvm
-RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
-
-COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: {{ .Values.monitoring.prometheus.persistence.pvName }}
+spec:
+  storageClassName: {{ 
.Values.monitoring.prometheus.persistence.storageClassName }}
+  capacity:
+    storage: {{ .Values.monitoring.prometheus.persistence.storageSize }}
+  accessModes:
+    - {{ .Values.persistentVolumeAccessModes }}
+  persistentVolumeReclaimPolicy: {{ .Values.persistentVolumeReclaimPolicy }}
+  hostPath:
+    path: {{ .Values.hostPath }}/prometheus
+{{- end }}
\ No newline at end of file
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/installer/k8s/templates/monitor/prometheus/prometheus-pvc.yml
similarity index 61%
copy from streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
copy to installer/k8s/templates/monitor/prometheus/prometheus-pvc.yml
index d84e5bcea..11920e6d4 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/installer/k8s/templates/monitor/prometheus/prometheus-pvc.yml
@@ -13,11 +13,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-# needed pkgs processors-image-processing-jvm
-RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
-
-COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  labels:
+    app: {{ .Values.monitoring.prometheus.appName }}
+  name: {{ .Values.monitoring.prometheus.persistence.claimName }}
+spec:
+  storageClassName: {{ 
.Values.monitoring.prometheus.persistence.storageClassName }}
+  accessModes:
+    - {{ .Values.persistentVolumeAccessModes }}
+  resources:
+    requests:
+      storage: {{ .Values.monitoring.prometheus.persistence.storageSize }}
+{{- end }}
\ No newline at end of file
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/installer/k8s/templates/monitor/prometheus/prometheus-service.yml
similarity index 67%
copy from streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
copy to installer/k8s/templates/monitor/prometheus/prometheus-service.yml
index d84e5bcea..ec0177d4e 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/installer/k8s/templates/monitor/prometheus/prometheus-service.yml
@@ -13,11 +13,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
 
-# needed pkgs processors-image-processing-jvm
-RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
-
-COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ .Values.monitoring.prometheus.service.name }}
+spec:
+  selector:
+    app: {{ .Values.monitoring.prometheus.appName }}
+  ports:
+    - name: main
+      protocol: TCP
+      port: {{ .Values.monitoring.prometheus.port }}
+      targetPort: {{ .Values.monitoring.prometheus.port }}
+{{- end }}
\ No newline at end of file
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/installer/k8s/templates/monitor/prometheus/token-pvc.yml
similarity index 67%
copy from streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
copy to installer/k8s/templates/monitor/prometheus/token-pvc.yml
index d84e5bcea..5cd00885f 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/installer/k8s/templates/monitor/prometheus/token-pvc.yml
@@ -13,11 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-# needed pkgs processors-image-processing-jvm
-RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
-
-COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
+{{- if eq .Values.monitoringSystem true }}
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: token
+spec:
+  storageClassName: {{ 
.Values.monitoring.prometheus.persistence.storageClassName }}
+  accessModes:
+    - {{ .Values.persistentVolumeAccessModes }}
+  resources:
+    requests:
+      storage: {{ .Values.monitoring.prometheus.persistence.tokenStorageSize }}
+{{- end }}
\ No newline at end of file
diff --git a/installer/k8s/values.yaml b/installer/k8s/values.yaml
index 6effc47d0..ae6103995 100644
--- a/installer/k8s/values.yaml
+++ b/installer/k8s/values.yaml
@@ -16,6 +16,7 @@
 # lite or full (default: lite)
 deployment: lite
 preferredBroker: "nats"
+monitoringSystem: false
 pullPolicy: "Always"
 restartPolicy: Always
 persistentVolumeReclaimPolicy: "Delete"
@@ -190,4 +191,39 @@ external:
       pvName: "pulsar-pv"
 
 
+monitoring:
+  # monitoring - prometheus
+  prometheus:
+    appName: "prometheus"
+    version: 2.45.0
+    port: 9090
+    service:
+      name: "prometheus"
+      port: 9090
+    persistence:
+      storageClassName: "hostpath"
+      storageSize: "2Gi"
+      claimName: "prometheus-pvc"
+      pvName: "prometheus-pv"
+      tokenStorageSize: "16Ki"
+    config:
+      scrapeInterval: 10s
+      evaluationInterval: 15s
+      backendJobName: backend
+      extensionsName: extensions-all-iiot
+      tokenFileName: token
+      tokenFileDir: /opt/data/
 
+  # monitoring - grafana
+  grafana:
+    appName: "grafana"
+    version: 10.1.2
+    port: 3000
+    service:
+      name: "grafana"
+      port: 3000
+    persistence:
+      storageClassName: "hostpath"
+      storageSize: "1Gi"
+      claimName: "grafana-pvc"
+      pvName: "grafana-pv"
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
index d84e5bcea..efc90dfa2 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
@@ -20,4 +20,4 @@ RUN apt-get update && apt-get install ttf-dejavu-core && 
apt-get install fontcon
 
 COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
 
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
+ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
\ No newline at end of file

Reply via email to