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

Use monitoring.grafana.namespace value for namespace when creating grafanadashboard or configmap resources for grafana (#586)

Signed-off-by: Vidar Anima Normann <1858786+vidarno@users.noreply.github.com>
This commit is contained in:
Vidar Normann 2024-11-20 14:05:22 +01:00 committed by GitHub
parent db77adc85b
commit 83d9be9400
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 18 additions and 9 deletions

View file

@ -112,6 +112,15 @@ maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end -}}
{{- end -}}
{{/* Get the namespace name for grafana. */}}
{{- define "grafana.namespace" -}}
{{- if .Values.monitoring.grafana.namespace -}}
{{- .Values.monitoring.grafana.namespace -}}
{{- else -}}
{{- include "policyreporter.namespace" . -}}
{{- end -}}
{{- end -}}
{{/* Get the namespace name. */}}
{{- define "policyreporter.logLevel" -}}
{{- if .Values.logging.server -}}

View file

@ -15,7 +15,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "monitoring.fullname" . }}-clusterpolicy-details-dashboard
namespace: {{ include "policyreporter.namespace" . }}
namespace: {{ include "grafana.namespace" . }}
annotations:
{{ $root.grafana.folder.annotation }}: {{ $root.grafana.folder.name }}
{{- with .Values.annotations }}

View file

@ -6,7 +6,7 @@ metadata:
{{ .Values.monitoring.grafana.dashboards.label }}: {{ .Values.monitoring.grafana.dashboards.value | quote }}
{{- include "monitoring.labels" . | nindent 4 }}
name: {{ include "monitoring.fullname" . }}-clusterpolicy-details-dashboard
namespace: {{ include "policyreporter.namespace" . }}
namespace: {{ include "grafana.namespace" . }}
spec:
allowCrossNamespaceImport: {{ .Values.monitoring.grafana.grafanaDashboard.allowCrossNamespaceImport }}
folder: {{ .Values.monitoring.grafana.grafanaDashboard.folder }}
@ -16,4 +16,4 @@ spec:
configMapRef:
name: {{ include "monitoring.fullname" . }}-clusterpolicy-details-dashboard
key: cluster-policy-reporter-details-dashboard.json
{{- end }}
{{- end }}

View file

@ -15,7 +15,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "monitoring.fullname" . }}-overview-dashboard
namespace: {{ include "policyreporter.namespace" . }}
namespace: {{ include "grafana.namespace" . }}
annotations:
{{ $root.grafana.folder.annotation }}: {{ $root.grafana.folder.name }}
{{- with .Values.annotations }}

View file

@ -6,7 +6,7 @@ metadata:
{{ .Values.monitoring.grafana.dashboards.label }}: {{ .Values.monitoring.grafana.dashboards.value | quote }}
{{- include "monitoring.labels" . | nindent 4 }}
name: {{ include "monitoring.fullname" . }}-overview-dashboard
namespace: {{ include "policyreporter.namespace" . }}
namespace: {{ include "grafana.namespace" . }}
spec:
allowCrossNamespaceImport: {{ .Values.monitoring.grafana.grafanaDashboard.allowCrossNamespaceImport }}
folder: {{ .Values.monitoring.grafana.grafanaDashboard.folder }}
@ -16,4 +16,4 @@ spec:
configMapRef:
name: {{ include "monitoring.fullname" . }}-overview-dashboard
key: policy-reporter-dashboard.json
{{- end }}
{{- end }}

View file

@ -15,7 +15,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "monitoring.fullname" . }}-policy-details-dashboard
namespace: {{ include "policyreporter.namespace" . }}
namespace: {{ include "grafana.namespace" . }}
annotations:
{{ $root.grafana.folder.annotation }}: {{ $root.grafana.folder.name }}
{{- with .Values.annotations }}

View file

@ -6,7 +6,7 @@ metadata:
{{ .Values.monitoring.grafana.dashboards.label }}: {{ .Values.monitoring.grafana.dashboards.value | quote }}
{{- include "monitoring.labels" . | nindent 4 }}
name: {{ include "monitoring.fullname" . }}-policy-details-dashboard
namespace: {{ include "policyreporter.namespace" . }}
namespace: {{ include "grafana.namespace" . }}
spec:
allowCrossNamespaceImport: {{ .Values.monitoring.grafana.grafanaDashboard.allowCrossNamespaceImport }}
folder: {{ .Values.monitoring.grafana.grafanaDashboard.folder }}
@ -16,4 +16,4 @@ spec:
configMapRef:
name: {{ include "monitoring.fullname" . }}-policy-details-dashboard
key: policy-reporter-details-dashboard.json
{{- end }}
{{- end }}