How to configure Cloudflare app in Grafana from code?

11/25/2019

I'm using Grafana based on the helm chart, at the moment I have all the configurations as code, the main configuration is placed into the vales.yaml as part of the grafana.ini values, the dashboards and datasources are placed into configmaps per each datasource or dashboard and the sidecar container is in charge of taking them based on the labels.

Now I want to use apps and the first app I'm trying is the Cloudflare app from here, the app is installed correctly using the plugins section in the chart values.yaml but I don't see any documentation of how to pass the email and token of CloudFlare API by configMap or json.

Is it possible? or do I have to configure it manually inside the app settings?

-- wolmi
cloudflare
grafana
kubernetes
kubernetes-helm
monitoring

1 Answer

12/5/2019

Grafana plugins are provisionable datasources.

The CloudFlare App plugin uses "{{.SecureJsonData.token}}" for X-Auth-Key and "{{.JsonData.email}}"} for X-Auth-Email.

You could provision the Cloudflare app plugin datasource with jsonData and secureJsonData you like to use.

The datasource name is the id given in Cloudflare app plugin plugin.yaml file.

You may configure jsonData and secureJsonData for this datasource in datasources field in values.yaml.

For example,

datasources: 
  datasources.yaml:
    apiVersion: 1
    datasources:
    - name: cloudflare-app
      jsonData:
        email: bilbo@shi.re
      secureJsonData:
        token: extra-tolkien
-- Oluwafemi Sule
Source: StackOverflow