From 2d481f0cdcfddea5ce9752a58409030e7a6b3a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Minaud?= Date: Mon, 19 Jul 2021 12:00:35 +0200 Subject: [PATCH] [bitnami/thanos] Add Prometheus alerts for Thanos components (#6776) * [bitnami/thanos] Add Prometheus alerts for Thanos components * Revert "[bitnami/thanos] Add Prometheus alerts for Thanos components" * [bitnami/thanos] Add Prometheus alerts for Thanos components * Bump chart version * Set up empty the default namespace value and include additionalLabels * Include additionalLabels and delete default namespace value * Remove whitespaces * Bump minor version instead of patch version. Co-authored-by: Francois Minaud Co-authored-by: alvneiayu --- bitnami/thanos/Chart.yaml | 2 +- bitnami/thanos/README.md | 5 ++++ bitnami/thanos/templates/prometheusrule.yaml | 23 ++++++++++++++++ bitnami/thanos/values.yaml | 28 ++++++++++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 bitnami/thanos/templates/prometheusrule.yaml diff --git a/bitnami/thanos/Chart.yaml b/bitnami/thanos/Chart.yaml index 882f07af4..a5415ce17 100644 --- a/bitnami/thanos/Chart.yaml +++ b/bitnami/thanos/Chart.yaml @@ -28,4 +28,4 @@ name: thanos sources: - https://github.com/bitnami/bitnami-docker-thanos - https://thanos.io -version: 5.1.1 +version: 5.2.0 diff --git a/bitnami/thanos/README.md b/bitnami/thanos/README.md index c8a1866a5..74c0ca522 100644 --- a/bitnami/thanos/README.md +++ b/bitnami/thanos/README.md @@ -646,6 +646,11 @@ The following tables lists the configurable parameters of the Thanos chart and t | `metrics.serviceMonitor.labels` | Additional labels for ServiceMonitor | `{}` | | `metrics.serviceMonitor.interval` | Interval at which metrics should be scraped. | `nil` (Prometheus Operator default value) | | `metrics.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended | `nil` (Prometheus Operator default value) | +| `metrics.prometheusRule.enabled` | if `true`, creates a Prometheus Operator PrometheusRule (also requires `metrics.enabled` to be `true`) | `false` | +| `metrics.prometheusRule.namespace` | Namespace in which the PrometheusRule will be created | `nil` | +| `metrics.prometheusRule.additionalLabels` | Additional labels for the prometheusRule | `{}` | +| `metrics.prometheusRule.rules` | Prometheus Rules for Thanos components | | + ### Volume Permissions parameters diff --git a/bitnami/thanos/templates/prometheusrule.yaml b/bitnami/thanos/templates/prometheusrule.yaml new file mode 100644 index 000000000..dd086d705 --- /dev/null +++ b/bitnami/thanos/templates/prometheusrule.yaml @@ -0,0 +1,23 @@ +{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ template "common.names.fullname" . }} + {{- if .Values.metrics.prometheusRule.namespace }} + namespace: {{ .Values.metrics.prometheusRule.namespace }} + {{- else }} + namespace: {{ .Release.Namespace | quote }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.metrics.prometheusRule.additionalLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.prometheusRule.additionalLabels "context" $) | nindent 4 }} + {{- end }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.rules "context" $ ) | nindent 2 }} +{{- end }} diff --git a/bitnami/thanos/values.yaml b/bitnami/thanos/values.yaml index 11cedb05e..182ab87fd 100644 --- a/bitnami/thanos/values.yaml +++ b/bitnami/thanos/values.yaml @@ -2621,6 +2621,34 @@ metrics: ## # scrapeTimeout: 10s + ## PrometheusRule CRD configuration + ## + prometheusRule: + enabled: false + ## Namespace in which the PrometheusRule CRD is created + ## + namespace: + ## Additional labels for the prometheusRule + ## + additionalLabels: {} + ## List of group of rules and their rules + ## + ## These are just examples rules, please adapt them to your needs. + ## rules: | + ## groups: + ## - name: Compactor + ## rules: + ## - alert: ThanosCompactMultipleRunning + ## annotations: + ## description: No more than one Thanos Compact instance should be running at once. There are {{`{{`}}$value{{`}}`}} instances running. + ## runbook_url: https://github.com/thanos-io/thanos/tree/main/mixin/runbook.md#alert-name-thanoscompactmultiplerunning + ## summary: Thanos Compact has multiple instances running. + ## expr: sum by (job) (up{job=~"{{ template "common.names.fullname" . }}-compact.*"}) > 1 + ## for: 5m + ## labels: + ## severity: warning + rules: [] + ## Init Container parameters ## Change the owner and group of the persistent volume(s) mountpoint(s) to 'runAsUser:fsGroup' on each component ## values from the securityContext section of the component