kube-prometheus
kube-prometheus copied to clipboard
grafana: set `isDefault` to true for single prometheus data source
Hello! Thank you for the great work on this project.
I'd love for the Prometheus in kube-prometheus to be configured as an isDefault: true
data source in Grafana.
That parameter is documented with
# <bool> Toggles whether the data source is pre-selected
# for new panels. You can set only one default
# data source per organization.
isDefault:
(https://grafana.com/docs/grafana/latest/administration/provisioning/).
When trying to (re)use the same dashboard JSON definition across various Grafana deployments it makes sense to rely on a sane 'default' data source. In the dashboard JSON definition it can then be pre-selected with
"current": {
"selected": true,
"text": "default",
"value": "default"
},
Currently, grafana-dashboardDatasources.yaml
is generated by kube-prometheus with these details:
stringData:
datasources.yaml: |-
{
"apiVersion": 1,
"datasources": [
{
"access": "proxy",
"editable": false,
"name": "prometheus",
"orgId": 1,
"type": "prometheus",
"url": "http://prometheus-k8s.monitoring.svc:9090",
"version": 1
}
]
}
type: Opaque
That is, we do not define the isDefault
parameter on the Grafana datasource.
I am looking at https://github.com/prometheus-operator/kube-prometheus/issues/1316#issuecomment-897460827 and there probably is a way to set the isDefault: true
via my custom jsonnet stack configuration. (how would I do that?)
But in the longer run, I wonder: why not set isDefault: true
by default here? When there's just one data source defined this cannot hurt.
Here's an example showing the "default" toggle in the UI: