1
0
Fork 0
mirror of https://github.com/kyverno/policy-reporter.git synced 2024-12-15 17:50:58 +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 # Changelog
# 1.12.1 # 1.12.2
* Remove CRD registration limitation * Fix CRD registration for PolicyReport and ClusterPolicyReport
# 1.12.0 # 1.12.0
* Add Yandex as new Target for Policy Reporter * Add Yandex as new Target for Policy Reporter

View file

@ -1,7 +1,7 @@
GO ?= go GO ?= go
BUILD ?= build BUILD ?= build
REPO ?= ghcr.io/kyverno/policy-reporter REPO ?= fjogeleit/policy-reporter
IMAGE_TAG ?= 1.10.0 IMAGE_TAG ?= 1.10.1
LD_FLAGS="-s -w" LD_FLAGS="-s -w"
all: build all: build
@ -37,4 +37,4 @@ docker-push:
.PHONY: docker-push-dev .PHONY: docker-push-dev
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 It creates Prometheus Metrics and can send rule validation events to different targets like Loki, Elasticsearch, Slack or Discord
type: application type: application
version: 1.12.1 version: 1.12.2
appVersion: 1.10.0 appVersion: 1.10.1
dependencies: dependencies:
- name: monitoring - name: monitoring

View file

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

View file

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