From 2f70402c3a99a0cb9629e6bf4e4fe338f3a3f2f3 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Mon, 2 Oct 2023 12:23:19 +0200 Subject: [PATCH] feat: support serviceMonitor --- templates/serviceMonitor.yaml | 26 ++++++++++++++++++++++++++ values.yaml | 9 +++++++++ 2 files changed, 35 insertions(+) create mode 100644 templates/serviceMonitor.yaml diff --git a/templates/serviceMonitor.yaml b/templates/serviceMonitor.yaml new file mode 100644 index 0000000..2d8b338 --- /dev/null +++ b/templates/serviceMonitor.yaml @@ -0,0 +1,26 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + {{- with .Values.serviceMonitor.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "prometheus-fail2ban-exporter.labels" . | nindent 4 }} + name: {{ include "prometheus-fail2ban-exporter.fullname" . }} +spec: + endpoints: + - honorLabels: {{ .Values.serviceMonitor.honorLabels }} + interval: {{ .Values.serviceMonitor.interval }} + path: {{ .Values.serviceMonitor.path }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + targetPort: {{ .Values.service.port }} + jobLabel: {{ include "prometheus-fail2ban-exporter.fullname" . }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + {{- include "prometheus-fail2ban-exporter.labels" . | nindent 6 }} +{{- end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index cca146c..56f5bf0 100644 --- a/values.yaml +++ b/values.yaml @@ -95,6 +95,15 @@ service: type: ClusterIP port: 9191 +serviceMonitor: + enabled: false + annotations: {} + honorLabels: false + interval: 60s + labels: {} + path: /metrics + scrapeTimeout: 30s + tolerations: [] volumeMounts: