{
  "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"
      }
    ]
  },
  "description": "Track whether the cluster can be upgraded to the newer Kubernetes versions",
  "editable": false,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": 30,
  "iteration": 1656060742701,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$ds_prometheus"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "fixed"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 5,
        "x": 0,
        "y": 0
      },
      "id": 9,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "name"
      },
      "pluginVersion": "8.5.2",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "$ds_prometheus"
          },
          "editorMode": "code",
          "expr": "topk(1, sum by (git_version) (kubernetes_build_info{job=\"kube-apiserver\"}))",
          "legendFormat": "{{ git_version }}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Current K8s version",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "labelsToFields": false,
            "reducers": []
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$ds_prometheus"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "from": 1,
                "result": {
                  "index": 0,
                  "text": "Cannot be upgraded"
                },
                "to": 1e+18
              },
              "type": "range"
            },
            {
              "options": {
                "match": "null+nan",
                "result": {
                  "index": 1,
                  "text": "Can be upgraded"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 7,
        "x": 5,
        "y": 0
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "8.5.2",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "$ds_prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sum(\n    ceil(\n        sum by(removed_release, resource, group, version) (\n            sum by(removed_release, resource, group, version) \n            (apiserver_requested_deprecated_apis{removed_release=\"$k8s\"}) \n            *\n            on(group,version,resource,subresource)\n            group_right() (increase(apiserver_request_total[1h]))\n        )\n    )\n) or vector(0)\n+ \nsum(\n    sum by (api_version, kind, helm_release_name, helm_release_namespace)\n    (resource_versions_compatibility{k8s_version=~\"$k8s\"})\n) or vector(0)\n> 0",
          "instant": true,
          "range": false,
          "refId": "A"
        }
      ],
      "title": "Upgrade to desired version status",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$ds_prometheus"
      },
      "gridPos": {
        "h": 5,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 7,
      "options": {
        "content": "<br>\n\n#### Follow instructions to migrate from using **deprecated APIs**\n\nhttps://kubernetes.io/docs/reference/using-api/deprecation-guide/",
        "mode": "markdown"
      },
      "pluginVersion": "8.5.2",
      "type": "text"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$ds_prometheus"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "color-background",
            "filterable": false,
            "inspect": false,
            "minWidth": 100
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "super-light-orange",
                "value": null
              },
              {
                "color": "light-orange",
                "value": 50
              },
              {
                "color": "orange",
                "value": 200
              },
              {
                "color": "semi-dark-orange",
                "value": 500
              },
              {
                "color": "dark-orange",
                "value": 1000
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Group"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "auto"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Version"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "auto"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Resource"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "auto"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 13,
        "w": 12,
        "x": 0,
        "y": 5
      },
      "id": 2,
      "options": {
        "footer": {
          "enablePagination": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.5.2",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "$ds_prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "ceil(\n    sum by(removed_release, resource, group, version)(\n        sum by(removed_release, resource, group, version) \n        (apiserver_requested_deprecated_apis{removed_release=~\"$k8s\"}) \n        * \n        on(group,version,resource,subresource)\n        group_right() (increase(apiserver_request_total[3h]))\n    )\n) > 0",
          "format": "table",
          "instant": true,
          "range": false,
          "refId": "A"
        }
      ],
      "title": "Requests to kube-apiserver (last 3 hours)",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "group",
                "removed_release",
                "resource",
                "version",
                "Value"
              ]
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {
              "Value": 4,
              "group": 0,
              "removed_release": 3,
              "resource": 2,
              "version": 1
            },
            "renameByName": {
              "Value": "",
              "group": "Group",
              "removed_release": "Removed Release",
              "resource": "Resource",
              "version": "Version"
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "Value"
              }
            ]
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$ds_prometheus"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "color-background",
            "filterable": false,
            "inspect": false,
            "minWidth": 100
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "super-light-orange",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 5
              },
              {
                "color": "orange",
                "value": 15
              },
              {
                "color": "dark-orange",
                "value": 50
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "API version"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "auto"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Helm release"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "auto"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Helm release namespace"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "auto"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Kind"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "auto"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 13,
        "w": 12,
        "x": 12,
        "y": 5
      },
      "id": 5,
      "options": {
        "footer": {
          "enablePagination": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.5.2",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "$ds_prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sum by (api_version, kind, helm_release_name, helm_release_namespace) (resource_versions_compatibility{k8s_version=~\"$k8s\"})",
          "format": "table",
          "instant": true,
          "legendFormat": "__auto",
          "range": false,
          "refId": "A"
        }
      ],
      "title": "Helm releases",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "indexByName": {},
            "renameByName": {
              "Time": "",
              "Value": "Quantity",
              "api_version": "API version",
              "helm_release_name": "Helm release",
              "helm_release_namespace": "Helm release namespace",
              "kind": "Kind"
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "Quantity"
              }
            ]
          }
        }
      ],
      "type": "table"
    }
  ],
  "schemaVersion": 36,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "default",
          "value": "default"
        },
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "datasource",
        "multi": false,
        "name": "ds_prometheus",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "datasource": {
          "type": "prometheus",
          "uid": "$ds_prometheus"
        },
        "definition": "label_values(apiserver_requested_deprecated_apis, removed_release)",
        "hide": 0,
        "includeAll": false,
        "label": "Desired K8s version",
        "multi": false,
        "name": "k8s",
        "options": [],
        "query": {
          "query": "label_values(apiserver_requested_deprecated_apis, removed_release)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "default",
          "value": "default"
        },
        "hide": 2,
        "includeAll": false,
        "label": "Prometheus",
        "multi": false,
        "name": "ds_prometheus",
        "options": [],
        "query": "prometheus",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      }
    ]
  },
  "time": {
    "from": "now-3h",
    "to": "now"
  },
  "timepicker": {
    "hidden": true,
    "refresh_intervals": [
      "30s"
    ]
  },
  "timezone": "",
  "title": "Deprecated APIs",
  "uid": "B0d1Wt3nk",
  "version": 2,
  "weekStart": ""
}
