[stable/elasticsearch-exporter] Allow PrometheusRules to be templated. (#20322)

Also fix README to add missing desaintmartin OWNER.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
This commit is contained in:
Cédric de Saint Martin
2020-02-11 21:14:07 -08:00
committed by GitHub
parent 8491cc0069
commit 42014f54f3
4 changed files with 35 additions and 18 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
apiVersion: v1
description: Elasticsearch stats exporter for Prometheus
name: elasticsearch-exporter
version: 2.3.0
version: 3.0.0
kubeVersion: ">=1.10.0-0"
appVersion: 1.1.0
home: https://github.com/justwatchcom/elasticsearch_exporter
@@ -16,3 +16,5 @@ maintainers:
email: sven.mueller@commercetools.com
- name: caarlos0
email: carlos@carlosbecker.com
- name: desaintmartin
email: cedric@desaintmartin.fr
+13 -1
View File
@@ -101,7 +101,7 @@ Parameter | Description | Default
`prometheusRule.enabled` | If true, a PrometheusRule CRD is created for a prometheus operator | `false`
`prometheusRule.namespace` | If set, the PrometheusRule will be installed in a different namespace | `""`
`prometheusRule.labels` | Labels for prometheus operator | `{}`
`prometheusRule.rules` | List of Prometheus rules | `[]`
`prometheusRule.rules` | List of [PrometheusRules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) to be created, check values for an example. | `[]`
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
@@ -119,3 +119,15 @@ $ helm install --name my-release -f values.yaml stable/elasticsearch-exporter
```
> **Tip**: You can use the default [values.yaml](values.yaml)
## Upgrading an existing Release to a new major version
A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an
incompatible breaking change needing manual actions.
### To 3.0.0
`prometheusRule.rules` are now processed as Helm template, allowing to set variables in them.
This means that if a rule contains a {{ $value }}, Helm will try replacing it and probably fail.
You now need to escape the rules (see `values.yaml`) for examples.
@@ -4,21 +4,21 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ template "elasticsearch-exporter.fullname" . }}
{{- if .Values.prometheusRule.namespace }}
{{- if .Values.prometheusRule.namespace }}
namespace: {{ .Values.prometheusRule.namespace }}
{{- end }}
{{- end }}
labels:
chart: {{ template "elasticsearch-exporter.chart" . }}
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.prometheusRule.labels }}
{{- toYaml .Values.prometheusRule.labels | nindent 4 }}
{{- end }}
{{- if .Values.prometheusRule.labels }}
{{- toYaml .Values.prometheusRule.labels | nindent 4 }}
{{- end }}
spec:
{{- with .Values.prometheusRule.rules }}
{{- with .Values.prometheusRule.rules }}
groups:
- name: {{ template "elasticsearch-exporter.name" $ }}
rules: {{- toYaml . | nindent 4 }}
{{- end }}
- name: {{ template "elasticsearch-exporter.name" $ }}
rules: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- end }}
+10 -7
View File
@@ -159,32 +159,35 @@ prometheusRule:
## If true, a PrometheusRule CRD is created for a prometheus operator
## https://github.com/coreos/prometheus-operator
##
## The rules will be processed as Helm template, allowing to set variables in them.
enabled: false
# namespace: monitoring
labels: {}
rules: []
# - record: elasticsearch_filesystem_data_used_percent
# expr: 100 * (elasticsearch_filesystem_data_size_bytes - elasticsearch_filesystem_data_free_bytes)
# / elasticsearch_filesystem_data_size_bytes
# expr: |
# 100 * (elasticsearch_filesystem_data_size_bytes{service="{{ template "elasticsearch-exporter.fullname" . }}"} - elasticsearch_filesystem_data_free_bytes{service="{{ template "elasticsearch-exporter.fullname" . }}"})
# / elasticsearch_filesystem_data_size_bytes{service="{{ template "elasticsearch-exporter.fullname" . }}"}
# - record: elasticsearch_filesystem_data_free_percent
# expr: 100 - elasticsearch_filesystem_data_used_percent
# expr: 100 - elasticsearch_filesystem_data_used_percent{service="{{ template "elasticsearch-exporter.fullname" . }}"}
# - alert: ElasticsearchTooFewNodesRunning
# expr: elasticsearch_cluster_health_number_of_nodes < 3
# expr: elasticsearch_cluster_health_number_of_nodes{service="{{ template "elasticsearch-exporter.fullname" . }}"} < 3
# for: 5m
# labels:
# severity: critical
# annotations:
# description: There are only {{$value}} < 3 ElasticSearch nodes running
# description: There are only {{ "{{ $value }}" }} < 3 ElasticSearch nodes running
# summary: ElasticSearch running on less than 3 nodes
# - alert: ElasticsearchHeapTooHigh
# expr: elasticsearch_jvm_memory_used_bytes{area="heap"} / elasticsearch_jvm_memory_max_bytes{area="heap"}
# expr: |
# elasticsearch_jvm_memory_used_bytes{service="{{ template "elasticsearch-exporter.fullname" . }}", area="heap"} / elasticsearch_jvm_memory_max_bytes{service="{{ template "elasticsearch-exporter.fullname" . }}", area="heap"}
# > 0.9
# for: 15m
# labels:
# severity: critical
# annotations:
# description: The heap usage is over 90% for 15m
# summary: ElasticSearch node {{$labels.node}} heap usage is high
# summary: ElasticSearch node {{ "{{ $labels.node }}" }} heap usage is high
# Create a service account
# To use a service account not handled by the chart, set the name here