feat(grafana): support dashboard deployment
This commit is contained in:
parent
2e9eae9888
commit
1e9aeb802d
11
README.md
11
README.md
@ -187,10 +187,13 @@ replaced:
|
|||||||
|
|
||||||
### Grafana
|
### Grafana
|
||||||
|
|
||||||
| Name | Description | Value |
|
| Name | Description | Value |
|
||||||
| ------------------------------------ | --------------------------------------------------------- | ------- |
|
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ----------- |
|
||||||
| `grafana.enabled` | Enable integration into Grafana. | `false` |
|
| `grafana.enabled` | Enable integration into Grafana. Require the Prometheus operator deployment. | `false` |
|
||||||
| `grafana.dashboards.businessMetrics` | Enable deployment of Grafana dashboard `businessMetrics`. | `true` |
|
| `grafana.dashboardDiscoveryLabels` | Labels that Grafana uses to discover resources. The labels may vary depending on the Grafana deployment. | `undefined` |
|
||||||
|
| `grafana.dashboards.postgresExporter.enabled` | Enable deployment of Grafana dashboard `postgresExporter`. | `true` |
|
||||||
|
| `grafana.dashboards.postgresExporter.annotations` | Additional configmap annotations. | `{}` |
|
||||||
|
| `grafana.dashboards.postgresExporter.labels` | Additional configmap labels. | `{}` |
|
||||||
|
|
||||||
### Ingress
|
### Ingress
|
||||||
|
|
||||||
|
20
templates/prometheus-postgres-exporter/_configMap.tpl
Normal file
20
templates/prometheus-postgres-exporter/_configMap.tpl
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/* annotations */}}
|
||||||
|
|
||||||
|
{{- define "prometheus-postgres-exporter.configMap.grafanaDashboards.postgresExporter.annotations" -}}
|
||||||
|
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||||
|
{{- if .Values.grafana.dashboards.postgresExporter.annotations }}
|
||||||
|
{{ toYaml .Values.grafana.dashboards.postgresExporter.annotations }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* labels */}}
|
||||||
|
|
||||||
|
{{- define "prometheus-postgres-exporter.configMap.grafanaDashboards.postgresExporter.labels" -}}
|
||||||
|
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||||
|
{{- if .Values.grafana.dashboards.postgresExporter.labels }}
|
||||||
|
{{ toYaml .Values.grafana.dashboards.postgresExporter.labels }}
|
||||||
|
{{- end }}
|
||||||
|
{{ toYaml .Values.grafana.dashboardDiscoveryLabels }}
|
||||||
|
{{- end }}
|
File diff suppressed because it is too large
Load Diff
79
unittests/configMaps/grafanaDashboardPostgresExporter.yaml
Normal file
79
unittests/configMaps/grafanaDashboardPostgresExporter.yaml
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
chart:
|
||||||
|
appVersion: 0.1.0
|
||||||
|
version: 0.1.0
|
||||||
|
suite: ConfigMap template (Grafana Dashboard PostgresExporter)
|
||||||
|
release:
|
||||||
|
name: prometheus-postgres-exporter-unittest
|
||||||
|
namespace: testing
|
||||||
|
templates:
|
||||||
|
- templates/prometheus-postgres-exporter/configMapGrafanaDashboardPostgresExporter.yaml
|
||||||
|
tests:
|
||||||
|
- it: Rendering postgresExporter
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
|
||||||
|
- it: Rendering
|
||||||
|
set:
|
||||||
|
grafana.enabled: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- containsDocument:
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
name: prometheus-postgres-exporter-unittest-grafana-dashboard-postgres-exporter
|
||||||
|
namespace: testing
|
||||||
|
- notExists:
|
||||||
|
path: metadata.annotations
|
||||||
|
- equal:
|
||||||
|
path: metadata.labels
|
||||||
|
value:
|
||||||
|
app.kubernetes.io/instance: prometheus-postgres-exporter-unittest
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
app.kubernetes.io/name: prometheus-postgres-exporter
|
||||||
|
app.kubernetes.io/version: 0.1.0
|
||||||
|
grafana_dashboard: "1"
|
||||||
|
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
||||||
|
- exists:
|
||||||
|
path: data["postgresExporter.yaml"]
|
||||||
|
|
||||||
|
- it: Test custom annotations and labels
|
||||||
|
set:
|
||||||
|
grafana.enabled: true
|
||||||
|
grafana.dashboards.postgresExporter.annotations:
|
||||||
|
foo: bar
|
||||||
|
grafana.dashboards.postgresExporter.labels:
|
||||||
|
bar: foo
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: metadata.annotations
|
||||||
|
value:
|
||||||
|
foo: bar
|
||||||
|
- equal:
|
||||||
|
path: metadata.labels
|
||||||
|
value:
|
||||||
|
app.kubernetes.io/instance: prometheus-postgres-exporter-unittest
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
app.kubernetes.io/name: prometheus-postgres-exporter
|
||||||
|
app.kubernetes.io/version: 0.1.0
|
||||||
|
grafana_dashboard: "1"
|
||||||
|
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
||||||
|
bar: foo
|
||||||
|
|
||||||
|
- it: Test custom grafana discovery labels
|
||||||
|
set:
|
||||||
|
grafana.enabled: true
|
||||||
|
grafana.dashboardDiscoveryLabels:
|
||||||
|
grafana_dashboard: null
|
||||||
|
my-custom-discovery-label: my-value
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: metadata.labels
|
||||||
|
value:
|
||||||
|
app.kubernetes.io/instance: prometheus-postgres-exporter-unittest
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
app.kubernetes.io/name: prometheus-postgres-exporter
|
||||||
|
app.kubernetes.io/version: 0.1.0
|
||||||
|
my-custom-discovery-label: my-value
|
||||||
|
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
2450
values.schema.json
2450
values.schema.json
File diff suppressed because it is too large
Load Diff
17
values.yaml
17
values.yaml
@ -248,12 +248,23 @@ deployment:
|
|||||||
# secretName: my-secret
|
# secretName: my-secret
|
||||||
|
|
||||||
## @section Grafana
|
## @section Grafana
|
||||||
## @param grafana.enabled Enable integration into Grafana.
|
## @param grafana.enabled Enable integration into Grafana. Require the prometheus operator deployment.
|
||||||
## @param grafana.dashboards.businessMetrics Enable deployment of Grafana dashboard `businessMetrics`.
|
|
||||||
grafana:
|
grafana:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
|
## @param grafana.dashboardDiscoveryLabels Labels that Grafana uses to discover resources. The labels may vary depending on the Grafana deployment.
|
||||||
|
## @skip grafana.dashboardDiscoveryLabels
|
||||||
|
dashboardDiscoveryLabels:
|
||||||
|
grafana_dashboard: "1"
|
||||||
|
|
||||||
dashboards:
|
dashboards:
|
||||||
businessMetrics: true
|
## @param grafana.dashboards.postgresExporter.enabled Enable deployment of Grafana dashboard `postgresExporter`.
|
||||||
|
## @param grafana.dashboards.postgresExporter.annotations Additional configmap annotations.
|
||||||
|
## @param grafana.dashboards.postgresExporter.labels Additional configmap labels.
|
||||||
|
postgresExporter:
|
||||||
|
enabled: true
|
||||||
|
annotations: {}
|
||||||
|
labels: {}
|
||||||
|
|
||||||
## @section Ingress
|
## @section Ingress
|
||||||
ingress:
|
ingress:
|
||||||
|
Loading…
Reference in New Issue
Block a user