---
apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-operator-default
  namespace: monitoring-system
data:
  values.yaml: |
    operator:
      prometheus:
        serviceMonitor:
          enabled: true
      args:
        scanAllNamespaces: true
    grafana:
      ingress:
        enabled: true
        tls: true
        tlsSecret: grafana-tls-secret
        annotations:
          kubernetes.io/ingress.class: "management-system"
      dashboardLabelSelectors:
      - matchExpressions:
          - {key: "app.kubernetes.io/instance", operator: In, values: [grafana]}
      - matchExpressions:
          - {key: "platform.das-schiff.io/grafana", operator: In, values: [monitoring]}
      jsonnetLibrarySelector:
        matchLabels:
          platform.das-schiff.io/grafana: monitoring
      config:
        server:
          root_url: |-
            {{- if .Values.grafana.ingress.enabled }}
            {{ if .Values.grafana.ingress.tls }}https{{ else }}http{{ end }}://{{ .Values.grafana.ingress.hostname }}:{{ if .Values.grafana.ingress.tls }}8443{{ else }}8080{{ end }}
            {{- else }}
            http://localhost:3000
            {{- end }}
        log:
          mode: "console"
          level: "error"
        security:
          disable_gravatar: true
        auth:
          disable_login_form: true
          disable_signout_menu: true
        auth.generic_oauth:
          enabled: true
          client_id: grafana
          client_secret: 29e7746f-b433-4dd4-a1b7-99ccb3d568db
          scopes: profile email
          auth_url: https://keycloak.das-schiff.io/auth/realms/schiff/protocol/openid-connect/auth
          token_url: https://keycloak.das-schiff.io/auth/realms/schiff/protocol/openid-connect/token
          api_url: https://keycloak.das-schiff.io/auth/realms/schiff/protocol/openid-connect/userinfo
          allowed_domains: das-schiff.io
          allow_sign_up: true
