Skip to content

Commit

Permalink
Add ServiceMonitor and Grafana Dashboard to Helm Chart
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Jogeleit committed Feb 21, 2021
1 parent 22ab44a commit dc33274
Show file tree
Hide file tree
Showing 6 changed files with 510 additions and 2 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ helm install policy-reporter policy-reporter/policy-reporter --set loki=http://l
```
You can also customize the `./charts/policy-reporter/values.yaml` to change the default configurations.

### Configure policyPriorities
### Configure Policy Priorities

By default kyverno PolicyReports has no priority or severity for policies. So every passed rule validation will be processed as notice, a failed validation is processed as error. To customize this you can configure a mapping from policies to fail priorities. So you can send them as warnings instead of errors. To configure the priorities create a ConfigMap in the `policy-reporter` namespace with the name `policy-reporter-config`. This ConfigMap have to have a property `config.yaml` with the map as YAML content. See the Example for Detailes.

Expand All @@ -33,6 +33,26 @@ policy_priorities:
kubectl create configmap policy-reporter-config --from-file=config.yaml -n policy-reporter
```

## Monitoring

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 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)


If you are not using the MonitoringStack you can get the dashboard configuration from this [Gist](https://gist.github.com/fjogeleit/bf540421fd28989fc92841177be972bc)

Example Installation
```bash
helm install policy-reporter policy-reporter/policy-reporter --set metrics.serviceMonitor=true --set metrics.dashboard.enabled=true -n policy-reporter --create-namespace
```

#### Dashboard Preview

![PolicyReporter Grafana Dashboard](https://github.com/fjogeleit/policy-reporter/blob/main/docs/images/policy-reports-dashboard.png?raw=true)

## Example Outputs

![Grafana Loki](https://github.com/fjogeleit/policy-reporter/blob/main/docs/images/grafana-loki.png?raw=true)
Expand Down
2 changes: 1 addition & 1 deletion charts/policy-reporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.0
version: 0.3.0
appVersion: 0.2.0
Loading

0 comments on commit dc33274

Please sign in to comment.