1
0
Fork 0
mirror of https://github.com/kyverno/policy-reporter.git synced 2024-12-14 11:57:32 +00:00

Fix debouncer issue

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
This commit is contained in:
Frank Jogeleit 2022-03-16 23:06:39 +01:00
parent a58d53cbb7
commit b60f207dcf
8 changed files with 18 additions and 12 deletions

View file

@ -1,5 +1,9 @@
# Changelog
# 2.6.3
* Policy Reporter
* Fix Debouncer has wrong reference to OldPolicyReport when a result was cached.
# 2.6.2
* Policy Reporter
* Update Go to 1.17.8

View file

@ -1,8 +1,9 @@
GO ?= go
BUILD ?= build
REPO ?= ghcr.io/kyverno/policy-reporter
IMAGE_TAG ?= 2.3.1
IMAGE_TAG ?= 2.3.2
LD_FLAGS='-s -w -linkmode external -extldflags "-static"'
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x
all: build
@ -28,13 +29,13 @@ build: prepare
.PHONY: docker-build
docker-build:
@docker buildx build --progress plane --platform linux/arm64,linux/amd64,linux/s390x --tag $(REPO):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
@docker buildx build --progress plane --platform $(PLATFORMS) --tag $(REPO):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
.PHONY: docker-push
docker-push:
@docker buildx build --progress plane --platform linux/arm64,linux/amd64,linux/s390x --tag $(REPO):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --push
@docker buildx build --progress plane --platform linux/arm64,linux/amd64,linux/s390x --tag $(REPO):latest . --build-arg LD_FLAGS=$(LD_FLAGS) --push
@docker buildx build --progress plane --platform $(PLATFORMS) --tag $(REPO):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --push
@docker buildx build --progress plane --platform $(PLATFORMS) --tag $(REPO):latest . --build-arg LD_FLAGS=$(LD_FLAGS) --push
.PHONY: docker-push-dev
docker-push-dev:
@docker buildx build --progress plane --platform linux/arm64,linux/amd64,linux/s390x --tag $(REPO):dev . --build-arg LD_FLAGS=$(LD_FLAGS) --push
@docker buildx build --progress plane --platform $(PLATFORMS) --tag $(REPO):dev . --build-arg LD_FLAGS=$(LD_FLAGS) --push

View file

@ -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.6.2
appVersion: 2.3.1
version: 2.6.3
appVersion: 2.3.2
icon: https://github.com/kyverno/kyverno/raw/main/img/logo.png
home: https://kyverno.github.io/policy-reporter

View file

@ -2,7 +2,7 @@ image:
registry: ghcr.io
repository: kyverno/policy-reporter
pullPolicy: IfNotPresent
tag: 2.3.1
tag: 2.3.2
imagePullSecrets: []

View file

@ -145,7 +145,7 @@ spec:
fsGroup: 1234
containers:
- name: policy-reporter
image: "ghcr.io/kyverno/policy-reporter:2.3.1"
image: "ghcr.io/kyverno/policy-reporter:2.3.2"
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View file

@ -256,7 +256,7 @@ spec:
fsGroup: 1234
containers:
- name: policy-reporter
image: "ghcr.io/kyverno/policy-reporter:2.3.1"
image: "ghcr.io/kyverno/policy-reporter:2.3.2"
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View file

@ -84,7 +84,7 @@ spec:
automountServiceAccountToken: true
containers:
- name: policy-reporter
image: "ghcr.io/kyverno/policy-reporter:2.3.1"
image: "ghcr.io/kyverno/policy-reporter:2.3.2"
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false

View file

@ -21,7 +21,7 @@ type debouncer struct {
}
func (d *debouncer) Add(event report.LifecycleEvent) {
_, ok := d.events[event.NewPolicyReport.GetIdentifier()]
cached, ok := d.events[event.NewPolicyReport.GetIdentifier()]
if event.Type != report.Updated && ok {
d.mutx.Lock()
delete(d.events, event.NewPolicyReport.GetIdentifier())
@ -54,6 +54,7 @@ func (d *debouncer) Add(event report.LifecycleEvent) {
if ok {
d.mutx.Lock()
event.OldPolicyReport = cached.OldPolicyReport
d.events[event.NewPolicyReport.GetIdentifier()] = event
d.mutx.Unlock()