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

release 1.12.2

Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
This commit is contained in:
Frank Jogeleit 2021-10-18 15:21:22 +02:00
parent d844db66fb
commit fc3358ef7a
5 changed files with 47 additions and 36 deletions

View file

@ -1,7 +1,7 @@
# Changelog
# 1.12.1
* Remove CRD registration limitation
# 1.12.2
* Fix CRD registration for PolicyReport and ClusterPolicyReport
# 1.12.0
* Add Yandex as new Target for Policy Reporter

View file

@ -1,7 +1,7 @@
GO ?= go
BUILD ?= build
REPO ?= ghcr.io/kyverno/policy-reporter
IMAGE_TAG ?= 1.10.0
REPO ?= fjogeleit/policy-reporter
IMAGE_TAG ?= 1.10.1
LD_FLAGS="-s -w"
all: build
@ -37,4 +37,4 @@ docker-push:
.PHONY: docker-push-dev
docker-push-dev:
@docker buildx build --progress plane --platform linux/arm64,linux/amd64 --tag $(REPO):dev . --build-arg LD_FLAGS=$(LD_FLAGS) --push
@docker buildx build --progress plane --platform linux/amd64 --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: 1.12.1
appVersion: 1.10.0
version: 1.12.2
appVersion: 1.10.1
dependencies:
- name: monitoring

View file

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

View file

@ -4,7 +4,6 @@ import (
"context"
"log"
"sync"
"time"
"github.com/kyverno/policy-reporter/pkg/report"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -64,15 +63,31 @@ func (k *k8sPolicyReportAdapter) GetFoundResources() map[string]string {
func (k *k8sPolicyReportAdapter) WatchPolicyReports(ctx context.Context) (chan WatchEvent, error) {
events := make(chan WatchEvent)
resources := []schema.GroupVersionResource{
policyReportAlphaV1,
pr := []schema.GroupVersionResource{
policyReportAlphaV2,
clusterPolicyReportAlphaV1,
clusterPolicyReportAlphaV2,
policyReportAlphaV1,
}
for _, resource := range resources {
go func(r schema.GroupVersionResource) {
cpor := []schema.GroupVersionResource{
clusterPolicyReportAlphaV2,
clusterPolicyReportAlphaV1,
}
for _, versions := range [][]schema.GroupVersionResource{pr, cpor} {
go func(vs []schema.GroupVersionResource) {
for {
for _, resource := range vs {
k.WatchCRD(ctx, resource, events)
}
}
}(versions)
}
return events, nil
}
func (k *k8sPolicyReportAdapter) WatchCRD(ctx context.Context, r schema.GroupVersionResource, events chan WatchEvent) {
for {
w, err := k.client.Resource(r).Watch(ctx, metav1.ListOptions{})
if err != nil {
@ -80,7 +95,7 @@ func (k *k8sPolicyReportAdapter) WatchPolicyReports(ctx context.Context) (chan W
delete(k.found, r.String())
k.mx.Unlock()
time.Sleep(time.Second * 10)
return
}
log.Printf("[INFO] Resource registered: %s\n", r.String())
@ -96,10 +111,6 @@ func (k *k8sPolicyReportAdapter) WatchPolicyReports(ctx context.Context) (chan W
}
}
}
}(resource)
}
return events, nil
}
// NewPolicyReportAdapter new Adapter for Policy Report Kubernetes API