Skip to content

Commit

Permalink
rebase to v2
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
  • Loading branch information
Frank Jogeleit committed Jul 2, 2024
1 parent b0d5e1e commit caa7e3e
Show file tree
Hide file tree
Showing 9 changed files with 214 additions and 112 deletions.
2 changes: 2 additions & 0 deletions charts/policy-reporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ config:
region: {{ .region }}
endpoint: {{ .endpoint }}
accountID: {{ .accountID }}
productName: {{ .productName }}
companyName: {{ .companyName }}
{{ include "target" . }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{{- if and $.Values.grafana.dashboards.enabled $.Values.grafana.dashboards.enable.clusterPolicyReportDetails }}
{{- $filters := .Values.grafana.dashboards.labelFilter }}
{{- if and .Values.grafana.dashboards.multicluster.enabled .Values.grafana.dashboards.multicluster.label }}
{{- $filters = append $filters .Values.grafana.dashboards.multicluster.label }}
{{ $root := .Values.monitoring }}

{{- if and $root.grafana.dashboards.enabled $root.grafana.dashboards.enable.clusterPolicyReportDetails }}
{{- $filters := $root.grafana.dashboards.labelFilter }}
{{- if and $root.grafana.dashboards.multicluster.enabled $root.grafana.dashboards.multicluster.label }}
{{- $filters = append $filters $root.grafana.dashboards.multicluster.label }}
{{- end }}

{{- $nsLabel := "exported_namespace" }}
{{- if .Values.serviceMonitor.honorLabels }}
{{- if $root.serviceMonitor.honorLabels }}
{{- $nsLabel = "namespace" }}
{{- end }}

Expand All @@ -15,24 +17,24 @@ metadata:
name: {{ include "monitoring.fullname" . }}-clusterpolicy-details-dashboard
namespace: {{ include "monitoring.namespace" . }}
annotations:
{{ .Values.grafana.folder.annotation }}: {{ .Values.grafana.folder.name }}
{{ $root.grafana.folder.annotation }}: {{ $root.grafana.folder.name }}
{{- with .Values.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{ .Values.grafana.dashboards.label }}: {{ .Values.grafana.dashboards.value | quote }}
{{ $root.grafana.dashboards.label }}: {{ $root.grafana.dashboards.value | quote }}
{{- include "monitoring.labels" . | nindent 4 }}
data:
cluster-policy-reporter-details-dashboard.json: |
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "{{ .Values.grafana.datasource.label }}",
"label": "{{ $root.grafana.datasource.label }}",
"description": "",
"type": "datasource",
"pluginId": "{{ .Values.grafana.datasource.pluginId }}",
"pluginName": "{{ .Values.grafana.datasource.pluginName }}"
"pluginId": "{{ $root.grafana.datasource.pluginId }}",
"pluginName": "{{ $root.grafana.datasource.pluginName }}"
}
],
"__requires": [
Expand Down Expand Up @@ -101,7 +103,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.statusRow.height }},
"h": {{ $root.clusterPolicyReportDetails.statusRow.height }},
"w": 6,
"x": 0,
"y": 0
Expand Down Expand Up @@ -158,7 +160,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.statusRow.height }},
"h": {{ $root.clusterPolicyReportDetails.statusRow.height }},
"w": 6,
"x": 6,
"y": 0
Expand Down Expand Up @@ -215,7 +217,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.statusRow.height }},
"h": {{ $root.clusterPolicyReportDetails.statusRow.height }},
"w": 6,
"x": 12,
"y": 0
Expand Down Expand Up @@ -272,7 +274,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.statusRow.height }},
"h": {{ $root.clusterPolicyReportDetails.statusRow.height }},
"w": 6,
"x": 18,
"y": 0
Expand Down Expand Up @@ -307,7 +309,7 @@ data:
"title": "Policy Error Status",
"type": "stat"
}
{{- if .Values.clusterPolicyReportDetails.statusTimeline.enabled }}
{{- if $root.clusterPolicyReportDetails.statusTimeline.enabled }}
,{
"datasource": {
"uid": "${DS_PROMETHEUS}",
Expand Down Expand Up @@ -412,7 +414,7 @@ data:
]
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.statusTimeline.height }},
"h": {{ $root.clusterPolicyReportDetails.statusTimeline.height }},
"w": 24,
"x": 0,
"y": 6
Expand Down Expand Up @@ -451,7 +453,7 @@ data:
"timeShift": null
}
{{- end }}
{{- if .Values.clusterPolicyReportDetails.passTable.enabled }}
{{- if $root.clusterPolicyReportDetails.passTable.enabled }}
,{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
Expand All @@ -477,7 +479,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.passTable.height }},
"h": {{ $root.clusterPolicyReportDetails.passTable.height }},
"w": 24,
"x": 0,
"y": 15
Expand Down Expand Up @@ -530,7 +532,7 @@ data:
"type": "table"
}
{{- end }}
{{- if .Values.clusterPolicyReportDetails.failTable.enabled }}
{{- if $root.clusterPolicyReportDetails.failTable.enabled }}
,{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
Expand All @@ -556,7 +558,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.failTable.height }},
"h": {{ $root.clusterPolicyReportDetails.failTable.height }},
"w": 24,
"x": 0,
"y": 23
Expand Down Expand Up @@ -609,7 +611,7 @@ data:
"type": "table"
}
{{- end }}
{{- if .Values.clusterPolicyReportDetails.warningTable.enabled }}
{{- if $root.clusterPolicyReportDetails.warningTable.enabled }}
,{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
Expand All @@ -632,7 +634,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.warningTable.height }},
"h": {{ $root.clusterPolicyReportDetails.warningTable.height }},
"w": 24,
"x": 0,
"y": 31
Expand Down Expand Up @@ -685,7 +687,7 @@ data:
"type": "table"
}
{{- end }}
{{- if .Values.clusterPolicyReportDetails.errorTable.enabled }}
{{- if $root.clusterPolicyReportDetails.errorTable.enabled }}
,{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
Expand All @@ -708,7 +710,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.clusterPolicyReportDetails.errorTable.height }},
"h": {{ $root.clusterPolicyReportDetails.errorTable.height }},
"w": 24,
"x": 0,
"y": 36
Expand Down
34 changes: 18 additions & 16 deletions charts/policy-reporter/templates/monitoring/overview.dashboard.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{{- if and $.Values.grafana.dashboards.enabled $.Values.grafana.dashboards.enable.overview }}
{{- $filters := .Values.grafana.dashboards.labelFilter }}
{{- if and .Values.grafana.dashboards.multicluster.enabled .Values.grafana.dashboards.multicluster.label }}
{{- $filters = append $filters .Values.grafana.dashboards.multicluster.label }}
{{ $root := .Values.monitoring }}

{{- if and $root.grafana.dashboards.enabled $root.grafana.dashboards.enable.overview }}
{{- $filters := $root.grafana.dashboards.labelFilter }}
{{- if and $root.grafana.dashboards.multicluster.enabled $root.grafana.dashboards.multicluster.label }}
{{- $filters = append $filters $root.grafana.dashboards.multicluster.label }}
{{- end }}

{{- $nsLabel := "exported_namespace" }}
{{- if .Values.serviceMonitor.honorLabels }}
{{- if $root.serviceMonitor.honorLabels }}
{{- $nsLabel = "namespace" }}
{{- end }}

Expand All @@ -15,13 +17,13 @@ metadata:
name: {{ include "monitoring.fullname" . }}-overview-dashboard
namespace: {{ include "monitoring.namespace" . }}
annotations:
{{ .Values.grafana.folder.annotation }}: {{ .Values.grafana.folder.name }}
{{ $root.grafana.folder.annotation }}: {{ $root.grafana.folder.name }}
{{- with .Values.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{ .Values.grafana.dashboards.label }}: {{ .Values.grafana.dashboards.value | quote }}
{{- with .Values.serviceMonitor.labels }}
{{ $root.grafana.dashboards.label }}: {{ $root.grafana.dashboards.value | quote }}
{{- with $root.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- include "monitoring.labels" . | nindent 4 }}
Expand All @@ -31,11 +33,11 @@ data:
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "{{ .Values.grafana.datasource.label }}",
"label": "{{ $root.grafana.datasource.label }}",
"description": "",
"type": "datasource",
"pluginId": "{{ .Values.grafana.datasource.pluginId }}",
"pluginName": "{{ .Values.grafana.datasource.pluginName }}"
"pluginId": "{{ $root.grafana.datasource.pluginId }}",
"pluginName": "{{ $root.grafana.datasource.pluginName }}"
}
],
"__requires": [
Expand Down Expand Up @@ -94,7 +96,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.policyReportOverview.failingSummaryRow.height }},
"h": {{ $root.policyReportOverview.failingSummaryRow.height }},
"w": 15,
"x": 0,
"y": 0
Expand Down Expand Up @@ -153,7 +155,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.policyReportOverview.failingSummaryRow.height }},
"h": {{ $root.policyReportOverview.failingSummaryRow.height }},
"w": 9,
"x": 15,
"y": 0
Expand Down Expand Up @@ -292,7 +294,7 @@ data:
]
},
"gridPos": {
"h": {{ .Values.policyReportOverview.failingTimeline.height }},
"h": {{ $root.policyReportOverview.failingTimeline.height }},
"w": 24,
"x": 0,
"y": 8
Expand Down Expand Up @@ -363,7 +365,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.policyReportOverview.failingPolicyRuleTable.height }},
"h": {{ $root.policyReportOverview.failingPolicyRuleTable.height }},
"w": 24,
"x": 0,
"y": 18
Expand Down Expand Up @@ -438,7 +440,7 @@ data:
"overrides": []
},
"gridPos": {
"h": {{ .Values.policyReportOverview.failingClusterPolicyRuleTable.height }},
"h": {{ $root.policyReportOverview.failingClusterPolicyRuleTable.height }},
"w": 24,
"x": 0,
"y": 28
Expand Down
Loading

0 comments on commit caa7e3e

Please sign in to comment.