diff --git a/charts/policy-reporter/Chart.lock b/charts/policy-reporter/Chart.lock index d6085565..44d3643d 100644 --- a/charts/policy-reporter/Chart.lock +++ b/charts/policy-reporter/Chart.lock @@ -1,12 +1,12 @@ dependencies: - name: monitoring repository: "" - version: 1.4.4 + version: 1.5.0 - name: ui repository: "" version: 1.10.0 - name: kyvernoPlugin repository: "" version: 0.7.0 -digest: sha256:93996a41bb416445ba7e5c8fe29650a811671b9970bd0366aa09c860cfedc91c -generated: "2021-09-27T09:56:18.1815481+02:00" +digest: sha256:9c81be2f483771e0192cc4309d58ee754502f51df7f1cd55bc50d207370dbc98 +generated: "2021-10-13T14:25:35.257173006+02:00" diff --git a/charts/policy-reporter/Chart.yaml b/charts/policy-reporter/Chart.yaml index 3a9b411e..52002f9c 100644 --- a/charts/policy-reporter/Chart.yaml +++ b/charts/policy-reporter/Chart.yaml @@ -5,14 +5,14 @@ description: | It creates Prometheus Metrics and can send rule validation events to different targets like Loki, Elasticsearch, Slack or Discord type: application -version: 1.11.0 +version: 1.12.0 appVersion: 1.9.0 dependencies: - name: monitoring condition: monitoring.enabled repository: "" - version: "1.4.4" + version: "1.5.0" - name: ui condition: ui.enabled repository: "" diff --git a/charts/policy-reporter/charts/monitoring/Chart.yaml b/charts/policy-reporter/charts/monitoring/Chart.yaml index 203672cb..041df029 100644 --- a/charts/policy-reporter/charts/monitoring/Chart.yaml +++ b/charts/policy-reporter/charts/monitoring/Chart.yaml @@ -3,5 +3,5 @@ name: monitoring description: Policy Reporter Monitoring with predefined ServiceMonitor and Grafana Dashboards type: application -version: 1.4.4 +version: 1.5.0 appVersion: 0.0.0 diff --git a/charts/policy-reporter/charts/monitoring/templates/clusterpolicy-details.dashboard.yaml b/charts/policy-reporter/charts/monitoring/templates/clusterpolicy-details.dashboard.yaml index cbb786c2..57522124 100644 --- a/charts/policy-reporter/charts/monitoring/templates/clusterpolicy-details.dashboard.yaml +++ b/charts/policy-reporter/charts/monitoring/templates/clusterpolicy-details.dashboard.yaml @@ -1,3 +1,4 @@ +{{- if $.Values.grafana.dashboards.enabled }} apiVersion: v1 kind: ConfigMap metadata: @@ -809,4 +810,5 @@ data: "title": "ClusterPolicyReport Details", "uid": "iyJszGUMk", "version": 1 - } \ No newline at end of file + } +{{- end }} \ No newline at end of file diff --git a/charts/policy-reporter/charts/monitoring/templates/overview.dashboard.yaml b/charts/policy-reporter/charts/monitoring/templates/overview.dashboard.yaml index 83596194..800545d6 100644 --- a/charts/policy-reporter/charts/monitoring/templates/overview.dashboard.yaml +++ b/charts/policy-reporter/charts/monitoring/templates/overview.dashboard.yaml @@ -1,3 +1,4 @@ +{{- if $.Values.grafana.dashboards.enabled }} apiVersion: v1 kind: ConfigMap metadata: @@ -478,3 +479,4 @@ data: "title": "PolicyReports", "version": 1 } +{{- end }} \ No newline at end of file diff --git a/charts/policy-reporter/charts/monitoring/templates/policy-details.dashboard.yaml b/charts/policy-reporter/charts/monitoring/templates/policy-details.dashboard.yaml index 4a9d0d55..552e55a9 100644 --- a/charts/policy-reporter/charts/monitoring/templates/policy-details.dashboard.yaml +++ b/charts/policy-reporter/charts/monitoring/templates/policy-details.dashboard.yaml @@ -1,3 +1,4 @@ +{{- if $.Values.grafana.dashboards.enabled }} apiVersion: v1 kind: ConfigMap metadata: @@ -830,3 +831,4 @@ data: "uid": "Tf1skG8Mz", "version": 1 } +{{- end }} \ No newline at end of file diff --git a/charts/policy-reporter/charts/monitoring/values.yaml b/charts/policy-reporter/charts/monitoring/values.yaml index 0c4a7439..691aabc6 100644 --- a/charts/policy-reporter/charts/monitoring/values.yaml +++ b/charts/policy-reporter/charts/monitoring/values.yaml @@ -14,6 +14,8 @@ grafana: # namespace for configMap of grafana dashboards namespace: dashboards: + # Enable the deployment of grafana dashboards + enabled: true # Label to find dashboards using the k8s sidecar label: grafana_dashboard folder: diff --git a/charts/policy-reporter/templates/deployment.yaml b/charts/policy-reporter/templates/deployment.yaml index 04399ca6..3d11905a 100644 --- a/charts/policy-reporter/templates/deployment.yaml +++ b/charts/policy-reporter/templates/deployment.yaml @@ -66,15 +66,23 @@ spec: volumeMounts: - name: config-file mountPath: /app/config.yaml + {{- if and .Values.existingTargetConfig.enabled .Values.existingTargetConfig.subPath }} + subPath: {{ .Values.existingTargetConfig.subPath }} + {{- else }} subPath: config.yaml + {{- end }} env: - name: NAMESPACE value: {{ .Release.Namespace }} volumes: - name: config-file secret: + {{- if and .Values.existingTargetConfig.enabled .Values.existingTargetConfig.name }} + secretName: {{ .Values.existingTargetConfig.name }} + {{- else }} secretName: {{ include "policyreporter.fullname" . }}-targets - optional: true + {{- end }} + optional: true {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/policy-reporter/templates/targetssecret.yaml b/charts/policy-reporter/templates/targetssecret.yaml index ee3b7353..85e1521f 100644 --- a/charts/policy-reporter/templates/targetssecret.yaml +++ b/charts/policy-reporter/templates/targetssecret.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.existingTargetConfig.enabled }} apiVersion: v1 kind: Secret metadata: @@ -6,4 +7,5 @@ metadata: {{- include "policyreporter.labels" . | nindent 4 }} type: Opaque data: - config.yaml: {{ tpl (.Files.Get "config.yaml") . | b64enc }} \ No newline at end of file + config.yaml: {{ tpl (.Files.Get "config.yaml") . | b64enc }} +{{- end }} \ No newline at end of file diff --git a/charts/policy-reporter/values.yaml b/charts/policy-reporter/values.yaml index 2a6ad66a..0ef91fe5 100644 --- a/charts/policy-reporter/values.yaml +++ b/charts/policy-reporter/values.yaml @@ -128,6 +128,14 @@ policyPriorities: # require-ns-labels: error mapping: {} +# Reference a configuration which already exists instead of creating one +existingTargetConfig: + enabled: false + # Name of the secret with the config + name: "" + # subPath within the secret (defaults to config.yaml) + subPath: "" + # Supported targets for new PolicyReport Results target: loki: