feat: add version checker

This commit is contained in:
2026-04-05 18:48:08 -05:00
parent 9a1f8dfbb1
commit 00727e5d27
3 changed files with 2640 additions and 1298 deletions

View File

@@ -0,0 +1,431 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": false,
"graphTooltip": 0,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"mappings": [],
"min": 0,
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.4.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(count(version_checker_is_latest_version{exported_namespace=~\"$namespace\"}==0) by (image))",
"instant": false,
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Need Attention",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 8,
"y": 0
},
"id": 2,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.4.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(count(version_checker_is_latest_version{exported_namespace=~\"$namespace\"}==1) by (image))",
"instant": false,
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Uptodate",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"displayName": "%",
"mappings": [],
"max": 100,
"min": 0,
"noValue": "0",
"thresholds": {
"mode": "percentage",
"steps": [
{
"color": "red",
"value": 0
},
{
"color": "yellow",
"value": 40
},
{
"color": "green",
"value": 80
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 0
},
"id": 3,
"options": {
"minVizHeight": 75,
"minVizWidth": 75,
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true,
"sizing": "auto"
},
"pluginVersion": "12.4.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "round(count(version_checker_is_latest_version{exported_namespace=~\"$namespace\"}==1) / count(version_checker_is_latest_version{exported_namespace=~\"$namespace\"}) * 100,1)",
"instant": false,
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Percentage Uptodate",
"type": "gauge"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"filterable": true,
"footer": {
"reducers": []
},
"inspect": true
},
"decimals": 0,
"fieldMinMax": false,
"mappings": [
{
"options": {
"0": {
"color": "dark-red",
"index": 1,
"text": "No"
},
"1": {
"color": "green",
"index": 0,
"text": "Yes"
}
},
"type": "value"
}
],
"max": 1,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "custom.hideFrom.viz",
"value": true
}
]
}
]
},
"gridPos": {
"h": 22,
"w": 24,
"x": 0,
"y": 8
},
"id": 4,
"options": {
"cellHeight": "sm",
"enablePagination": false,
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "UptoDate"
}
]
},
"pluginVersion": "12.4.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "334e06ed-cbfd-4139-8151-9e7029478d14"
},
"editorMode": "code",
"exemplar": false,
"expr": "sort(sum by(image,current_version,latest_version) (version_checker_is_latest_version{exported_namespace=~\"$namespace\"}))",
"format": "table",
"instant": true,
"legendFormat": "Up to date",
"range": false,
"refId": "A"
}
],
"title": "Cluster Image Version Checks",
"transformations": [
{
"id": "sortBy",
"options": {
"fields": {},
"sort": [
{
"field": "Value"
}
]
}
},
{
"id": "organize",
"options": {
"excludeByName": {},
"includeByName": {},
"indexByName": {
"Time": 0,
"Value": 4,
"current_version": 2,
"image": 1,
"latest_version": 3
},
"renameByName": {
"Value": "UptoDate",
"current_version": ""
}
}
}
],
"type": "table"
}
],
"preload": true,
"tags": ["service", "scan"],
"templating": {
"list": [
{
"current": {
"text": "Prometheus",
"value": "kube-prometheus-stack"
},
"includeAll": false,
"name": "datasource",
"options": [],
"query": "prometheus",
"refresh": 1,
"regex": "",
"type": "datasource"
},
{
"current": {
"text": "All",
"value": "$__all"
},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(version_checker_is_latest_version,exported_namespace)",
"includeAll": true,
"label": "Namespace",
"multi": true,
"name": "namespace",
"options": [],
"query": {
"qryType": 1,
"query": "label_values(version_checker_is_latest_version,exported_namespace)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 2,
"regex": "",
"regexApplyTo": "value",
"sort": 1,
"type": "query"
}
]
},
"time": {
"from": "now-24h",
"to": "now"
},
"timezone": "browser",
"title": "Version Checker - Overview",
"uid": "eegwegrs8v7k0b",
"version": 1
}