A Kubernetes Operator based on the Operator SDK for creating and managing Grafana instances.
The Operator is functional and can deploy and manage a Grafana instance on Kubernetes and OpenShift. The following features are supported:
- Install Grafana to a namespace
- Import Grafana dashboards from the same or other namespaces
- Import Grafana datasources from the same namespace
- Install Plugins (panels) defined as dependencies of dashboards
The operator supports the following flags on startup:
- --grafana-image: overrides the Grafana image, defaults to
docker.io/grafana/grafana
. - --grafana-image-tag: overrides the Grafana tag, defaults to
5.4.2
. - --grafana-plugins-init-container-image: overrides the Grafana Plugins Init Container image, defaults to
quay.io/integreatly/grafana_plugins_init
. - --grafana-plugins-init-container-tag: overrides the Grafana Plugins Init Container tag, defaults to
0.0.2
. - --scan-all: watch for dashboards in all namespaces. This requires the the operator service account to have cluster wide permissions to
get
,list
,update
andwatch
dashboards. Seedeploy/cluster_roles
. - --openshift: force the operator to use a route instead of an ingress. Note that routes are only supported on OpenShift.
Flags can be passed as args
to the container.
The following Grafana resources are supported:
- Grafana
- GrafanaDashboard
- GrafanaDatasource
all custom resources use the api group integreatly.org
and version v1alpha1
.
Represents a Grafana instance. See the documentation for a description of properties supported in the spec.
Represents a Grafana dashboard and allows to specify required plugins. See the documentation for a description of properties supported in the spec.
Represents a Grafana datasource. See the documentation for a description of properties supported in the spec.
You can run the Operator locally against a remote namespace using the operator-sdk:
Prerequisites:
- operator-sdk installed
- kubectl pointing to the local context. minikube automatically sets the context to the local VM. If not you can use
kubectl config use <context>
or (if using the OpenShift CLI)oc login -u <user> <url>
$ operator-sdk up local --namespace=<namespace> --operator-flags="<flags to pass>"