Parameters

The parent key for all of the following parameters is grafana_helm.

namespace

type

string

default

syn-grafana

The namespace in which to deploy this component.

createNamespace

type

boolean

default

true

Whether to create the namespace specified in namespace.

namespaceLabels

type

object

default

{}

Additional labels to add to the namespace specified in namespace. The component sets the openshift.io/cluster-monitoring: "true" label on the namespace.

namespaceAnnotations

type

object

default

{}

Additional annotations to add to the namespace specified in namespace.

secrets

type

object

default

{}

example
secrets:
  grafana-admin-user:
    stringData:
      admin-user: admin
      admin-password: password

helm_values:
  admin:
    existingSecret: grafana-admin-user

A dictionary holding secrets for use with Grafana. Each key in the dictionary is used as the name of a secret. The value of the key is merged directly into an empty Kubernetes Secret resource. By default, secrets are created in the namespace in which Grafana is deployed.

dashboards

type

object

default

{}

An object with dashboards to provision.

datasources

type

object

default

{}

An object with datasources to provision.

extraConfigMap

type

object

default

{}

An object with extra ConfgiMaps to be deployed

openshiftIntegration

Configuration options for tight integration in OpenShift.

openshiftIntegration.enabled

type

boolean

default

false

Enables configuration for OpenShift integration.

Enabling OpenShift integration will configure various Helm values and create the neccessary resources for Grafana to authenticate agains OpenShift and have datasources for the OpenShift observation stack.

openshiftIntegration.appsDomain

type

string

default

''

This parameter must be set to the OpenShift cluster’s default apps domain. When the parameter is empty or null, the component raises a compilation error.

We recommend that you track the OpenShift apps default apps domain in a central Project Syn parameter and use a Reclass reference to set this parameter.

For example, VSHN uses inventory parameter openshift.appsDomain to track the default apps domain centrally, so we’re setting this parameter to ${openshift:appsDomain} in our global defaults.

openshiftIntegration.auth

type

object

default
openshiftIntegration:
  auth:
    adminUser: 'admin'
    adminPassword: '?{vaultkv:${cluster:tenant}/${cluster:name}/${_instance}/admin_password}'
    scopes: 'user:info user:check-access user:list-projects'
    roleAttributePath: "contains(groups[*], 'openshiftroot') && 'GrafanaAdmin' || 'Editor'"

openshiftIntegration.ingress

type

object

default
openshiftIntegration:
  ingress:
    urlPrefix: ${_instance}

The URL the Grafana instance will be published under has the form <urlPrefix>.<appsDomain>. See component parameter openshiftIntegration.appsDomain for details on the URL suffix.

openshiftIntegration.metrics

type

object

default
openshiftIntegration:
  metrics:
    enabled: true (1)
    name: Prometheus (2)
1 Enable this datasource.
2 Name of the datasource.

Integrating OpenShift metrics.

openshiftIntegration.logsApps

type

object

default
openshiftIntegration:
  logsApps:
    enabled: true (1)
    name: OpenShift Logging (Application) (2)
1 Enable this datasource.
2 Name of the datasource.

Inegrate OpenShift Application logs.

openshiftIntegration.logsInfra

type

object

default
openshiftIntegration:
  logsInfra:
    enabled: true (1)
    name: OpenShift Logging (Infrastructure) (2)
1 Enable this datasource.
2 Name of the datasource.

Integrate OpenShift Infrastructure logs.

openshiftIntegration.logsAudit

type

object

default
openshiftIntegration:
  logsAudit:
    enabled: false (1)
    name: OpenShift Logging (Audit) (2)
1 Enable this datasource.
2 Name of the datasource.

Integrate OpenShift Audit logs.

openshiftIntegration.metricsRoute

type

object

default
openshiftIntegration:
  metricsRoute:
    enabled: true

Renders a second OpenShift Route on path /metrics on the same host which ensures that the /metrics endpoint is not exposed.

helm_values

type

object

default
helm_values:
  serviceMonitor:
    enabled: true
  testFramework:
    enabled: false
  initChownData:
    enabled: false
  deploymentStrategy:
    type: Recreate

Values passed to Helm.

The component enables Grafana’s /metrics endpoint (grafana.ini.metrics.enabled: true) by default and renders the chart’s ServiceMonitor, so Grafana’s built-in Prometheus metrics are scraped out of the box. On OpenShift, the ServiceMonitor is configured to scrape over HTTPS (scheme: https, tlsConfig.insecureSkipVerify: true) to match the HTTPS-serving Grafana instance.

rules

type

object

default
rules:
  grafana-helm:
    alert:GrafanaDatasourceErrors:
      expr: 'sum by (datasource, datasource_type, code) (rate(grafana_datasource_request_total{code!="200"}[5m])) > 0'
      for: 30m
      labels:
        severity: warning
      annotations:
        summary: 'Grafana datasource {{ $labels.datasource }} is returning errors'
        description: 'Datasource {{ $labels.datasource }} ({{ $labels.datasource_type }}) has been returning errors for 30 minutes.'

The component renders a PrometheusRule (40_alerts/prometheusrule.yaml) from this parameter.

Default alert: GrafanaDatasourceErrors

name

GrafanaDatasourceErrors

expression

sum by (datasource, datasource_type) (rate(grafana_datasource_request_total{code!="200"}[5m])) > 0

for

30m

severity

warning

Fires when a Grafana datasource keeps returning errors for 30 minutes. It relies on Grafana’s built-in grafana_datasource_request_total counter, which is exposed on the /metrics endpoint (enabled by default) and scraped by the ServiceMonitor.

Example

namespace: example-namespace
dashboards:
  dashboard-crossplane: |-
    {
      "annotations": {
        "list": [
          {
            "builtIn": 1,
            "datasource": "-- Grafana --",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "type": "dashboard"
          }
        ]
      },
      [...]
datasources:
    'datasource.yaml': |-
        apiVersion: 1
        datasources:
        - name: Prometheus
            type: prometheus
            url: http://prometheus-svc
            access: proxy
            isDefault: true
extraConfigMap:
  'nginx.conf': "# My NGINX config File"