rancher / rancher

Complete container management platform
http://rancher.com
Apache License 2.0
23.32k stars 2.96k forks source link

[BUG] Grafana dashboards from yaml config maps not working after upgrade to rancher monitoring 100.2.0+up40.1.2 #41237

Open todeb opened 1 year ago

todeb commented 1 year ago

Rancher Server Setup

Information about the Cluster

User Information

Describe the bug According to the doc we should be able to create grafana dashboards from config maps. https://ranchermanager.docs.rancher.com/how-to-guides/advanced-user-guides/monitoring-alerting-guides/create-persistent-grafana-dashboard

This is working as expected on Rancher Monitoring 100.1.3+up19.0.3 Although after upgrade from that version to 100.2.0+up40.1.2 it is no longer working.

To Reproduce

cm.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    grafana_dashboard: "123"
  name: yaml-dashboard-test
  namespace: cattle-dashboards # Change if using a non-default namespace
data:
  test.json: |-
    {
      "annotations": {
        "list": [
          {
            "builtIn": 1,
            "datasource": {
              "type": "grafana",
              "uid": "-- Grafana --"
            },
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "target": {
              "limit": 100,
              "matchAny": false,
              "tags": [],
              "type": "dashboard"
            },
            "type": "dashboard"
          }
        ]
      },
      "editable": true,
      "fiscalYearStartMonth": 0,
      "graphTooltip": 0,
      "links": [],
      "liveNow": false,
      "panels": [
        {
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "palette-classic"
              },
              "custom": {
                "axisCenteredZero": false,
                "axisColorMode": "text",
                "axisLabel": "",
                "axisPlacement": "auto",
                "barAlignment": 0,
                "drawStyle": "line",
                "fillOpacity": 0,
                "gradientMode": "none",
                "hideFrom": {
                  "legend": false,
                  "tooltip": false,
                  "viz": false
                },
                "lineInterpolation": "linear",
                "lineWidth": 1,
                "pointSize": 5,
                "scaleDistribution": {
                  "type": "linear"
                },
                "showPoints": "auto",
                "spanNulls": false,
                "stacking": {
                  "group": "A",
                  "mode": "none"
                },
                "thresholdsStyle": {
                  "mode": "off"
                }
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green",
                    "value": null
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": []
          },
          "gridPos": {
            "h": 9,
            "w": 12,
            "x": 0,
            "y": 0
          },
          "id": 2,
          "options": {
            "legend": {
              "calcs": [],
              "displayMode": "list",
              "placement": "bottom",
              "showLegend": true
            },
            "tooltip": {
              "mode": "single",
              "sort": "none"
            }
          },
          "title": "Panel Title",
          "type": "timeseries"
        }
      ],
      "schemaVersion": 37,
      "style": "dark",
      "tags": [],
      "templating": {
        "list": []
      },
      "time": {
        "from": "now-6h",
        "to": "now"
      },
      "timepicker": {},
      "timezone": "",
      "title": "Yaml dashboard test",
      "version": 0,
      "weekStart": ""
    }
kubectl apply -f cm.yaml

Result Dashboard not in grafana

Expected Result Dashboard in grafana

todeb commented 1 year ago

seems that it is working if we set: grafana_dashboard: "1"

Although on previous version it was not requirement to set this value to "1"