1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-08 10:04:25 +00:00

feat: possibility to create a GrafanaDashboard CR (#7992)

* feat: possibility to create a GrafanaDashboard CR
* fix: support more than one dashboard in configmap
* add changelog and update documentation
---------

Signed-off-by: Johannes Kleinlercher <johannes@kleinlercher.at>
Signed-off-by: treydock <treydock@gmail.com>
Co-authored-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Co-authored-by: treydock <treydock@gmail.com>
Co-authored-by: treydock <tdockendorf@osc.edu>
This commit is contained in:
Johannes Kleinlercher 2023-08-15 18:38:19 +02:00 committed by GitHub
parent e9e44291bf
commit df7027d11c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View file

@ -26,6 +26,8 @@ annotations:
url: https://kyverno.io/docs
# valid kinds are: added, changed, deprecated, removed, fixed and security
artifacthub.io/changes: |
- kind: added
description: support for GrafanaDashboard custom resource
- kind: changed
description: only create ServiceMonitor if cluster supports it
- kind: fixed

View file

@ -608,6 +608,7 @@ The chart values are organised per component.
| grafana.namespace | string | `nil` | Namespace to create the grafana dashboard configmap. If not set, it will be created in the same namespace where the chart is deployed. |
| grafana.annotations | object | `{}` | Grafana dashboard configmap annotations. |
| grafana.labels | object | `{"grafana_dashboard":"1"}` | Grafana dashboard configmap labels |
| grafana.grafanaDashboard | object | `{"create":false,"matchLabels":{"dashboards":"grafana"}}` | create GrafanaDashboard custom resource referencing to the configMap. according to https://grafana-operator.github.io/grafana-operator/docs/examples/dashboard_from_configmap/readme/ |
### Webhooks cleanup

View file

@ -10,4 +10,23 @@ metadata:
{{- toYaml .Values.grafana.labels | nindent 4 }}
data:
{{ (.Files.Glob "grafana/*").AsConfig | indent 2 }}
---
{{- if .Values.grafana.grafanaDashboard.create -}}
{{ range $path, $_ := .Files.Glob "grafana/*" -}}
{{ $name := base $path }}
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: {{ tpl $.Values.grafana.configMapName $ }}-{{ $name }}
namespace: {{ default (include "kyverno.namespace" $ ) $.Values.grafana.namespace }}
spec:
instanceSelector:
matchLabels:
{{- toYaml $.Values.grafana.grafanaDashboard.matchLabels | nindent 6 }}
configMapRef:
name: {{ tpl $.Values.grafana.configMapName $ }}
key: {{ $name }}
---
{{ end -}}
{{- end -}}
{{- end -}}

View file

@ -358,6 +358,13 @@ grafana:
labels:
grafana_dashboard: "1"
# -- create GrafanaDashboard custom resource referencing to the configMap.
# according to https://grafana-operator.github.io/grafana-operator/docs/examples/dashboard_from_configmap/readme/
grafanaDashboard:
create: false
matchLabels:
dashboards: "grafana"
# Features configuration
features:
admissionReports: