Skip to content

Commit

Permalink
Merge pull request #10 from SAP/add-podmonitor-prometheusrule
Browse files Browse the repository at this point in the history
add podmonitor/prometheusrule
  • Loading branch information
cbarbian-sap authored Apr 11, 2024
2 parents c20b2bc + edc3f4a commit adf5b6b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
17 changes: 17 additions & 0 deletions chart/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
13 changes: 13 additions & 0 deletions chart/templates/prometheusrule.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
10 changes: 10 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []

0 comments on commit adf5b6b

Please sign in to comment.