apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-logging-8.5.8-d2iq-defaults
  namespace: ${releaseNamespace}
data:
  values.yaml: |
    ---
    priorityClassName: "dkp-critical-priority"
    datasources:
      datasources.yaml:
        apiVersion: 1
        datasources:
        - name: Loki
          type: loki
          url: "http://grafana-loki-loki-distributed-gateway"
          access: proxy
          isDefault: false
    ingress:
      enabled: true
      annotations:
        kubernetes.io/ingress.class: kommander-traefik
        ingress.kubernetes.io/auth-response-headers: X-Forwarded-User
        traefik.ingress.kubernetes.io/router.tls: "true"
        traefik.ingress.kubernetes.io/router.middlewares: "${workspaceNamespace}-stripprefixes@kubernetescrd,${workspaceNamespace}-forwardauth@kubernetescrd"
      hosts: [""]
      path: /dkp/logging/grafana
      pathType: ImplementationSpecific

    sidecar:
      image:
        registry: docker.io
        repository: kiwigrid/k8s-sidecar
        tag: 1.28.0

      dashboards:
        enabled: true
        label: grafana_logging_dashboard
        searchNamespace: ALL

    grafana.ini:
      log:
        level: warn
      server:
        protocol: http
        enable_gzip: true
        root_url: "%(protocol)s://%(domain)s:%(http_port)s/dkp/logging/grafana"
        serve_from_sub_path: true
      auth.proxy:
        enabled: true
        header_name: X-Forwarded-User
        auto-sign-up: true
      auth.basic:
        enabled: false
      users:
        auto_assign_org_role: Admin
      plugins:
        allow_loading_unsigned_plugins: "grafana-piechart-panel"
      analytics:
        reporting_enabled: false
        check_for_updates: false

    service:
      type: ClusterIP
      port: 3000
      labels:
        servicemonitor.kommander.mesosphere.io/path: "metrics"

    resources:
      # keep request = limit to keep this container in guaranteed class
      limits:
        cpu: 300m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi

    readinessProbe:
      httpGet:
        path: /api/health
        port: 3000
        scheme: HTTP
    livenessProbe:
      httpGet:
        path: /api/health
        port: 3000
        scheme: HTTP
      initialDelaySeconds: 60
      timeoutSeconds: 30
      failureThreshold: 10
    rbac:
      pspUseAppArmor: false
      pspEnabled: false
    # to avoid needing to download any plugins at runtime, use a container and a shared volume
    # do not enable the plugins here, instead rebuild the mesosphere/grafana-plugins image with the new plugins
    plugins: []
    #  - grafana-piechart-panel
    extraEmptyDirMounts:
      - name: plugins
        mountPath: /var/lib/grafana/plugins/
    extraInitContainers:
      - name: grafana-plugins-install
        image: ghcr.io/mesosphere/dkp-container-images/docker.io/mesosphere/grafana-plugins:v0.0.1-d2iq.0
        command: ["/bin/sh", "-c", "cp -a /var/lib/grafana/plugins/. /var/lib/grafana/shared-plugins/"]
        volumeMounts:
        - name: plugins
          mountPath: /var/lib/grafana/shared-plugins/