Skip to content

Commit

Permalink
standardize podmonitor/prometheusrule
Browse files Browse the repository at this point in the history
  • Loading branch information
cbarbian-sap committed Apr 23, 2024
1 parent 93b0fea commit ede4f95
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
28 changes: 0 additions & 28 deletions chart/templates/monitoring.yaml

This file was deleted.

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 "project-operator.fullname" . }}
labels:
{{- include "project-operator.labels" . | nindent 4 }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "project-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 "project-operator.fullname" . }}
labels:
{{- include "project-operator.labels" . | nindent 4 }}
spec:
groups:
- name: {{ include "project-operator.name" . }}-alerts
rules:
{{- toYaml .Values.metrics.prometheusRule.rules | nindent 4 }}
{{- end }}
14 changes: 9 additions & 5 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ adminClusterRole: ""
viewerClusterRole: ""
# -- Automatically grant cluster view privileges to all members of the project
enableClusterView: false
monitoring:
# -- Enable montoring (requires prometheus-operator)
enabled: false
# -- Prometheus operator (record or alert) rules
rules: []
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 ede4f95

Please sign in to comment.