charts/templates/prometheus-alerting-rule.yaml
{{- if and .Values.metrics.enabled .Values.serviceMonitor.enabled .Values.serviceMonitor.alerting.rules }}
{{- $fullName := include "backend-java-patterns.fullname" . -}}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ $fullName }}
{{- if .Values.metrics.rules.namespace }}
namespace: {{ .Values.metrics.rules.namespace }}
{{- end }}
labels:
{{- include "backend-java-patterns.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.alerting.labels }}
{{ toYaml .Values.serviceMonitor.alerting.labels | indent 4 }}
{{- end }}
spec:
groups:
{{ toYaml .Values.serviceMonitor.alerting.rules | indent 4 }}
{{- end }}