From 8cd540084fdfa0a91f71fc9464e0fc27d981b29d Mon Sep 17 00:00:00 2001 From: Pavel Kirilin <win10@list.ru> Date: Mon, 11 Apr 2022 00:11:05 +0400 Subject: [PATCH] Added service_monitor. (#76) Signed-off-by: Pavel Kirilin <win10@list.ru> --- deploy/helm/Chart.yaml | 2 +- deploy/helm/templates/servicemonitor.yaml | 34 +++++++++++++++++++++++ deploy/helm/values.yaml | 14 ++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 deploy/helm/templates/servicemonitor.yaml diff --git a/deploy/helm/Chart.yaml b/deploy/helm/Chart.yaml index a39382b..4c72aab 100644 --- a/deploy/helm/Chart.yaml +++ b/deploy/helm/Chart.yaml @@ -16,7 +16,7 @@ type: application # 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.0 +version: 0.2.0 # 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/deploy/helm/templates/servicemonitor.yaml b/deploy/helm/templates/servicemonitor.yaml new file mode 100644 index 0000000..08d9202 --- /dev/null +++ b/deploy/helm/templates/servicemonitor.yaml @@ -0,0 +1,34 @@ +{{- if .Values.service_monitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "rustus.fullname" . }}-monitor + labels: + {{- include "rustus.labels" . | nindent 4 }} + {{- if .Values.service_monitor.additionalLabels }} + {{- .Values.service_monitor.additionalLabels | toYaml | nindent 4 }} + {{- end }} +spec: + endpoints: + - port: http + {{- if .Values.service_monitor.interval }} + interval: {{ .Values.service_monitor.interval }} + {{- end }} + {{- if .Values.service_monitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.service_monitor.scrapeTimeout }} + {{- end }} + {{- if .Values.service_monitor.honorLabels }} + honorLabels: {{ .Values.service_monitor.honorLabels }} + {{- end }} + {{- if .Values.service_monitor.relabellings }} + relabelings: {{- toYaml .Values.service_monitor.relabellings | nindent 6 }} + {{- end }} + {{- if .Values.service_monitor.metricRelabelings }} + metricRelabelings: {{- toYaml .Values.service_monitor.metricRelabelings | nindent 6 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: {{- include "rustus.selectorLabels" . | nindent 6 }} +{{- end }} \ No newline at end of file diff --git a/deploy/helm/values.yaml b/deploy/helm/values.yaml index a062c48..6438816 100644 --- a/deploy/helm/values.yaml +++ b/deploy/helm/values.yaml @@ -178,3 +178,17 @@ mysql: database: rustus username: rustus password: rustus + + +# Configuration for prometheus operator's ServiceMonitor. +# You can read more about operator and custom resources +# here: https://operatorhub.io/operator/prometheus +service_monitor: + enabled: false + + additionalLabels: {} + interval: 5s + scrapeTimeout: "" + honorLabels: "" + relabellings: {} + metricRelabelings: {} \ No newline at end of file -- GitLab