Skip to content

Commit

Permalink
Merge pull request #4 from fjogeleit/development
Browse files Browse the repository at this point in the history
Configuration Improvements
  • Loading branch information
fjogeleit authored Feb 20, 2021
2 parents 7e70ec6 + 79df9c5 commit b3257a0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 25 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions charts/policy-reporter/templates/configmap.yaml

This file was deleted.

6 changes: 5 additions & 1 deletion charts/policy-reporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 3 additions & 5 deletions charts/policy-reporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ loki:
host: http://loki.loki-stack.svc.cluster.local:3100
image:
repository: fjogeleit/policy-reporter
pullPolicy: IfNotPresent
tag: 0.1.0
pullPolicy: Always
tag: 0.2.0
imagePullSecrets: []
service:
type: ClusterIP
Expand All @@ -14,6 +14,4 @@ resources:
cpu: 10m
limits:
memory: 100Mi
cpu: 50m

policyPriorities: []
cpu: 50m
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"log"
"net/http"
"strings"

"github.com/fjogeleit/policy-reporter/pkg/config"
"github.com/fjogeleit/policy-reporter/pkg/report"
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit b3257a0

Please sign in to comment.