From edc3f4a7a7b9d02af2295faed169f3124f8d47e8 Mon Sep 17 00:00:00 2001 From: Christoph Barbian Date: Wed, 10 Apr 2024 22:06:07 +0200 Subject: [PATCH] add podmonitor/prometheusrule --- chart/templates/podmonitor.yaml | 17 +++++++++++++++++ chart/templates/prometheusrule.yaml | 13 +++++++++++++ chart/values.yaml | 10 ++++++++++ 3 files changed, 40 insertions(+) create mode 100644 chart/templates/podmonitor.yaml create mode 100644 chart/templates/prometheusrule.yaml diff --git a/chart/templates/podmonitor.yaml b/chart/templates/podmonitor.yaml new file mode 100644 index 0000000..4ee6717 --- /dev/null +++ b/chart/templates/podmonitor.yaml @@ -0,0 +1,17 @@ +{{- if .Values.metrics.podMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: {{ include "redis-operator.fullname" . }} + labels: + {{- include "redis-operator.labels" . | nindent 4 }} +spec: + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + {{- include "redis-operator.selectorLabels" . | nindent 6 }} + podMetricsEndpoints: + - port: metrics +{{- end }} \ No newline at end of file diff --git a/chart/templates/prometheusrule.yaml b/chart/templates/prometheusrule.yaml new file mode 100644 index 0000000..b1b0877 --- /dev/null +++ b/chart/templates/prometheusrule.yaml @@ -0,0 +1,13 @@ +{{- if and .Values.metrics.prometheusRule.enabled .Values.metrics.prometheusRule.rules }} +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ include "redis-operator.fullname" . }} + labels: + {{- include "redis-operator.labels" . | nindent 4 }} +spec: + groups: + - name: {{ include "redis-operator.name" . }} + rules: + {{- toYaml .Values.metrics.prometheusRule.rules | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/chart/values.yaml b/chart/values.yaml index fa861d4..e35f8cc 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -78,3 +78,13 @@ webhook: issuerKind: "" # -- Issuer name (only relevant if enabled is true; if unset, a self-signed issuer is used) issuerName: "" + +metrics: + podMonitor: + # -- Whether to create a PodMonitor resource + enabled: false + prometheusRule: + # -- Whether to create a PrometheusRule resource + enabled: false + # -- PrometheusRule rules + rules: [] \ No newline at end of file