1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

feat: move grafana dashboard to a subchart (#8619) (#8620)

* feat: move grafana dashboard to a subchart



* fix codegen



* fix: add dependencies



* fix codegen



---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Co-authored-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
This commit is contained in:
gcp-cherry-pick-bot[bot] 2023-10-11 22:35:34 +08:00 committed by GitHub
parent 52f1452ec6
commit 6594e11caa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 77 additions and 32 deletions

View file

@ -70,3 +70,7 @@ annotations:
description: missing image pull policy missing in a couple of deployments
- kind: added
description: added TUF flags for custom sigstore deployments
dependencies:
- name: grafana
version: "0.0.0"
condition: grafana.enabled

View file

@ -758,6 +758,10 @@ Please see https://kyverno.io/docs/installation/#security-vs-operability for mor
Kubernetes: `>=1.16.0-0`
| Repository | Name | Version |
|------------|------|---------|
| | grafana | 0.0.0 |
## Maintainers
| Name | Email | Url |

View file

@ -0,0 +1,3 @@
apiVersion: v2
name: grafana
version: 0.0.0

View file

@ -0,0 +1,16 @@
# grafana
![Version: 0.0.0](https://img.shields.io/badge/Version-0.0.0-informational?style=flat-square)
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| configMapName | string | `"{{ include \"kyverno.fullname\" . }}-grafana"` | Configmap name template. |
| 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. |
| annotations | object | `{}` | Grafana dashboard configmap annotations. |
| labels | object | `{"grafana_dashboard":"1"}` | Grafana dashboard configmap labels |
| 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/ |
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)

View file

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

View file

@ -0,0 +1,20 @@
# -- Configmap name template.
configMapName: '{{ include "kyverno.fullname" . }}-grafana'
# -- (string) Namespace to create the grafana dashboard configmap.
# If not set, it will be created in the same namespace where the chart is deployed.
namespace: ~
# -- Grafana dashboard configmap annotations.
annotations: {}
# -- Grafana dashboard configmap labels
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"

View file

@ -1,32 +0,0 @@
{{- if .Values.grafana.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ tpl .Values.grafana.configMapName . }}
namespace: {{ default (include "kyverno.namespace" .) .Values.grafana.namespace }}
annotations:
{{- toYaml .Values.grafana.annotations | nindent 4 }}
labels:
{{- 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 -}}