diff --git a/charts/policy-reporter/templates/_helpers.tpl b/charts/policy-reporter/templates/_helpers.tpl index f5b78b8b..92f4c30a 100644 --- a/charts/policy-reporter/templates/_helpers.tpl +++ b/charts/policy-reporter/templates/_helpers.tpl @@ -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 -}} diff --git a/charts/policy-reporter/templates/monitoring/clusterpolicy-details.dashboard.yaml b/charts/policy-reporter/templates/monitoring/clusterpolicy-details.dashboard.yaml index 626de0e4..a21f9881 100644 --- a/charts/policy-reporter/templates/monitoring/clusterpolicy-details.dashboard.yaml +++ b/charts/policy-reporter/templates/monitoring/clusterpolicy-details.dashboard.yaml @@ -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 }} diff --git a/charts/policy-reporter/templates/monitoring/clusterpolicy-details.grafanadashboard.yaml b/charts/policy-reporter/templates/monitoring/clusterpolicy-details.grafanadashboard.yaml index 21f5e22b..62639a18 100644 --- a/charts/policy-reporter/templates/monitoring/clusterpolicy-details.grafanadashboard.yaml +++ b/charts/policy-reporter/templates/monitoring/clusterpolicy-details.grafanadashboard.yaml @@ -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 }} \ No newline at end of file +{{- end }} diff --git a/charts/policy-reporter/templates/monitoring/overview.dashboard.yaml b/charts/policy-reporter/templates/monitoring/overview.dashboard.yaml index 4fa1375b..8dfa648d 100644 --- a/charts/policy-reporter/templates/monitoring/overview.dashboard.yaml +++ b/charts/policy-reporter/templates/monitoring/overview.dashboard.yaml @@ -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 }} diff --git a/charts/policy-reporter/templates/monitoring/overview.grafanadashboard.yaml b/charts/policy-reporter/templates/monitoring/overview.grafanadashboard.yaml index 462d6a22..aa817aa8 100644 --- a/charts/policy-reporter/templates/monitoring/overview.grafanadashboard.yaml +++ b/charts/policy-reporter/templates/monitoring/overview.grafanadashboard.yaml @@ -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 }} \ No newline at end of file +{{- end }} diff --git a/charts/policy-reporter/templates/monitoring/policy-details.dashboard.yaml b/charts/policy-reporter/templates/monitoring/policy-details.dashboard.yaml index 024a2238..3f1ca749 100644 --- a/charts/policy-reporter/templates/monitoring/policy-details.dashboard.yaml +++ b/charts/policy-reporter/templates/monitoring/policy-details.dashboard.yaml @@ -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 }} diff --git a/charts/policy-reporter/templates/monitoring/policy-details.grafanadashboard.yaml b/charts/policy-reporter/templates/monitoring/policy-details.grafanadashboard.yaml index ce8b66fe..f7ced6a6 100644 --- a/charts/policy-reporter/templates/monitoring/policy-details.grafanadashboard.yaml +++ b/charts/policy-reporter/templates/monitoring/policy-details.grafanadashboard.yaml @@ -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 }} \ No newline at end of file +{{- end }}