From 10b5697b668c0f202700178b199debd7b129ca5a Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Tue, 27 Apr 2021 11:17:50 +0200 Subject: [PATCH] feat: add custom landing page to metrics --- .../{dashboards.yaml => k8s-dashboards.yaml} | 0 .../dashboards/zdt-dashboards.yaml | 5 + .../kubezero-metrics/dashboards/zdt/home.json | 136 ++++++++++++++++++ ...oards.yaml => grafana-dashboards-k8s.yaml} | 0 .../templates/grafana-dashboards-zdt.yaml | 11 ++ charts/kubezero-metrics/update.sh | 5 +- charts/kubezero-metrics/values.yaml | 2 +- 7 files changed, 157 insertions(+), 2 deletions(-) rename charts/kubezero-metrics/dashboards/{dashboards.yaml => k8s-dashboards.yaml} (100%) create mode 100644 charts/kubezero-metrics/dashboards/zdt-dashboards.yaml create mode 100644 charts/kubezero-metrics/dashboards/zdt/home.json rename charts/kubezero-metrics/templates/{grafana-dashboards.yaml => grafana-dashboards-k8s.yaml} (100%) create mode 100644 charts/kubezero-metrics/templates/grafana-dashboards-zdt.yaml diff --git a/charts/kubezero-metrics/dashboards/dashboards.yaml b/charts/kubezero-metrics/dashboards/k8s-dashboards.yaml similarity index 100% rename from charts/kubezero-metrics/dashboards/dashboards.yaml rename to charts/kubezero-metrics/dashboards/k8s-dashboards.yaml diff --git a/charts/kubezero-metrics/dashboards/zdt-dashboards.yaml b/charts/kubezero-metrics/dashboards/zdt-dashboards.yaml new file mode 100644 index 00000000..5f45fee0 --- /dev/null +++ b/charts/kubezero-metrics/dashboards/zdt-dashboards.yaml @@ -0,0 +1,5 @@ +configmap: grafana-dashboards-zdt +gzip: true +dashboards: +- name: home + url: file://zdt/home.json diff --git a/charts/kubezero-metrics/dashboards/zdt/home.json b/charts/kubezero-metrics/dashboards/zdt/home.json new file mode 100644 index 00000000..c20dd4f5 --- /dev/null +++ b/charts/kubezero-metrics/dashboards/zdt/home.json @@ -0,0 +1,136 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "Prometheus", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 29, + "links": [], + "panels": [ + { + "datasource": null, + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 6, + "options": { + "content": "![ZDT Logo](https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png \"zdt\")\nWelcome to KubeZero Metrics ! ", + "mode": "markdown" + }, + "pluginVersion": "7.5.3", + "timeFrom": null, + "timeShift": null, + "title": "Home", + "type": "text" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "gridPos": { + "h": 15, + "w": 12, + "x": 0, + "y": 3 + }, + "id": 3, + "links": [], + "options": { + "folderId": 0, + "maxItems": 30, + "query": "", + "showHeadings": true, + "showRecentlyViewed": true, + "showSearch": false, + "showStarred": true, + "tags": [] + }, + "pluginVersion": "7.5.3", + "tags": [], + "title": "Dashboards", + "type": "dashlist" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "gridPos": { + "h": 15, + "w": 12, + "x": 12, + "y": 3 + }, + "id": 4, + "links": [], + "options": { + "feedUrl": "https://zero-downtime.net/index.xml" + }, + "title": "Latest from our blog", + "type": "news" + } + ], + "refresh": "30s", + "schemaVersion": 27, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": { + "hidden": true, + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ], + "type": "timepicker" + }, + "timezone": "browser", + "title": "Home Copy", + "uid": "6QOeg59Mz", + "version": 4 +} diff --git a/charts/kubezero-metrics/templates/grafana-dashboards.yaml b/charts/kubezero-metrics/templates/grafana-dashboards-k8s.yaml similarity index 100% rename from charts/kubezero-metrics/templates/grafana-dashboards.yaml rename to charts/kubezero-metrics/templates/grafana-dashboards-k8s.yaml diff --git a/charts/kubezero-metrics/templates/grafana-dashboards-zdt.yaml b/charts/kubezero-metrics/templates/grafana-dashboards-zdt.yaml new file mode 100644 index 00000000..e08bec01 --- /dev/null +++ b/charts/kubezero-metrics/templates/grafana-dashboards-zdt.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ printf "%s-%s" (include "kubezero-lib.fullname" $) "grafana-dashboards-zdt" | trunc 63 | trimSuffix "-" }} + namespace: {{ .Release.Namespace }} + labels: + grafana_dashboard: "1" +{{ include "kubezero-lib.labels" . | indent 4 }} +binaryData: + home.json.gz: + H4sIAAAAAAAC/9VVS2/UMBC+8yuMD6hI7e5mH63ghlohKkAUWopEWyFvPEmsdexgO93dVv3v2M7L2RQqbnDZ9XwzHs/jy8z9M4QwEUIaYpgUGr9G9xayIGfaWOnKS6hGvWZZMm5OhVVG+x1KiSFalioGq8BnSuZgMig1DmxAkCV3eqNKCPCM0UdQFktxLLlUzqFKl2Rvso+mUWR/Fot9FL0MXQuS+4ffdLmgF+gNB2V6IZht4e0o0dlSEkVxrXvw/zf298GZY6DM7ESLUwHmlFpElJxXiCJFdiElN6yw+MSDzJlMX/kzZ2Llqnp148WCCOC6rWtT1X71Gu9ekzDg9FiKhKVtc6orkJCSG9+yhyBDeQtK2YJWrzbZtf5SqzuTuu8rs+Is8LF2CcwDYNMkV8tbJw98+8QPW1EWfU550DbVgHDUws+vvp9coA8ylTd7mTGFfj0ex1SM7kDJAyrXwrAcRrbmY6I1GD1elUtwyjG3dw50Tjg/OJyPCpGia3xHzTV+eS2+AY8t+ZCR6L21/27t0UcwisUaPUdtHEEyufT0wzlRK/csHiRW8DJl4hKUtgk506PRYjRrfWAX6FtL+d3mOfw8Y4kZKoynFn5nQw381Ow0sDFVFHUM/xJRosUOU6LpE0yZPc6UlnE7X8nvyZNITkH5TzB8IyebUwO5M56F+M8SlHsfh93WmVy/A0KZSPVw6DjtF4gtQ/n2ksEa6OM250BU7KqREK4HSkOUeuymIelvqv0kw5qbQwqdNKNMD4nkxpyf5P8vmXrAH9g0/3s2AdCvirs6NeNnOHqYoLAZbXI+nAptBz4QA9qgxE4AZMuJlnY+DXshYK3rPtjfah8oSBRoVwg8m1T9wzrOICcdFaZHFWy2vO6pWlWWPVLYoZEX3K4+kQ63eLfXXGKdPqmGFhZyfRBldczYyBrDvWsFi1egust2bVMQPZY3Cf1gdsqrWxLsOqtcBAyNJoEwC4Uo786L4ByFwmwSarLuPA3OUb3db5q8bBI/OipcPflK6PgwdBy+Mp2HAu3ORzSMdzeWZtR3he0V+04Kr18qudZWWSuCtYGOZbGt8NJ/Afjw8ydIF68+3lXobUuh+bOHXxBMSbrqCQAA diff --git a/charts/kubezero-metrics/update.sh b/charts/kubezero-metrics/update.sh index 03efe2b2..204398f1 100755 --- a/charts/kubezero-metrics/update.sh +++ b/charts/kubezero-metrics/update.sh @@ -10,4 +10,7 @@ curl -L -s -o - https://github.com/prometheus-community/helm-charts/releases/dow patch -p0 -i metrics-zdt.patch --no-backup-if-mismatch # Create ZDT dashboard configmap -./sync_grafana_dashboards.py dashboards/kube-mixin.yaml templates/grafana-dashboards.yaml +cd dashboards +../sync_grafana_dashboards.py k8s-dashboards.yaml ../templates/grafana-dashboards-k8s.yaml +../sync_grafana_dashboards.py zdt-dashboards.yaml ../templates/grafana-dashboards-zdt.yaml +cd - diff --git a/charts/kubezero-metrics/values.yaml b/charts/kubezero-metrics/values.yaml index 1b1b7058..dc0ba527 100644 --- a/charts/kubezero-metrics/values.yaml +++ b/charts/kubezero-metrics/values.yaml @@ -147,7 +147,7 @@ kube-prometheus-stack: enabled: true dashboards: min_refresh_interval: "30s" - # default_home_dashboard_path: 'dashboards/kubezero.json' + default_home_dashboard_path: '/tmp/dashboards/home.json' alerting: enabled: false date_formats: