From 55293b3b19ea809e490d9dd82916aa38d3886dc5 Mon Sep 17 00:00:00 2001 From: Steven Kreitzer Date: Tue, 17 Oct 2023 14:51:38 -0500 Subject: [PATCH] feat: renovate grafana dashboard revisions --- .github/labels.yaml | 2 + .github/renovate.json5 | 65 ++----------------- .github/renovate/commitMessage.json5 | 5 ++ .github/renovate/customDatasources.json5 | 12 ++++ .github/renovate/customManagers.json5 | 58 +++++++++++++++++ .github/renovate/groups.json5 | 10 +++ .github/renovate/labels.json5 | 4 ++ .github/renovate/packageRules.json5 | 20 ++++++ .github/renovate/semanticCommits.json5 | 5 ++ .../monitoring/grafana/app/helmrelease.yaml | 48 +++++++++----- talos/talconfig.yaml | 3 + 11 files changed, 155 insertions(+), 77 deletions(-) create mode 100644 .github/renovate/customDatasources.json5 create mode 100644 .github/renovate/customManagers.json5 create mode 100644 .github/renovate/packageRules.json5 diff --git a/.github/labels.yaml b/.github/labels.yaml index 87e8db4c4b..e4eb448e0b 100644 --- a/.github/labels.yaml +++ b/.github/labels.yaml @@ -33,6 +33,8 @@ color: "ffc300" - name: renovate/terraform color: "ffc300" +- name: renovate/grafana-dashboard + color: "ffc300" # Semantic Type - name: type/digest color: "FFEC19" diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 230ec22916..b1caaf6a77 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -11,8 +11,11 @@ "github>buroa/k8s-gitops//.github/renovate/allowedVersions.json5", "github>buroa/k8s-gitops//.github/renovate/autoMerge.json5", "github>buroa/k8s-gitops//.github/renovate/commitMessage.json5", + "github>buroa/k8s-gitops//.github/renovate/customDatasources.json5", + "github>buroa/k8s-gitops//.github/renovate/customManagers.json5", "github>buroa/k8s-gitops//.github/renovate/groups.json5", "github>buroa/k8s-gitops//.github/renovate/labels.json5", + "github>buroa/k8s-gitops//.github/renovate/packageRules.json5", "github>buroa/k8s-gitops//.github/renovate/semanticCommits.json5", "helpers:pinGitHubActionDigests" ], @@ -33,65 +36,5 @@ "(^|/)talos/.+\\.ya?ml(\\.j2)?$", "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$" ] - }, - "customManagers": [ - { - "description": "Process Tekton dependencies", - "fileMatch": [ - "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$" - ], - "matchStrings": [ - "depName=(?\\S+)?\n.*?(?v\\d+\\.\\d+\\.\\d+)" - ], - "datasourceTemplate": "github-releases" - }, - { - "description": "Process custom dependencies", - "fileMatch": [ - "(^|/)talos/.+\\.ya?ml(\\.j2)?$", - "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$" - ], - "matchStrings": [ - // Example: `version: "v1.27.3+k3s1"` - "datasource=(?\\S+) depName=(?\\S+)( versioning=(?\\S+))?\n.*?\"(?.*)\"\n", - // Example: `- https://github.com/rancher/system-upgrade-controller/releases/download/v0.11.0/crd.yaml` - // `- https://github.com/argoproj/argo-cd/raw/v2.7.10/manifests/install.yaml` - // `- https://github.com/argoproj/argo-cd/raw/v2.7.10/manifests/ha/install.yaml` - // `- https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/21.1.1/kubernetes/kubernetes.yml` - "datasource=(?\\S+) depName=(?\\S+)( versioning=(?\\S+))?\n.*?-\\s(.*?)\/(?(v|\\d)[^/]+)\/\\S+\n", - // Example: apiVersion=helm.cattle.io/v1 kind=HelmChart - "datasource=(?\\S+)\n.*?repo: (?\\S+)\n.*?chart: (?\\S+)\n.*?version: (?\\S+)\n" - ], - "datasourceTemplate": "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}", - "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}" - }, - { - "description": "Process CloudnativePG Postgresql version", - "fileMatch": [ - "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$" - ], - "matchStrings": [ - "imageName: (?\\S+):(?.*\\-.*)" - ], - "datasourceTemplate": "docker", - "versioningTemplate": "redhat" - } - ], - "packageRules": [ - { - "description": "Loose versioning for non-semver packages", - "matchDatasources": ["docker"], - "versioning": "loose", - "matchPackagePatterns": ["plex", "qbittorrent"] - }, - { - "description": "Custom versioning for i915-ucode and intel-ucode", - "matchDatasources": ["docker"], - "versioning": "regex:^(?\\d{4})(?\\d{2})(?\\d{2})\\.?(?\\d+)?$", - "matchPackageNames": [ - "ghcr.io/siderolabs/i915-ucode", - "ghcr.io/siderolabs/intel-ucode" - ] - } - ] + } } \ No newline at end of file diff --git a/.github/renovate/commitMessage.json5 b/.github/renovate/commitMessage.json5 index 6142858ce3..2e3364c1d5 100644 --- a/.github/renovate/commitMessage.json5 +++ b/.github/renovate/commitMessage.json5 @@ -11,6 +11,11 @@ { "matchDatasources": ["docker"], "commitMessageTopic": "image {{depName}}" + }, + { + "matchDatasources": ["custom.grafana-dashboards"], + "commitMessageTopic": "dashboard {{depName}}", + "commitMessageExtra": "to v{{newVersion}}" } ] } \ No newline at end of file diff --git a/.github/renovate/customDatasources.json5 b/.github/renovate/customDatasources.json5 new file mode 100644 index 0000000000..c9a7c82fbf --- /dev/null +++ b/.github/renovate/customDatasources.json5 @@ -0,0 +1,12 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "customDatasources": { + "grafana-dashboards": { + "defaultRegistryUrlTemplate": "https://grafana.com/api/dashboards/{{packageName}}", + "format": "json", + "transformTemplates": [ + "{\"releases\":[{\"version\": $string(revision)}]}" + ] + } + } +} \ No newline at end of file diff --git a/.github/renovate/customManagers.json5 b/.github/renovate/customManagers.json5 new file mode 100644 index 0000000000..9d4766eeaf --- /dev/null +++ b/.github/renovate/customManagers.json5 @@ -0,0 +1,58 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "customManagers": [ + { + "description": "Process generic dependencies in YAML files", + "fileMatch": [ + "(^|/)\\.taskfiles/.+\\.ya?ml(\\.j2)?$", + "(^|/)talos/.+\\.ya?ml(\\.j2)?$", + "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$" + ], + "matchStrings": [ + "# renovate: datasource=(?.*?)(?:\\s+extractVersion=(?.+?))?(?:\\s+versioning=(?.+?))?\\s+depName=(?.+?)?\\s(?:\\s+.*(?:[v|V]ersion):\\s+(?.*))?(?:\\s.*(?:[r|R]ef):\\s+(?.*))?" + ], + "versioningTemplate": "{{#if versioning}}{{versioning}}{{else}}semver{{/if}}" + }, + { + "description": "Process custom dependencies", + "fileMatch": [ + "(^|/)talos/.+\\.ya?ml(\\.j2)?$", + "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$" + ], + "matchStrings": [ + // Example: `- https://github.com/rancher/system-upgrade-controller/releases/download/v0.11.0/crd.yaml` + // `- https://github.com/argoproj/argo-cd/raw/v2.7.10/manifests/install.yaml` + // `- https://github.com/argoproj/argo-cd/raw/v2.7.10/manifests/ha/install.yaml` + // `- https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/21.1.1/kubernetes/kubernetes.yml` + "datasource=(?\\S+) depName=(?\\S+)( versioning=(?\\S+))?\n.*?-\\s(.*?)\/(?(v|\\d)[^/]+)\/\\S+\n", + // Example: apiVersion=helm.cattle.io/v1 kind=HelmChart + "datasource=(?\\S+)\n.*?repo: (?\\S+)\n.*?chart: (?\\S+)\n.*?version: (?\\S+)\n" + ], + "datasourceTemplate": "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}", + "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}" + }, + { + "description": "Process Grafana dashboards", + "fileMatch": [ + "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$" + ], + "matchStrings": [ + "#\\s+renovate:\\s+depName=\"(?.*)\"\\n\\s+gnetId:\\s+(?.*?)\\n\\s+revision:\\s+(?.*)" + ], + "customType": "regex", + "versioningTemplate": "regex:^(?\\d+)$", + "datasourceTemplate": "custom.grafana-dashboards" + }, + { + "description": "Process CloudnativePG Postgresql version", + "fileMatch": [ + "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$" + ], + "matchStrings": [ + "imageName: (?\\S+):(?.*\\-.*)" + ], + "datasourceTemplate": "docker", + "versioningTemplate": "redhat" + } + ] +} \ No newline at end of file diff --git a/.github/renovate/groups.json5 b/.github/renovate/groups.json5 index 284e9c45e6..bdc2cd3f42 100644 --- a/.github/renovate/groups.json5 +++ b/.github/renovate/groups.json5 @@ -31,6 +31,16 @@ "commitMessageTopic": "{{{groupName}}} group" }, "separateMinorPatch": true + }, + { + "description": "Talos Group", + "groupName": "Talos", + "matchPackagePatterns": ["siderolabs/talos", "siderolabs/talosctl", "buroa/installer"], + "matchDatasources": ["docker", "github-releases"], + "group": { + "commitMessageTopic": "{{{groupName}}} group" + }, + "separateMinorPatch": true } ] } \ No newline at end of file diff --git a/.github/renovate/labels.json5 b/.github/renovate/labels.json5 index c2e371547e..734a90c144 100644 --- a/.github/renovate/labels.json5 +++ b/.github/renovate/labels.json5 @@ -44,6 +44,10 @@ { "matchDatasources": ["pypi"], "addLabels": ["renovate/pip"] + }, + { + "matchDatasources": ["grafana-dashboards", "custom.grafana-dashboards"], + "addLabels": ["renovate/grafana-dashboard"] } ] } \ No newline at end of file diff --git a/.github/renovate/packageRules.json5 b/.github/renovate/packageRules.json5 new file mode 100644 index 0000000000..a743fec1b8 --- /dev/null +++ b/.github/renovate/packageRules.json5 @@ -0,0 +1,20 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "packageRules": [ + { + "description": "Loose versioning for non-semver packages", + "matchDatasources": ["docker"], + "versioning": "loose", + "matchPackagePatterns": ["plex", "qbittorrent"] + }, + { + "description": "Custom versioning for i915-ucode and intel-ucode", + "matchDatasources": ["docker"], + "versioning": "regex:^(?\\d{4})(?\\d{2})(?\\d{2})\\.?(?\\d+)?$", + "matchPackageNames": [ + "ghcr.io/siderolabs/i915-ucode", + "ghcr.io/siderolabs/intel-ucode" + ] + } + ] +} \ No newline at end of file diff --git a/.github/renovate/semanticCommits.json5 b/.github/renovate/semanticCommits.json5 index 5c23fce028..16be6ec855 100644 --- a/.github/renovate/semanticCommits.json5 +++ b/.github/renovate/semanticCommits.json5 @@ -110,6 +110,11 @@ "matchUpdateTypes": ["patch"], "semanticCommitType": "fix", "semanticCommitScope": "github-action" + }, + { + "matchDatasources": ["custom.grafana-dashboards"], + "matchUpdateTypes": ["major"], + "commitMessagePrefix": "feat(grafana-dashboard)!: " } ] } \ No newline at end of file diff --git a/kubernetes/apps/monitoring/grafana/app/helmrelease.yaml b/kubernetes/apps/monitoring/grafana/app/helmrelease.yaml index c4f5ad3aaa..24eb2dc849 100644 --- a/kubernetes/apps/monitoring/grafana/app/helmrelease.yaml +++ b/kubernetes/apps/monitoring/grafana/app/helmrelease.yaml @@ -186,29 +186,35 @@ spec: dashboards: default: node-exporter-full: - gnetId: 1860 # https://grafana.com/grafana/dashboards/1860?tab=revisions + # renovate: depName="Node Exporter Full" + gnetId: 1860 revision: 31 datasource: Prometheus redis: - gnetId: 763 # https://grafana.com/grafana/dashboards/763?tab=revisions + # renovate: depName="Redis Dashboard for Prometheus Redis Exporter 1.x" + gnetId: 763 revision: 5 datasource: Prometheus external-dns: - gnetId: 15038 # https://grafana.com/grafana/dashboards/15038?tab=revisions + # renovate: depName="External-dns" + gnetId: 15038 revision: 1 datasource: Prometheus blackbox-exporter: - gnetId: 7587 # https://grafana.com/grafana/dashboards/7587?tab=revisions + # renovate: depName="Prometheus Blackbox Exporter" + gnetId: 7587 revision: 3 datasource: Prometheus cloudflared: - gnetId: 17457 # https://grafana.com/grafana/dashboards/17457?tab=revisions + # renovate: depName="Cloudflare Tunnels (cloudflared)" + gnetId: 17457 revision: 6 datasource: - name: DS_PROMETHEUS value: Prometheus speedtest-exporter: - gnetId: 13665 # https://grafana.com/grafana/dashboards/13665?tab=revisions + # renovate: depName="Speedtest-Exporter Dashboard" + gnetId: 13665 revision: 4 datasource: - name: DS_PROMETHEUS @@ -224,15 +230,18 @@ spec: datasource: Prometheus ceph: ceph-cluster: - gnetId: 2842 # https://grafana.com/grafana/dashboards/2842?tab=revisions + # renovate: depName="Ceph Cluster" + gnetId: 2842 revision: 17 datasource: Prometheus ceph-osd: - gnetId: 5336 # https://grafana.com/grafana/dashboards/5336?tab=revisions + # renovate: depName="Ceph - OSD (Single)" + gnetId: 5336 revision: 9 datasource: Prometheus ceph-pools: - gnetId: 5342 # https://grafana.com/grafana/dashboards/5342?tab=revisions + # renovate: depName="Ceph - Pools" + gnetId: 5342 revision: 9 datasource: Prometheus flux: @@ -265,7 +274,8 @@ spec: url: https://raw.githubusercontent.com/dotdc/grafana-dashboards-kubernetes/master/dashboards/k8s-views-pods.json datasource: Prometheus kubernetes-volumes: - gnetId: 11454 # https://grafana.com/grafana/dashboards/11454?tab=revisions + # renovate: depName="K8s / Storage / Volumes / Cluster" + gnetId: 11454 revision: 14 datasource: Prometheus nginx: @@ -277,7 +287,8 @@ spec: datasource: Prometheus blocky: blocky: - gnetId: 13768 # https://grafana.com/grafana/dashboards/13768?tab=revisions + # renovate: depName="blocky" + gnetId: 13768 revision: 3 datasource: - name: DS_PROMETHEUS @@ -317,19 +328,23 @@ spec: datasource: Prometheus unifi: unifi-insights: - gnetId: 11315 # https://grafana.com/grafana/dashboards/11315?tab=revisions + # renovate: depName="UniFi-Poller: Client Insights - Prometheus" + gnetId: 11315 revision: 9 datasource: Prometheus unifi-network-sites: - gnetId: 11311 # https://grafana.com/grafana/dashboards/11311?tab=revisions + # renovate: depName="UniFi-Poller: Network Sites - Prometheus" + gnetId: 11311 revision: 5 datasource: Prometheus unifi-uap: - gnetId: 11314 # https://grafana.com/grafana/dashboards/11314?tab=revisions + # renovate: depName="UniFi-Poller: UAP Insights - Prometheus" + gnetId: 11314 revision: 10 datasource: Prometheus unifi-usw: - gnetId: 11312 # https://grafana.com/grafana/dashboards/11312?tab=revisions + # renovate: depName="UniFi-Poller: USW Insights - Prometheus" + gnetId: 11312 revision: 9 datasource: Prometheus media: @@ -345,7 +360,8 @@ spec: - name: DS_PROMETHEUS value: Prometheus unpackerr: - gnetId: 18817 # https://grafana.com/grafana/dashboards/18817?tab=revisions + # renovate: depName="Unpackerr" + gnetId: 18817 revision: 1 datasource: - name: DS_PROMETHEUS diff --git a/talos/talconfig.yaml b/talos/talconfig.yaml index 68de91ccbe..86d41b4a14 100644 --- a/talos/talconfig.yaml +++ b/talos/talconfig.yaml @@ -6,8 +6,11 @@ clusterPodNets: clusterSvcNets: - 10.245.0.0/16 +# renovate: datasource=github-releases depName=siderolabs/talos talosVersion: v1.5.3 +# renovate: datasource=github-releases depName=kubernetes/kubernetes kubernetesVersion: 1.28.2 + endpoint: https://k8s.${domainName}:6443 additionalApiServerCertSans: