From ff126987f000ac1ea6b5d66724426afd2d289e2c Mon Sep 17 00:00:00 2001 From: David Martin Date: Wed, 27 Sep 2023 23:28:42 +0100 Subject: [PATCH] checkpoint watching files --- Makefile | 22 +- .../examples/dashboards/gatewayclasses.yaml | 10 + config/examples/dashboards/gateways.json | 2127 +---------------- config/examples/dashboards/gateways.yaml | 10 + src/dashboards/README.md | 142 ++ src/dashboards/dashboard_cr_template.yaml | 10 + src/dashboards/gateways.jsonnet | 8 + 7 files changed, 244 insertions(+), 2085 deletions(-) create mode 100644 config/examples/dashboards/gatewayclasses.yaml create mode 100644 config/examples/dashboards/gateways.yaml create mode 100644 src/dashboards/README.md create mode 100644 src/dashboards/dashboard_cr_template.yaml create mode 100644 src/dashboards/gateways.jsonnet diff --git a/Makefile b/Makefile index 7500c07..23391e7 100644 --- a/Makefile +++ b/Makefile @@ -26,16 +26,26 @@ generate-bundles: compare-bundles: generate-bundles git diff --exit-code -define GENERATE_DASHBOARDS - jsonnet -J vendor $< -o $@ -endef - JSONNET_SRC_DIR := src/dashboards JSONNET_TARGET_DIR := config/examples/dashboards -JSONNET_TARGETS := $(addprefix $(JSONNET_TARGET_DIR)/,$(patsubst %.jsonnet,%.json,$(shell ls $(JSONNET_SRC_DIR)/*.jsonnet | xargs -n 1 basename))) $(addprefix $(JSONNET_TARGET_DIR)/,$(patsubst %.jsonnet,%.json,$(shell ls $(JSONNET_SRC_DIR)/*.jsonnet | xargs -n 1 basename))) +JSONNET_TARGETS := $(addprefix $(JSONNET_TARGET_DIR)/,$(patsubst %.jsonnet,%.json,$(shell ls $(JSONNET_SRC_DIR)/*.jsonnet | xargs -n 1 basename))) +DASHBOARD_CR_TARGETS := $(addprefix $(JSONNET_TARGET_DIR)/,$(patsubst %.jsonnet,%.yaml,$(shell ls $(JSONNET_SRC_DIR)/*.jsonnet | xargs -n 1 basename))) $(JSONNET_TARGET_DIR)/%.json: $(JSONNET_SRC_DIR)/%.jsonnet - $(GENERATE_DASHBOARDS) + jsonnet -J vendor $< -o $@ + +$(JSONNET_TARGET_DIR)/%.yaml: $(JSONNET_TARGET_DIR)/%.json + DASHBOARD_NAME=$(shell echo "$<" | sed -r "s/.+\/(.+)\..+/\1/") envsubst < $(JSONNET_SRC_DIR)/dashboard_cr_template.yaml > $@ + cat "$<" | jq -c . >> $@ .PHONY: generate-dashboards generate-dashboards: ${JSONNET_TARGETS} + +.PHONY: generate-dashboard-crs +generate-dashboard-crs: generate-dashboards ${DASHBOARD_CR_TARGETS} + +.PHONY: apply-latest-dashboard-crs +apply-latest-dashboard-crs: generate-dashboard-crs + for i in ${DASHBOARD_CR_TARGETS}; do kubectl apply -f $$i; done + +print-% : ; @echo $* = $($*) diff --git a/config/examples/dashboards/gatewayclasses.yaml b/config/examples/dashboards/gatewayclasses.yaml new file mode 100644 index 0000000..f194f92 --- /dev/null +++ b/config/examples/dashboards/gatewayclasses.yaml @@ -0,0 +1,10 @@ +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDashboard +metadata: + name: gatewayclasses +spec: + instanceSelector: + matchLabels: + dashboards: "grafana" + json: > + {"editable":false,"links":[{"asDropdown":false,"includeVars":true,"keepTime":true,"tags":["gateway-api-state"],"targetBlank":false,"title":"Gateway Dashboards","type":"dashboards"}],"panels":[{"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":1,"title":"Gateway Classes","type":"row"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of GatewayClasses across all clusters","gridPos":{"h":3,"w":2,"x":0,"y":1},"id":2,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gatewayclass_info)","instant":true}],"title":"Total","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total GatewayClasses with an Accepted state of True","gridPos":{"h":3,"w":2,"x":2,"y":1},"id":3,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gatewayclass_status{type=\"Accepted\"} > 0)","instant":true}],"title":"Accepted","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":1},"id":4,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gatewayclass_created","format":"table","instant":true,"range":false}],"title":"GatewayClasses","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","name","Value"]}}},{"id":"calculateField","options":{"alias":"Created At","binary":{"left":"Value","operator":"*","reducer":"sum","right":"1000"},"mode":"binary","reduce":{"reducer":"sum"},"replaceFields":false}},{"id":"organize","options":{"excludeByName":{"Value":true,"customresource_kind":true},"indexByName":{},"renameByName":{"Value":"Created","customresource_kind":"Kind","customresource_version":"Version","name":"Name","namespace":"Namespace"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"links","value":[{"title":"Gateway Details","url":"/d/gatewayapigateways/gateway-api-state-gateways?var-gateway=${__value.text}"}]},{"id":"custom.displayMode","value":"color-text"}]}]},"gridPos":{"h":6,"w":10,"x":14,"y":1},"id":5,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gateway_info","format":"table","instant":true,"range":false}],"title":"Gateways (by GatewayClass)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["gatewayclass_name","name","namespace"]}}},{"id":"organize","options":{"excludeByName":{"Value":false,"customresource_kind":true},"indexByName":{"Value":3,"gatewayclass_name":2,"name":0,"namespace":1},"renameByName":{"Value":"# Instances","customresource_kind":"Kind","customresource_version":"Version","gatewayclass_name":"GatewayClass","name":"Name","namespace":"Namespace"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"name"},"properties":[{"id":"custom.width","value":333}]}]},"gridPos":{"h":6,"w":20,"x":4,"y":7},"id":6,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gatewayclass_status_supported_features{name=\"$gatewayclass\"}","format":"table","instant":true,"range":false}],"title":"Supported Features (by GatewayClass)","transformations":[{"id":"reduce","options":{"includeTimeField":false,"labelsToFields":true,"mode":"seriesToRows","reducers":["last"]}},{"id":"filterFieldsByName","options":{"include":{"names":["features","name"]}}},{"id":"groupBy","options":{"fields":{"features":{"aggregations":["allValues"],"operation":"aggregate"},"name":{"aggregations":[],"operation":"groupby"}}}},{"id":"organize","options":{"excludeByName":{},"indexByName":{},"renameByName":{"features (allValues)":"Features","name":"GatewayClass"}}}],"type":"table"}],"schemaVersion":36,"style":"dark","tags":["gateway-api","gateway-api-state"],"templating":{"list":[{"label":"Data Source","name":"datasource","query":"prometheus","type":"datasource"}]},"time":{"from":"now-1h","to":"now"},"timezone":"utc","title":"Gateway API State / GatewayClasses","uid":"gatewayapigatewayclass"} diff --git a/config/examples/dashboards/gateways.json b/config/examples/dashboards/gateways.json index d04f677..78803fc 100644 --- a/config/examples/dashboards/gateways.json +++ b/config/examples/dashboards/gateways.json @@ -1,2083 +1,52 @@ { - "__inputs": [], - "__elements": [], - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "8.5.5" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - } - ], - "annotations": { - "list": [ + "editable": false, + "links": [ { - "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, - "iteration": 1694614167005, - "links": [ - { - "asDropdown": false, - "icon": "dashboard", - "includeVars": true, - "keepTime": true, - "tags": [ - "gateway-api-state" - ], - "targetBlank": false, - "title": "Gateway Dashboards", - "tooltip": "", - "type": "dashboards", - "url": "" - } - ], - "liveNow": false, - "panels": [ - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 16, - "panels": [], - "title": "Gateways", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Total number of Gateways across all namespaces", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 2, - "x": 0, - "y": 1 - }, - "id": 21, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "count(gatewayapi_gateway_info{name=~\"$gateway\"})", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Total", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Number of Gateways not in an Accepted and Programmed state", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 2, - "x": 2, - "y": 1 - }, - "id": 22, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "count((gatewayapi_gateway_status{name=~\"$gateway\",type=\"Accepted\"} == 0) or (gatewayapi_gateway_status{name=~\"$gateway\",type=\"Programmed\"} == 0)) or vector(0)", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Unhealthy", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Created At" - }, - "properties": [ - { - "id": "unit", - "value": "dateTimeAsIso" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Kind" - }, - "properties": [ - { - "id": "custom.width", - "value": 108 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Version" - }, - "properties": [ - { - "id": "custom.width", - "value": 98 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 125 - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 4, - "y": 1 - }, - "id": 2, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_gateway_created{name=~\"$gateway\"} * on(name, namespace, instance) group_right gatewayapi_gateway_info{name=~\"$gateway\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "Gateways", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "customresource_version", - "gatewayclass_name", - "name", - "namespace", - "Value" - ] - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "Created At", - "binary": { - "left": "Value", - "operator": "*", - "reducer": "sum", - "right": "1000" - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - }, - "replaceFields": false - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": true, - "customresource_kind": true - }, - "indexByName": { - "Created At": 6, - "Value": 5, - "customresource_kind": 0, - "customresource_version": 1, - "gatewayclass_name": 4, - "name": 2, - "namespace": 3 - }, - "renameByName": { - "Value": "Created", - "customresource_kind": "Kind", - "customresource_version": "Version", - "gatewayclass_name": "GatewayClass", - "name": "Name", - "namespace": "Namespace" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Created At" - }, - "properties": [ - { - "id": "unit", - "value": "dateTimeAsIso" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Kind" - }, - "properties": [ - { - "id": "custom.width", - "value": 108 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Version" - }, - "properties": [ - { - "id": "custom.width", - "value": 94 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Listener Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 112 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Hostname" - }, - "properties": [ - { - "id": "custom.width", - "value": 163 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Port" - }, - "properties": [ - { - "id": "custom.width", - "value": 59 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Protocol" - }, - "properties": [ - { - "id": "custom.width", - "value": 77 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 91 - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 14, - "y": 1 - }, - "id": 5, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_gateway_listener_info{name=~\"$gateway\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "Gateway Listeners", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "customresource_version", - "hostname", - "listener_name", - "name", - "namespace", - "port", - "protocol", - "tls_mode", - "Value" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": true - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Total Gateways with an Accepted state of True", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 2, - "x": 0, - "y": 4 - }, - "id": 30, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "count(gatewayapi_gateway_status{name=~\"$gateway\",type=\"Accepted\"} > 0)", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Accepted", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Total Gateways with a Programmed state of True", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 2, - "x": 2, - "y": 4 - }, - "id": 26, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "count(gatewayapi_gateway_status{name=~\"$gateway\",type=\"Programmed\"} > 0)", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Programmed", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Total number of listeners across all Gateways", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 2, - "x": 0, - "y": 7 - }, - "id": 24, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "count(gatewayapi_gateway_listener_info{name=~\"$gateway\"})", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Listeners", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Total number of attached routes across all listeners", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 2, - "x": 2, - "y": 7 - }, - "id": 25, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "sum(gatewayapi_gateway_status_listener_attached_routes{name=~\"$gateway\"})", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Att. Routes", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Created At" - }, - "properties": [ - { - "id": "unit", - "value": "dateTimeAsIso" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Kind" - }, - "properties": [ - { - "id": "custom.width", - "value": 108 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Version" - }, - "properties": [ - { - "id": "custom.width", - "value": 94 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Listener Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 119 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Hostname" - }, - "properties": [ - { - "id": "custom.width", - "value": 163 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Port" - }, - "properties": [ - { - "id": "custom.width", - "value": 59 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Protocol" - }, - "properties": [ - { - "id": "custom.width", - "value": 104 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 136 - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 4, - "y": 7 - }, - "id": 9, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_gateway_status_address_info{name=~\"$gateway\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "Gateway Status Addresses", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "customresource_version", - "name", - "namespace", - "type", - "value" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": true - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode", - "type": "Address Type", - "value": "Address Value" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Created At" - }, - "properties": [ - { - "id": "unit", - "value": "dateTimeAsIso" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Version" - }, - "properties": [ - { - "id": "custom.width", - "value": 88 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Kind" - }, - "properties": [ - { - "id": "custom.width", - "value": 113 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 137 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Listener Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 167 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "# Attached Routes" - }, - "properties": [ - { - "id": "custom.width", - "value": 137 - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 14, - "y": 7 - }, - "id": 6, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_gateway_status_listener_attached_routes{name=~\"$gateway\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "Gateway Listener Status - Attached Routes", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "customresource_version", - "listener_name", - "name", - "namespace", - "Value" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": false - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "# Attached Routes", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "links", - "value": [ - { - "title": "HTTPRoute Details", - "url": "/d/gatewayapihttproutes/gateway-api-state-httproutes?var-httproute=${__value.text}" - } - ] - }, - { - "id": "custom.displayMode", - "value": "color-text" - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 4, - "y": 13 - }, - "id": 31, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_httproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "HTTPRoutes (by Gateway)", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "name", - "namespace", - "parent_name" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": false - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "# Attached Routes", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "parent_kind": "", - "parent_name": "Gateway", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "links", - "value": [ - { - "title": "GRPCRoute Details", - "url": "/d/gatewayapigrpcroutes/gateway-api-state-grpcroutes?var-grpcroute=${__value.text}" - } - ] - }, - { - "id": "custom.displayMode", - "value": "color-text" - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 14, - "y": 13 - }, - "id": 32, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_grpcroute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "GRPCRoutes (by Gateway)", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "name", - "namespace", - "parent_name" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": false - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "# Attached Routes", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "parent_kind": "", - "parent_name": "Gateway", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "links", - "value": [ - { - "title": "TLSRoute Details", - "url": "/d/gatewayapitlsroutes/gateway-api-state-tlsroutes?var-tlsroute=${__value.text}" - } - ] - }, - { - "id": "custom.displayMode", - "value": "color-text" - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 4, - "y": 19 - }, - "id": 35, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_tlsroute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "TLSRoutes (by Gateway)", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "name", - "namespace", - "parent_name" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": false - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "# Attached Routes", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "parent_kind": "", - "parent_name": "Gateway", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "links", - "value": [ - { - "title": "TCPRoute Details", - "url": "/d/gatewayapitcproutes/gateway-api-state-tcproutes?var-tcproute=${__value.text}" - } - ] - }, - { - "id": "custom.displayMode", - "value": "color-text" - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 14, - "y": 19 - }, - "id": 33, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_tcproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "TCPRoutes (by Gateway)", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "name", - "namespace", - "parent_name" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": false - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "# Attached Routes", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "parent_kind": "", - "parent_name": "Gateway", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "links", - "value": [ - { - "title": "UCPRoute Details", - "url": "/d/gatewayapiudproutes/gateway-api-state-udproutes?var-udproute=${__value.text}" - } - ] - }, - { - "id": "custom.displayMode", - "value": "color-text" - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 4, - "y": 25 - }, - "id": 34, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_udproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "UDPRoutes (by Gateway)", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "name", - "namespace", - "parent_name" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": false - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "# Attached Routes", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "parent_kind": "", - "parent_name": "Gateway", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode" - } - } - } - ], - "type": "table" - } - ], - "schemaVersion": 36, - "style": "dark", - "tags": [ - "gateway-api", - "gateway-api-state" - ], - "templating": { - "list": [ - { - "current": { - "selected": false, - "text": "prometheus", - "value": "prometheus" - }, - "hide": 0, - "includeAll": false, - "label": "Data Source", - "multi": false, - "name": "datasource", - "options": [], - "query": "prometheus", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "type": "datasource" - }, + "asDropdown": false, + "includeVars": true, + "keepTime": true, + "tags": [ + "gateway-api-state" + ], + "targetBlank": false, + "title": "Gateway Dashboards", + "type": "dashboards" + } + ], + "panels": [ { - "current": {}, - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "definition": "label_values(gatewayapi_gateway_info, name)", - "hide": 0, - "includeAll": true, - "label": "Gateway", - "multi": true, - "name": "gateway", - "options": [], - "query": { - "query": "label_values(gatewayapi_gateway_info, name)", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": "/(.*)/", - "skipUrlSync": false, - "sort": 1, - "type": "query" + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "title": "Gateways", + "type": "row" } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Gateway API State / Gateways", - "uid": "gatewayapigateways", - "version": 3, - "weekStart": "" -} \ No newline at end of file + ], + "schemaVersion": 36, + "style": "dark", + "tags": [ + "gateway-api", + "gateway-api-state" + ], + "templating": { + "list": [ + { + "label": "Data Source", + "name": "datasource", + "query": "prometheus", + "type": "datasource" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timezone": "utc", + "title": "Gateway API State / Gateways", + "uid": "gatewayapigateways" +} diff --git a/config/examples/dashboards/gateways.yaml b/config/examples/dashboards/gateways.yaml new file mode 100644 index 0000000..a6e2131 --- /dev/null +++ b/config/examples/dashboards/gateways.yaml @@ -0,0 +1,10 @@ +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDashboard +metadata: + name: gateways +spec: + instanceSelector: + matchLabels: + dashboards: "grafana" + json: > + {"editable":false,"links":[{"asDropdown":false,"includeVars":true,"keepTime":true,"tags":["gateway-api-state"],"targetBlank":false,"title":"Gateway Dashboards","type":"dashboards"}],"panels":[{"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":1,"title":"Gateways","type":"row"}],"schemaVersion":36,"style":"dark","tags":["gateway-api","gateway-api-state"],"templating":{"list":[{"label":"Data Source","name":"datasource","query":"prometheus","type":"datasource"}]},"time":{"from":"now-1h","to":"now"},"timezone":"utc","title":"Gateway API State / Gateways","uid":"gatewayapigateways"} diff --git a/src/dashboards/README.md b/src/dashboards/README.md new file mode 100644 index 0000000..62f0473 --- /dev/null +++ b/src/dashboards/README.md @@ -0,0 +1,142 @@ +```shell +kind create cluster +helm upgrade -i grafana-operator oci://ghcr.io/grafana-operator/helm-charts/grafana-operator --version v5.4.1 + +kubectl apply -f - < /dev/null & + +kubectl apply -f - < + { + "id": null, + "title": "Simple Dashboard", + "tags": [], + "style": "dark", + "timezone": "browser", + "editable": true, + "hideControls": false, + "graphTooltip": 1, + "panels": [], + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "time_options": [], + "refresh_intervals": [] + }, + "templating": { + "list": [] + }, + "annotations": { + "list": [] + }, + "refresh": "5s", + "schemaVersion": 17, + "version": 0, + "links": [] + } +EOF +``` diff --git a/src/dashboards/dashboard_cr_template.yaml b/src/dashboards/dashboard_cr_template.yaml new file mode 100644 index 0000000..c715c5d --- /dev/null +++ b/src/dashboards/dashboard_cr_template.yaml @@ -0,0 +1,10 @@ +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDashboard +metadata: + name: $DASHBOARD_NAME +spec: + instanceSelector: + matchLabels: + dashboards: "grafana" + json: > + \ No newline at end of file diff --git a/src/dashboards/gateways.jsonnet b/src/dashboards/gateways.jsonnet new file mode 100644 index 0000000..4b52957 --- /dev/null +++ b/src/dashboards/gateways.jsonnet @@ -0,0 +1,8 @@ +local g = import 'lib/g.libsonnet'; +local gwapi = import 'lib/gwapi/gwapi.libsonnet'; + +gwapi.dashboard('Gateways', 'gatewayapigateways') ++ g.dashboard.withPanels([ + gwapi.row('Gateways', 1, 24, 0, 0) +]) +