updating helm/docker files and database config files
[it/otf.git] / otf-helm / otf / charts / databases / mongodb / templates / prometheus-service-monitor.yaml
diff --git a/otf-helm/otf/charts/databases/mongodb/templates/prometheus-service-monitor.yaml b/otf-helm/otf/charts/databases/mongodb/templates/prometheus-service-monitor.yaml
new file mode 100644 (file)
index 0000000..17e8bf6
--- /dev/null
@@ -0,0 +1,36 @@
+{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  name: {{ template "mongodb.fullname" . }}
+  {{- if .Values.metrics.serviceMonitor.namespace }}
+  #namespace: {{ .Values.metrics.serviceMonitor.namespace }}
+  namespace: {{.Values.namespace }}
+  {{- end }}
+  labels:
+    app: {{ template "mongodb.name" . }}
+    chart: {{ template "mongodb.chart" . }}
+    heritage: {{ .Release.Service }}
+    release: {{ .Release.Name }}
+    {{- if .Values.metrics.serviceMonitor.additionalLabels }}
+{{ toYaml .Values.metrics.serviceMonitor.additionalLabels | indent 4 }}
+    {{- end }}
+spec:
+  endpoints:
+  - interval: 30s
+    port: metrics
+    {{- if .Values.metrics.serviceMonitor.relabellings }}
+    metricRelabelings:
+{{ toYaml .Values.metrics.serviceMonitor.relabellings | indent 4 }}
+    {{- end }}
+  jobLabel: {{ template "mongodb.fullname" . }}
+  namespaceSelector:
+    matchNames:
+    - "{{ $.Release.Namespace }}"
+  selector:
+    matchLabels:
+      app: {{ template "mongodb.name" . }}
+      chart: {{ template "mongodb.chart" . }}
+      release: "{{ .Release.Name }}"
+      heritage: "{{ .Release.Service }}"
+{{- end }}