forked from helm/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable/prometheus-operator] Add custom PrometheusRules (helm#11266)
This commit allows the specification of custom PrometheusRule resources via alertmanager.additionalPrometheusRules. To assist the implementation, the ServiceMonitor manifest has also been updated to remove the v1 List type, which was subsequently clobbered. Signed-off-by: Ash Caire <[email protected]>
- Loading branch information
1 parent
dab07b1
commit 7de3fa9
Showing
6 changed files
with
56 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
stable/prometheus-operator/templates/alertmanager/prometheusrules.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{- if and .Values.alertmanager.enabled .Values.alertmanager.additionalPrometheusRules }} | ||
{{- range .Values.alertmanager.additionalPrometheusRules }} | ||
apiVersion: {{ printf "%s/v1" ($.Values.prometheusOperator.crdApiGroup | default "monitoring.coreos.com") }} | ||
kind: PrometheusRule | ||
metadata: | ||
name: {{ template "prometheus-operator.name" $ }}-{{ .name }} | ||
labels: | ||
app: {{ template "prometheus-operator.name" $ }} | ||
{{ include "prometheus-operator.labels" $ | indent 4 }} | ||
{{- if .additionalLabels }} | ||
{{ toYaml .additionalLabels | indent 4 }} | ||
{{- end }} | ||
spec: | ||
groups: | ||
{{ toYaml .groups| indent 4 }} | ||
{{- end }} | ||
{{- end }} |
45 changes: 21 additions & 24 deletions
45
stable/prometheus-operator/templates/prometheus/servicemonitors.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
{{- if and .Values.prometheus.enabled .Values.prometheus.additionalServiceMonitors }} | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
{{- range .Values.prometheus.additionalServiceMonitors }} | ||
- apiVersion: {{ printf "%s/v1" ($.Values.prometheusOperator.crdApiGroup | default "monitoring.coreos.com") }} | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ .name }} | ||
labels: | ||
app: {{ template "prometheus-operator.name" $ }}-prometheus | ||
{{ include "prometheus-operator.labels" $ | indent 8 }} | ||
{{- if .additionalLabels }} | ||
{{ toYaml .additionalLabels | indent 8 }} | ||
{{- end }} | ||
spec: | ||
endpoints: | ||
{{ toYaml .endpoints | indent 8 }} | ||
{{- if .jobLabel }} | ||
jobLabel: {{ .jobLabel }} | ||
apiVersion: {{ printf "%s/v1" ($.Values.prometheusOperator.crdApiGroup | default "monitoring.coreos.com") }} | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ template "prometheus-operator.name" $ }}-{{ .name }} | ||
labels: | ||
app: {{ template "prometheus-operator.name" $ }}-prometheus | ||
{{ include "prometheus-operator.labels" $ | indent 4 }} | ||
{{- if .additionalLabels }} | ||
{{ toYaml .additionalLabels | indent 4 }} | ||
{{- end }} | ||
{{- if .namespaceSelector }} | ||
namespaceSelector: | ||
{{ toYaml .namespaceSelector | indent 8 }} | ||
{{- end }} | ||
selector: | ||
{{ toYaml .selector | indent 8 }} | ||
spec: | ||
endpoints: | ||
{{ toYaml .endpoints | indent 4 }} | ||
{{- if .jobLabel }} | ||
jobLabel: {{ .jobLabel }} | ||
{{- end }} | ||
{{- if .namespaceSelector }} | ||
namespaceSelector: | ||
{{ toYaml .namespaceSelector | indent 4 }} | ||
{{- end }} | ||
selector: | ||
{{ toYaml .selector | indent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters