Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
[stable/prometheus-operator] possibility to add annotations to defaul…
Browse files Browse the repository at this point in the history
…t dashboards (#22900)

* adapt sync script to add annotations to dashboards

Signed-off-by: Marius Svechla <m.svechla@gmail.com>

* run sync_grafana_dashboards, add new value to values.yaml

Signed-off-by: Marius Svechla <m.svechla@gmail.com>

* update readme for new grafana.sidecar.dashboards.annotations variable

Signed-off-by: Marius Svechla <m.svechla@gmail.com>

* rebase

Signed-off-by: Marius Svechla <m.svechla@gmail.com>

* fix trailing spaces

Signed-off-by: Marius Svechla <m.svechla@gmail.com>

* fix namespace template
Signed-off-by: Marius Svechla <m.svechla@gmail.com>

* re-run sync_grafana_dashboards
Signed-off-by: Marius Svechla <m.svechla@gmail.com>
  • Loading branch information
msvechla committed Jul 9, 2020
1 parent b20d5fd commit eaad481
Show file tree
Hide file tree
Showing 40 changed files with 233 additions and 52 deletions.
2 changes: 1 addition & 1 deletion stable/prometheus-operator/Chart.yaml
Expand Up @@ -12,7 +12,7 @@ sources:
- https://github.com/coreos/kube-prometheus
- https://github.com/coreos/prometheus-operator
- https://coreos.com/operators/prometheus
version: 8.15.14
version: 8.16.0
appVersion: 0.38.1
tillerVersion: ">=2.12.0"
home: https://github.com/coreos/prometheus-operator
Expand Down
1 change: 1 addition & 0 deletions stable/prometheus-operator/README.md
Expand Up @@ -468,6 +468,7 @@ For a full list of configurable values please refer to the [Grafana chart](https
| `grafana.serviceMonitor.relabelings` | The `relabel_configs` for scraping the grafana instance. | `` |
| `grafana.serviceMonitor.selfMonitor` | Create a `serviceMonitor` to automatically monitor the grafana instance | `true` |
| `grafana.sidecar.dashboards.enabled` | Enable the Grafana sidecar to automatically load dashboards with a label `{{ grafana.sidecar.dashboards.label }}=1` | `true` |
| `grafana.sidecar.dashboards.annotations` | Create annotations on dashboard configmaps | `{}` |
| `grafana.sidecar.dashboards.label` | If the sidecar is enabled, configmaps with this label will be loaded into Grafana as dashboards | `grafana_dashboard` |
| `grafana.sidecar.datasources.annotations` | Create annotations on datasource configmaps | `{}` |
| `grafana.sidecar.datasources.createPrometheusReplicasDatasources` | Create datasource for each Pod of Prometheus StatefulSet i.e. `Prometheus-0`, `Prometheus-1` | `false` |
Expand Down
4 changes: 3 additions & 1 deletion stable/prometheus-operator/hack/sync_grafana_dashboards.py
Expand Up @@ -78,8 +78,10 @@ def new_representer(dumper, data):
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ $.Release.Namespace }}
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%%s-%%s" (include "prometheus-operator.fullname" $) "%(name)s" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down
Expand Up @@ -10,6 +10,8 @@ kind: ConfigMap
metadata:
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "apiserver" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -171,6 +173,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -364,6 +367,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -471,6 +475,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -563,6 +568,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -862,6 +868,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -954,6 +961,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1058,6 +1066,7 @@ data:
"min": false,
"rightSide": false,
"show": false,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1149,6 +1158,7 @@ data:
"min": false,
"rightSide": false,
"show": false,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1240,6 +1250,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -1344,6 +1355,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1435,6 +1447,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1533,6 +1546,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1644,6 +1658,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1735,6 +1750,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1826,6 +1842,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -2013,7 +2030,7 @@ data:
"30d"
]
},
"timezone": "",
"timezone": "UTC",
"title": "Kubernetes / API server",
"uid": "09ec8aa1e996d6ffcd6817bbaff4db1b",
"version": 0
Expand Down
Expand Up @@ -10,6 +10,8 @@ kind: ConfigMap
metadata:
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "cluster-total" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -94,6 +96,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"sort": "current",
"sortDesc": true,
"total": false,
Expand Down Expand Up @@ -195,6 +198,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"sort": "current",
"sortDesc": true,
"total": false,
Expand Down Expand Up @@ -634,6 +638,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"sort": "current",
"sortDesc": true,
"total": false,
Expand Down Expand Up @@ -735,6 +740,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"sort": "current",
"sortDesc": true,
"total": false,
Expand Down Expand Up @@ -866,6 +872,7 @@ data:
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -965,6 +972,7 @@ data:
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -1075,6 +1083,7 @@ data:
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -1174,6 +1183,7 @@ data:
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -1293,6 +1303,7 @@ data:
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -1392,6 +1403,7 @@ data:
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -1491,6 +1503,7 @@ data:
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -1594,6 +1607,7 @@ data:
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -1819,7 +1833,7 @@ data:
"30d"
]
},
"timezone": "",
"timezone": "UTC",
"title": "Kubernetes / Networking / Cluster",
"uid": "ff635a025bcfea7bc3dd4f508990a3e9",
"version": 0
Expand Down
Expand Up @@ -10,6 +10,8 @@ kind: ConfigMap
metadata:
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "controller-manager" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand Down Expand Up @@ -149,6 +151,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -253,6 +256,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -357,6 +361,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -461,6 +466,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -573,6 +579,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -677,6 +684,7 @@ data:
"min": false,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
Expand Down Expand Up @@ -781,6 +789,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -872,6 +881,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -963,6 +973,7 @@ data:
"min": false,
"rightSide": false,
"show": true,
"sideWidth": null,
"total": false,
"values": false
},
Expand Down Expand Up @@ -1123,7 +1134,7 @@ data:
"30d"
]
},
"timezone": "",
"timezone": "UTC",
"title": "Kubernetes / Controller Manager",
"uid": "72e0e05bef5099e5f049b05fdc429ed4",
"version": 0
Expand Down
Expand Up @@ -10,6 +10,8 @@ kind: ConfigMap
metadata:
namespace: {{ template "prometheus-operator.namespace" . }}
name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "etcd" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "1"
Expand All @@ -26,7 +28,6 @@ data:
"editable": true,
"gnetId": null,
"hideControls": false,
"id": 6,
"links": [],
"refresh": "10s",
"rows": [
Expand Down Expand Up @@ -1109,6 +1110,7 @@ data:
},
"timezone": "browser",
"title": "etcd",
"uid": "c2f4e12cdf69feb95caa41a5a1b423d9",
"version": 215
}
{{- end }}

0 comments on commit eaad481

Please sign in to comment.