From c1f533f7da99e3c02b8ab75a130dc555fc6cb648 Mon Sep 17 00:00:00 2001 From: Frederic Hemberger Date: Fri, 11 Oct 2019 08:59:58 +0200 Subject: [PATCH] [stable/prometheus-postgres-exporter] Add feature 'auto-discover-databases' (#17826) Ref: https://github.com/wrouesnel/postgres_exporter#automatically-discover-databases Signed-off-by: Frederic Hemberger --- stable/prometheus-postgres-exporter/Chart.yaml | 2 +- stable/prometheus-postgres-exporter/README.md | 2 ++ .../templates/deployment.yaml | 9 ++++++++- stable/prometheus-postgres-exporter/values.yaml | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/stable/prometheus-postgres-exporter/Chart.yaml b/stable/prometheus-postgres-exporter/Chart.yaml index b631224004..f5423484e3 100644 --- a/stable/prometheus-postgres-exporter/Chart.yaml +++ b/stable/prometheus-postgres-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "0.5.1" description: A Helm chart for prometheus postgres-exporter name: prometheus-postgres-exporter -version: 1.0.0 +version: 1.1.0 home: https://github.com/wrouesnel/postgres_exporter sources: - https://github.com/wrouesnel/postgres_exporter diff --git a/stable/prometheus-postgres-exporter/README.md b/stable/prometheus-postgres-exporter/README.md index 56d3221a9b..6043337899 100644 --- a/stable/prometheus-postgres-exporter/README.md +++ b/stable/prometheus-postgres-exporter/README.md @@ -57,6 +57,8 @@ The following table lists the configurable parameters of the postgres Exporter c | `config.datasource` | Postgresql datasource configuration | see [values.yaml](values.yaml) | | `config.queries` | SQL queries that the exporter will run | [postgres exporter defaults](https://github.com/wrouesnel/postgres_exporter/blob/master/queries.yaml) | | `config.disableDefaultMetrics` | Specifies whether to use only metrics from `queries.yaml`| `false` | +| `config.autoDiscoverDatabases` | Specifies whether to autodiscover all databases | `false` | +| `config.excludeDatabases` | When autodiscover is enabled, list databases to exclude| `[]` | | `rbac.create` | Specifies whether RBAC resources should be created.| `true` | | `rbac.pspEnabled` | Specifies whether a PodSecurityPolicy should be created.| `true` | | `serviceAccount.create` | Specifies whether a service account should be created.| `true` | diff --git a/stable/prometheus-postgres-exporter/templates/deployment.yaml b/stable/prometheus-postgres-exporter/templates/deployment.yaml index 7576241bd3..e0b2c3d8d5 100644 --- a/stable/prometheus-postgres-exporter/templates/deployment.yaml +++ b/stable/prometheus-postgres-exporter/templates/deployment.yaml @@ -28,7 +28,7 @@ spec: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} {{- if .Values.annotations }} {{ toYaml .Values.annotations | indent 8 }} -{{- end}} +{{- end }} spec: serviceAccountName: {{ template "prometheus-postgres-exporter.serviceAccountName" . }} containers: @@ -38,6 +38,13 @@ spec: {{- if .Values.config.disableDefaultMetrics }} - "--disable-default-metrics" {{- end }} + {{- if .Values.config.autoDiscoverDatabases }} + - "--auto-discover-databases" + {{- if .Values.config.excludeDatabases }} + - "--exclude-databases" + - {{ .Values.config.excludeDatabases | join "," }} + {{- end }} + {{- end }} env: - name: DATA_SOURCE_URI value: {{ template "prometheus-postgres-exporter.data_source_uri" . }} diff --git a/stable/prometheus-postgres-exporter/values.yaml b/stable/prometheus-postgres-exporter/values.yaml index f24fcfa2c1..f770b4a415 100644 --- a/stable/prometheus-postgres-exporter/values.yaml +++ b/stable/prometheus-postgres-exporter/values.yaml @@ -75,6 +75,8 @@ config: database: '' sslmode: disable disableDefaultMetrics: false + autoDiscoverDatabases: false + excludeDatabases: [] # this are the defaults queries that the exporter will run, extracted from: https://github.com/wrouesnel/postgres_exporter/blob/master/queries.yaml queries: |- pg_replication: