From 2b9c91fa30012c436c5550d887cd1079d16512f1 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Tue, 8 Nov 2022 14:28:17 +0000 Subject: [PATCH] feat(uptimekuma): create servicemonitor for uptimekuma (#4334) * create servicemonitor for uptimekuma Signed-off-by: Keith Cirkel * add default values for servicemonitor to uptime-kuma Signed-off-by: Keith Cirkel * minor bump uptime-kuma chart Signed-off-by: Keith Cirkel * add metrics questions to uptime-kuma Signed-off-by: Keith Cirkel * Update charts/stable/uptime-kuma/Chart.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/stable/uptime-kuma/templates/servicemonitor.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Signed-off-by: Keith Cirkel Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Kjeld Schouten-Lebbing --- charts/stable/uptime-kuma/Chart.yaml | 2 +- charts/stable/uptime-kuma/questions.yaml | 1 + .../uptime-kuma/templates/servicemonitor.yaml | 26 +++++++++++++++++++ charts/stable/uptime-kuma/values.yaml | 9 +++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 charts/stable/uptime-kuma/templates/servicemonitor.yaml diff --git a/charts/stable/uptime-kuma/Chart.yaml b/charts/stable/uptime-kuma/Chart.yaml index 0c295b6d3d5..90bb9b59834 100644 --- a/charts/stable/uptime-kuma/Chart.yaml +++ b/charts/stable/uptime-kuma/Chart.yaml @@ -21,7 +21,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/uptime-kuma - https://github.com/louislam/uptime-kuma type: application -version: 3.0.49 +version: 3.1.0 annotations: truecharts.org/catagories: | - monitoring diff --git a/charts/stable/uptime-kuma/questions.yaml b/charts/stable/uptime-kuma/questions.yaml index c6de05ea9f5..004193cebe2 100644 --- a/charts/stable/uptime-kuma/questions.yaml +++ b/charts/stable/uptime-kuma/questions.yaml @@ -114,6 +114,7 @@ questions: default: 568 # Include{podSecurityContextAdvanced} # Include{resources} +# Include{metrics} # Include{advanced} # Include{addons} # Include{codeserver} diff --git a/charts/stable/uptime-kuma/templates/servicemonitor.yaml b/charts/stable/uptime-kuma/templates/servicemonitor.yaml new file mode 100644 index 00000000000..99036fc3da9 --- /dev/null +++ b/charts/stable/uptime-kuma/templates/servicemonitor.yaml @@ -0,0 +1,26 @@ +{{- if hasKey .Values "metrics" }} +{{- if .Values.metrics.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "tc.common.names.fullname" . }} + labels: + {{- include "tc.common.labels" . | nindent 4 }} + {{- with .Values.metrics.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: + {{- include "tc.common.labels.selectorLabels" . | nindent 6 }} + endpoints: + - port: metrics + {{- with .Values.metrics.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + path: /metrics +{{- end }} +{{- end }} diff --git a/charts/stable/uptime-kuma/values.yaml b/charts/stable/uptime-kuma/values.yaml index 4c2ae571914..db832ca4507 100644 --- a/charts/stable/uptime-kuma/values.yaml +++ b/charts/stable/uptime-kuma/values.yaml @@ -27,3 +27,12 @@ persistence: portal: enabled: true + +metrics: + # -- Enable and configure a Prometheus serviceMonitor for the chart under this key. + # @default -- See values.yaml + enabled: false + serviceMonitor: + interval: 1m + scrapeTimeout: 30s + labels: {}