diff --git a/CHANGELOG.md b/CHANGELOG.md index 872bcbcb..5a79803f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,19 @@ # Changelog -## 0.9.0 +## 0.11.0 + +* Helm Chart Value `metrics.serviceMonitor` changed to `metrics.serviceMonitor.enabled` +* New Helm Chart Value `metrics.serviceMonitor.labels` can be used to add additional `labels` to the `SeriveMonitor`. This helps to fullfil the `serviceMonitorSelector` of the `Prometheus` Resource in the MonitoringStack. + +## 0.10.0 * Implement Discord as Target for PolicyReportResults -## 0.8.0 +## 0.9.0 * Implement Slack as Target for PolicyReportResults -## 0.7.0 +## 0.8.0 * Implement Elasticsearch as Target for PolicyReportResults * Replace CLI flags with a single `config.yaml` to manage target-configurations as separate `ConfigMap` diff --git a/README.md b/README.md index 921901eb..f971fae7 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ elasticsearch: helm install policy-reporter policy-reporter/policy-reporter --set slack.webhook=http://hook.slack -n policy-reporter --create-namespace ``` -### Additional configurations for Slack +#### Additional configurations for Slack * Configure `slack.minimumPriority` to send only results with the configured minimumPriority or above, empty means all results. (info < warning < error) * Configure `slack.skipExistingOnStartup` to skip all results who already existed before the PolicyReporter started (default: `true`). @@ -101,7 +101,7 @@ discord: ### Customization -You can combine multiple targets by setting the required `host` or `webhook` configuration for your targets of choice. For all possible configurations checkout the `./charts/policy-reporter/values.yaml` to change any configurations available. +You can combine multiple targets by setting the required `host` or `webhook` configuration for your targets of choice. For all possible configurations checkout the `./charts/policy-reporter/values.yaml` to change any available configuration. ### Configure Policy Priorities @@ -117,7 +117,8 @@ kubectl create configmap policy-reporter-priorities --from-literal check-label-a The Helm Chart includes optional Manifests for the [MonitoringStack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack). The provided Dashboard works without Loki -* Enable a ServiceMonitor by setting `metrics.serviceMonitor` to `true`. +* Enable a ServiceMonitor by setting `metrics.serviceMonitor.enabled` to `true`. + * With `metrics.serviceMonitor.labels` you can add additional labels to the `ServiceMonitor`. This helps to match the `serviceMonitorSelector` configuration of your Prometheus resource * Enable a basic Dashboard as ConfigMap by setting `metrics.dashboard.enabled` to `true`. * Change the namespace to your required monitoring namespace by changing `metrics.dashboard.namespace` (default: cattle-dashboards) diff --git a/charts/policy-reporter/Chart.yaml b/charts/policy-reporter/Chart.yaml index 95b4d217..921a70fd 100644 --- a/charts/policy-reporter/Chart.yaml +++ b/charts/policy-reporter/Chart.yaml @@ -3,5 +3,5 @@ name: policy-reporter description: K8s PolicyReporter watches for wgpolicyk8s.io/v1alpha1.PolicyReport resources. It creates Prometheus Metrics and can send rule validation events to Loki type: application -version: 0.10.0 +version: 0.11.0 appVersion: 0.9.0 diff --git a/charts/policy-reporter/templates/servicemonitor.yaml b/charts/policy-reporter/templates/servicemonitor.yaml index ac03f4ab..2aec66dd 100644 --- a/charts/policy-reporter/templates/servicemonitor.yaml +++ b/charts/policy-reporter/templates/servicemonitor.yaml @@ -1,8 +1,12 @@ -{{- if .Values.metrics.serviceMonitor }} +{{- if .Values.metrics.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "policyreporter.fullname" . }} + {{- if .Values.metrics.serviceMonitor.labels }} + labels: + {{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }} + {{- end }} spec: selector: matchLabels: diff --git a/charts/policy-reporter/values.yaml b/charts/policy-reporter/values.yaml index be87c142..c1d1dd15 100644 --- a/charts/policy-reporter/values.yaml +++ b/charts/policy-reporter/values.yaml @@ -36,7 +36,11 @@ discord: skipExistingOnStartup: true metrics: - serviceMonitor: false + serviceMonitor: + enabled: false + # labels to match the serviceMonitorSelector of the Prometheus Resource + labels: {} + dashboard: enabled: false namespace: cattle-dashboards diff --git a/pkg/target/discord/discord_test.go b/pkg/target/discord/discord_test.go index e9f76830..6e6fa744 100644 --- a/pkg/target/discord/discord_test.go +++ b/pkg/target/discord/discord_test.go @@ -66,7 +66,7 @@ func Test_LokiTarget(t *testing.T) { } slack := discord.NewClient("http://hook.discord:80", "", false, testClient{callback, 200}) - slack.Send(minimalResult) + slack.Send(completeResult) }) t.Run("Send Minimal Result", func(t *testing.T) { diff --git a/pkg/target/slack/slack_test.go b/pkg/target/slack/slack_test.go index 18b0029a..a551c33e 100644 --- a/pkg/target/slack/slack_test.go +++ b/pkg/target/slack/slack_test.go @@ -66,7 +66,7 @@ func Test_LokiTarget(t *testing.T) { } slack := slack.NewClient("http://hook.slack:80", "", false, testClient{callback, 200}) - slack.Send(minimalResult) + slack.Send(completeResult) }) t.Run("Send Minimal Result", func(t *testing.T) {