Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kyverno/policy-reporter
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: policy-reporter-2.22.1
Choose a base ref
...
head repository: kyverno/policy-reporter
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: policy-reporter-2.22.2
Choose a head ref
  • 2 commits
  • 12 files changed
  • 1 contributor

Commits on Feb 21, 2024

  1. Fix Resource information in Violation E-Mail Reports (#411)

    Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
    fjogeleit authored Feb 21, 2024
    Copy the full SHA
    c295800 View commit details
  2. Prepare Chart Release v2.22.2 (#412)

    Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
    fjogeleit authored Feb 21, 2024
    Copy the full SHA
    dc31a00 View commit details
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

# 2.22.2
* Helm Chart
* Policy Reporter v2.18.1
* Fix Resource Mapping in Violation Report E-Mails

# 2.22.1
* Helm Chart
* Fix indentation in SummaryReport CronJob
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GO ?= go
BUILD ?= build
REPO ?= ghcr.io/kyverno/policy-reporter
IMAGE_TAG ?= 2.18.0
IMAGE_TAG ?= 2.18.1
LD_FLAGS=-s -w -linkmode external -extldflags "-static"
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x

4 changes: 2 additions & 2 deletions charts/policy-reporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@ description: |
It creates Prometheus Metrics and can send rule validation events to different targets like Loki, Elasticsearch, Slack or Discord
type: application
version: 2.22.1
appVersion: 2.18.0
version: 2.22.2
appVersion: 2.18.1

icon: https://github.com/kyverno/kyverno/raw/main/img/logo.png
home: https://kyverno.github.io/policy-reporter
2 changes: 1 addition & 1 deletion charts/policy-reporter/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Policy Reporter

![Version: v2.22.0](https://img.shields.io/badge/Version-v2.22.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.18.0](https://img.shields.io/badge/AppVersion-v2.18.0-informational?style=flat-square)
![Version: v2.22.2](https://img.shields.io/badge/Version-v2.22.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.18.1](https://img.shields.io/badge/AppVersion-v2.18.1-informational?style=flat-square)

## Motivation

2 changes: 1 addition & 1 deletion charts/policy-reporter/values.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ image:
registry: ghcr.io
repository: kyverno/policy-reporter
pullPolicy: IfNotPresent
tag: 2.18.0
tag: 2.18.1

imagePullSecrets: []

2 changes: 1 addition & 1 deletion manifest/policy-reporter-kyverno-ui-ha/install.yaml
Original file line number Diff line number Diff line change
@@ -480,7 +480,7 @@ spec:
fsGroup: 1234
containers:
- name: policy-reporter
image: "ghcr.io/kyverno/policy-reporter:2.18.0"
image: "ghcr.io/kyverno/policy-reporter:2.18.1"
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
2 changes: 1 addition & 1 deletion manifest/policy-reporter-kyverno-ui/install.yaml
Original file line number Diff line number Diff line change
@@ -367,7 +367,7 @@ spec:
fsGroup: 1234
containers:
- name: policy-reporter
image: "ghcr.io/kyverno/policy-reporter:2.18.0"
image: "ghcr.io/kyverno/policy-reporter:2.18.1"
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
2 changes: 1 addition & 1 deletion manifest/policy-reporter-ui/install.yaml
Original file line number Diff line number Diff line change
@@ -223,7 +223,7 @@ spec:
fsGroup: 1234
containers:
- name: policy-reporter
image: "ghcr.io/kyverno/policy-reporter:2.18.0"
image: "ghcr.io/kyverno/policy-reporter:2.18.1"
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
2 changes: 1 addition & 1 deletion manifest/policy-reporter/install.yaml
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ spec:
automountServiceAccountToken: true
containers:
- name: policy-reporter
image: "ghcr.io/kyverno/policy-reporter:2.18.0"
image: "ghcr.io/kyverno/policy-reporter:2.18.1"
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
2 changes: 1 addition & 1 deletion manifest/violations-email-report/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ spec:
restartPolicy: Never
containers:
- name: policy-reporter
image: "ghcr.io/kyverno/policy-reporter:2.18.0"
image: "ghcr.io/kyverno/policy-reporter:2.18.1"
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
4 changes: 2 additions & 2 deletions pkg/email/violations/generator.go
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ func (o *Generator) GenerateData(ctx context.Context) ([]Source, error) {
continue
}

s.AddClusterResults(mapResult(result))
s.AddClusterResults(mapResult(&report, result))
}
}(rep)
}
@@ -117,7 +117,7 @@ func (o *Generator) GenerateData(ctx context.Context) ([]Source, error) {
if result.Result == v1alpha2.StatusPass || result.Result == v1alpha2.StatusSkip {
continue
}
s.AddNamespacedResults(report.Namespace, mapResult(result))
s.AddNamespacedResults(report.Namespace, mapResult(&report, result))
}
}(rep)
}
12 changes: 10 additions & 2 deletions pkg/email/violations/model.go
Original file line number Diff line number Diff line change
@@ -14,19 +14,27 @@ type Result struct {
Status string
}

func mapResult(res v1alpha2.PolicyReportResult) []Result {
func mapResult(polr v1alpha2.ReportInterface, res v1alpha2.PolicyReportResult) []Result {
count := len(res.Resources)
rule := res.Rule
if rule == "" {
rule = res.Message
}

if count == 0 {
if count == 0 && polr.GetScope() == nil {
return []Result{{
Policy: res.Policy,
Rule: rule,
Status: string(res.Result),
}}
} else if count == 0 && polr.GetScope() != nil {
return []Result{{
Policy: res.Policy,
Rule: rule,
Name: polr.GetScope().Name,
Kind: polr.GetScope().Kind,
Status: string(res.Result),
}}
}

list := make([]Result, 0, count)