mirror of
https://github.com/kyverno/policy-reporter.git
synced 2024-12-14 11:57:32 +00:00
Improve ServiceMonitor customization
This commit is contained in:
parent
a949b409cd
commit
5e4bacd9ee
7 changed files with 25 additions and 11 deletions
11
CHANGELOG.md
11
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`
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue