This document describes how to create data sources.
The operator uses a list of set based selectors to discover dataSources by their labels. The dataSourceLabelSelector
property of the Grafana
resource allows you to add selectors by which the dataSources will be filtered.
NOTE: If no datasourceLabelSelector
is present, the operator will not discover any dataSources. The same goes for dataSources without labels, they will not be discovered by the operator.
Every selector can have a list of matchLabels
and matchExpressions
. The rules inside a single selector will be ANDed, while the list of selectors is evaluated with OR.
For example, the following selector:
datasourceLabelSelector:
- matchExpressions:
- {key: app, operator: In, values: [grafana]}
- {key: group, operator: In, values: [grafana]}
requires the dataSource to have two labels, app
and group
and each label is required to have a value of grafana
.
To accept either, the app
or the group
label, you can write the selector in the following way:
datasourceLabelSelector:
- matchExpressions:
- {key: app, operator: In, values: [grafana]}
- matchExpressions:
- {key: group, operator: In, values: [grafana]}
Data sources are represented by the GrafanaDataSource
custom resource. Examples can be found in deploy/examples/datasources
.
The following properties are accepted in the spec
:
- datasources: data source definitions. Check the official documentation.
A data source accepts all properties listed here, but does not support apiVersion
and deleteDatasources
.