mirror of
https://github.com/kyverno/policy-reporter.git
synced 2024-12-14 11:57:32 +00:00
Configuration Improvements
This commit is contained in:
parent
8cf6013905
commit
98fc143065
5 changed files with 20 additions and 24 deletions
15
README.md
15
README.md
|
@ -21,14 +21,19 @@ You can also customize the `./charts/policy-reporter/values.yaml` to change the
|
|||
|
||||
### Configure policyPriorities
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
# values.yaml
|
||||
# policyPriorities example diff
|
||||
# config.yaml
|
||||
policy_priorities:
|
||||
check-label-app: warning
|
||||
require-ns-labels: warning
|
||||
```
|
||||
|
||||
policyPriorities:
|
||||
check-label-app: warning
|
||||
```bash
|
||||
kubectl create configmap policy-reporter-config --from-file=config.yaml -n policy-reporter
|
||||
```
|
||||
|
||||
## Example Outputs
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
apiVersion: v1
|
||||
data:
|
||||
config.yaml: |-
|
||||
loki:
|
||||
host: {{ .Values.loki.host }}
|
||||
|
||||
{{- with .Values.policyPriorities }}
|
||||
policy_priorities:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "policyreporter.fullname" . }}-config
|
||||
namespace: policy-reporter
|
|
@ -43,7 +43,11 @@ spec:
|
|||
- name: config-volume
|
||||
mountPath: /app/config.yaml
|
||||
subPath: config.yaml
|
||||
env:
|
||||
- name: LOKI_HOST
|
||||
value: {{ .Values.loki.host | quote }}
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: {{ include "policyreporter.fullname" . }}-config
|
||||
name: policy-reporter-config
|
||||
optional: true
|
|
@ -2,7 +2,7 @@ loki:
|
|||
host: http://loki.loki-stack.svc.cluster.local:3100
|
||||
image:
|
||||
repository: fjogeleit/policy-reporter
|
||||
pullPolicy: IfNotPresent
|
||||
pullPolicy: Always
|
||||
tag: 0.1.0
|
||||
imagePullSecrets: []
|
||||
service:
|
||||
|
@ -14,6 +14,4 @@ resources:
|
|||
cpu: 10m
|
||||
limits:
|
||||
memory: 100Mi
|
||||
cpu: 50m
|
||||
|
||||
policyPriorities: []
|
||||
cpu: 50m
|
|
@ -4,6 +4,7 @@ import (
|
|||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/fjogeleit/policy-reporter/pkg/config"
|
||||
"github.com/fjogeleit/policy-reporter/pkg/report"
|
||||
|
@ -80,6 +81,8 @@ func NewCLI() *cobra.Command {
|
|||
|
||||
func LoadConfig(cmd *cobra.Command) (*config.Config, error) {
|
||||
v := viper.New()
|
||||
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
|
||||
cfgFile := ""
|
||||
|
||||
configFlag := cmd.Flags().Lookup("config")
|
||||
|
|
Loading…
Reference in a new issue