Cross namespace

If you want your dashboard or datasource to be able to be used by a grafana instance in another namespace you need to set spec.allowCrossNamespaceImport: true.

In the resources file you will find examples how to do this.

apiVersion: v1
kind: Namespace
metadata:
  name: grafana-a
---
apiVersion: v1
kind: Namespace
metadata:
  name: grafana-b
---
apiVersion: grafana.integreatly.org/v1beta1
kind: Grafana
metadata:
  name: grafana
  namespace: grafana-a
  labels:
    dashboards: "grafana"
spec:
  config:
    log:
      mode: "console"
    auth:
      disable_login_form: "false"
    security:
      admin_user: root
      admin_password: secret
  deployment:
    spec:
      template:
        spec:
          containers:
            - name: grafana
              securityContext:
                allowPrivilegeEscalation: true
                readOnlyRootFilesystem: false
              readinessProbe:
                failureThreshold: 3
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
metadata:
  name: example-grafanadatasource
  namespace: grafana-b
spec:
  allowCrossNamespaceImport: true
  datasource:
    access: proxy
    database: prometheus
    jsonData:
      timeInterval: 5s
      tlsSkipVerify: true
    name: Prometheus
    url: http://prometheus-service:9090
  instanceSelector:
    matchLabels:
      dashboards: grafana