Mohammed Naser | b8eccd2 | 2023-02-10 05:55:56 +0000 | [diff] [blame] | 1 | {{- if .Values.monitoring }} |
| 2 | {{- if .Values.monitoring.createPrometheusRules }} |
| 3 | --- |
| 4 | apiVersion: monitoring.coreos.com/v1 |
| 5 | kind: PrometheusRule |
| 6 | metadata: |
| 7 | labels: |
| 8 | prometheus: rook-prometheus |
| 9 | role: alert-rules |
| 10 | {{- if .Values.monitoring.prometheusRule.labels }} |
| 11 | {{ toYaml .Values.monitoring.prometheusRule.labels | indent 4 }} |
| 12 | {{- end }} |
| 13 | {{- if .Values.monitoring.prometheusRule.annotations }} |
| 14 | annotations: |
| 15 | {{ toYaml .Values.monitoring.prometheusRule.annotations | indent 4 }} |
| 16 | {{- end }} |
| 17 | name: prometheus-ceph-rules |
| 18 | namespace: {{ default .Release.Namespace .Values.monitoring.rulesNamespaceOverride }} |
| 19 | spec: |
| 20 | # Import the raw prometheus rules since they have descriptions that should not be processed with the helm templates |
| 21 | {{- $root := . }} |
| 22 | {{- if .Values.cephClusterSpec.external }} |
| 23 | {{- if .Values.cephClusterSpec.external.enable }} |
| 24 | {{- range $path, $bytes := .Files.Glob "prometheus/externalrules.yaml" }} |
| 25 | {{ $root.Files.Get $path }} |
| 26 | {{- end }} |
| 27 | {{- else }} |
| 28 | # The local rules are included in two different else statements because helm does not short-circuit |
| 29 | # the checks to allow the check for external settings in a single if statement. |
| 30 | {{- range $path, $bytes := .Files.Glob "prometheus/localrules.yaml" }} |
| 31 | {{ $root.Files.Get $path | indent 2 }} |
| 32 | {{- end }} |
| 33 | {{- end }} |
| 34 | {{- else }} |
| 35 | {{- range $path, $bytes := .Files.Glob "prometheus/localrules.yaml" }} |
| 36 | {{ $root.Files.Get $path | indent 2 }} |
| 37 | {{- end }} |
| 38 | {{- end }} |
| 39 | {{- end }} |
| 40 | {{- end }} |