Aether-1359 - Add the serviceMonitor so that prometheus know how to scrape dbuf's metric
Change-Id: Ie067a408b4410149ef18d5636b0cb8bef6a82a1c
diff --git a/apps/dbuf/Chart.yaml b/apps/dbuf/Chart.yaml
index ded633a..fb38259 100644
--- a/apps/dbuf/Chart.yaml
+++ b/apps/dbuf/Chart.yaml
@@ -18,7 +18,7 @@
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.1.6
+version: 0.1.7
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
diff --git a/apps/dbuf/templates/servicemonitor.yaml b/apps/dbuf/templates/servicemonitor.yaml
new file mode 100644
index 0000000..4290b0b
--- /dev/null
+++ b/apps/dbuf/templates/servicemonitor.yaml
@@ -0,0 +1,23 @@
+{{- if eq .Values.prometheus_enable true }}
+
+{{/*
+# Copyright 2021-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+ name: dbuf
+ labels:
+ {{- include "dbuf.labels" . | nindent 4 }}
+spec:
+ selector:
+ matchLabels:
+ {{- include "dbuf.selectorLabels" . | nindent 6 }}
+ endpoints:
+ - port: exporter
+ path: /metrics
+ scheme: HTTP
+{{ end }}
diff --git a/apps/dbuf/values.yaml b/apps/dbuf/values.yaml
index 2b3e261..1beeaa5 100644
--- a/apps/dbuf/values.yaml
+++ b/apps/dbuf/values.yaml
@@ -48,6 +48,7 @@
port: 2152
interface: "net0"
+prometheus_enable: true
service:
stats:
port: 8080