From f499589ecd57999c3740625201b6ed2ed99042eb Mon Sep 17 00:00:00 2001 From: stakater-nordmart-bot Date: Sat, 16 Mar 2024 13:53:18 +0500 Subject: [PATCH] updates the api version for grafana dashboard and adds more fields [skip ci] update changelog fix the api version add instance selector update README add check for capabilities Update version with major bump [skip-ci] Update artifacts Updates to GrafanaDashboard [skip ci] Changes apiversion to v1beta1 "Update grafanadashboard (#302)" This reverts commit 1762f006b31e721647e5b42d0bd437e06c049f0a, reversing changes made to 9d55ce127a2a8b1556ab9c4d84e3c162cbdd88b3. Revert "[skip-ci] Update artifacts" This reverts commit 826a784118d3852658791fc874f207a5e5ba15a1. update grafana dashboard #major [skip-ci] Update artifacts Revert "Update grafana dashboard #major (#305)" This reverts commit a3bec388de7da1cb1c375c4aca0f88afa067bd1d, reversing changes made to 31225c17b6147c5438114b21a86ed8d7132c5845. Revert "[skip-ci] Update artifacts" This reverts commit e824950c903b384e2d07d7dd77b64697552fd3bd. granfana updates [skip-ci] Update artifacts --- CHANGELOG.md | 3 +++ README.md | 4 +++ application/Chart.yaml | 2 +- application/templates/grafanadashboard.yaml | 28 +++++++++++++++++---- application/values-test.yaml | 13 +++++++++- application/values.yaml | 12 +++++++++ 6 files changed, 55 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d946511e..6c3810c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented here. +### v3.0.0 +- Feature: Updates the GrafanaDashboard api version to v1beta1. + ### v2.3.2 - Feature: fix clusterIP null field introduced by [PR-275](https://github.com/stakater/application/pull/275) [PR-295](https://github.com/stakater/application/pull/295) diff --git a/README.md b/README.md index 1665c054..613df09a 100644 --- a/README.md +++ b/README.md @@ -435,6 +435,10 @@ Stakater [IngressMonitorController](https://github.com/stakater/IngressMonitorCo | grafanaDashboard.contents.key | Used as name of Grafana Dashboard object | `""` | | grafanaDashboard.contents.key.json | json string used as content of Grafana Dashboard object | `""` | | grafanaDashboard.contents.key.url| Url used to fetch dashboard content. According to GrafanaDashboard behavior, if both url and json are specified then the GrafanaDashboard content will be updated with fetched content from url | `""` | +| grafanaDashboard.contents.key.instanceSelector | selects Grafana instances for import | `{}` | +| grafanaDashboard.contents.key.folder | folder assignment for dashboard | `""` | +| grafanaDashboard.contents.key.configMapRef | dashboard from configmap | `[]` | +| grafanaDashboard.contents.key.datasources | maps required data sources to existing ones | `{}` | ### CronJob Parameters diff --git a/application/Chart.yaml b/application/Chart.yaml index 3cdc5d6e..c11d2c69 100644 --- a/application/Chart.yaml +++ b/application/Chart.yaml @@ -6,7 +6,7 @@ type: application # Helm chart Version -version: 2.3.3 +version: 3.0.0 keywords: diff --git a/application/templates/grafanadashboard.yaml b/application/templates/grafanadashboard.yaml index d498b474..538a4d33 100644 --- a/application/templates/grafanadashboard.yaml +++ b/application/templates/grafanadashboard.yaml @@ -1,29 +1,47 @@ -{{- if and (.Values.grafanaDashboard).enabled (.Capabilities.APIVersions.Has "integreatly.org/v1alpha1") -}} +{{- if and (.Values.grafanaDashboard).enabled (.Capabilities.APIVersions.Has "grafana.integreatly.org/v1beta1") -}} {{- range $name, $content := .Values.grafanaDashboard.contents }} --- -apiVersion: integreatly.org/v1alpha1 +apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard metadata: name: {{ $name }} namespace: {{ template "application.namespace" $ }} labels: - # this label is used as dashboard selector by grafana operator + # this label is used as dashboard selector by grafana operator grafanaDashboard: grafana-operator {{- include "application.labels" $ | nindent 4 }} {{- if $.Values.grafanaDashboard.additionalLabels }} {{ toYaml $.Values.grafanaDashboard.additionalLabels | indent 4 }} {{- end }} {{- if $.Values.grafanaDashboard.annotations }} - annotations: + annotations: {{ toYaml $.Values.grafanaDashboard.annotations | indent 4 }} {{- end }} spec: {{- if $content.json }} - json: + json: {{ $content.json | toJson }} {{- end }} {{- if $content.url }} url: {{ $content.url }} {{- end }} + {{- if $content.allowCrossNamespaceImport }} + allowCrossNamespaceImport: {{ $content.allowCrossNamespaceImport }} + {{- end }} + {{- if $content.folder }} + folder: {{ $content.folder }} + {{- end }} + {{- if $content.instanceSelector }} + instanceSelector: +{{ toYaml $content.instanceSelector | indent 4 }} + {{- end }} + {{- if $content.configMapRef }} + configMapRef: +{{ toYaml $content.configMapRef | indent 4 }} + {{- end }} + {{- if $content.datasources }} + datasources: +{{ toYaml $content.datasources | indent 4 }} + {{- end }} {{- end }} {{- end }} diff --git a/application/values-test.yaml b/application/values-test.yaml index fa8c0a06..88111350 100644 --- a/application/values-test.yaml +++ b/application/values-test.yaml @@ -1273,7 +1273,18 @@ grafanaDashboard: "uid": "OmHEcaFZz", "version": 3 } - + dashboard-test-name-2: + allowCrossNamespaceImport: true + configMapRef: + key: json + name: storage-observability-definition + datasources: + - datasourceName: Test + inputName: DS_PROMETHEUS + folder: Storage Observability + instanceSelector: + matchLabels: + app: test-2 cronJob: enabled: true diff --git a/application/values.yaml b/application/values.yaml index 8993952b..ee3ab15d 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -888,3 +888,15 @@ grafanaDashboard: # "data" # } # url: http://hostname/path/to/file.json + # dashboard-test-name-2: + # allowCrossNamespaceImport: true + # configMapRef: + # key: json + # name: storage-observability-definition + # datasources: + # - datasourceName: Test + # inputName: DS_PROMETHEUS + # folder: Storage Observability + # instanceSelector: + # matchLabels: + # app: test-2 \ No newline at end of file