From d15f1b7d447536d1df658647ecc94a38fada142f Mon Sep 17 00:00:00 2001
From: Frank Jogeleit <frank.jogeleit@lovoo.com>
Date: Thu, 4 Apr 2024 22:50:11 +0200
Subject: [PATCH] Update UI version

Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
---
 charts/policy-reporter/Chart.yaml      | 2 +-
 charts/policy-reporter/README.md       | 9 +++++----
 charts/policy-reporter/configs/ui.tmpl | 1 +
 charts/policy-reporter/values.yaml     | 8 +++++---
 pkg/api/healthz_test.go                | 3 ++-
 pkg/api/metrics_test.go                | 3 ++-
 pkg/api/server_test.go                 | 3 ++-
 pkg/api/utils_test.go                  | 2 +-
 pkg/api/v2/api_test.go                 | 6 +++---
 pkg/kubernetes/secrets/client.go       | 1 -
 10 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/charts/policy-reporter/Chart.yaml b/charts/policy-reporter/Chart.yaml
index f7d96107..e265f63f 100644
--- a/charts/policy-reporter/Chart.yaml
+++ b/charts/policy-reporter/Chart.yaml
@@ -5,7 +5,7 @@ description: |
   It creates Prometheus Metrics and can send rule validation events to different targets like Loki, Elasticsearch, Slack or Discord
 
 type: application
-version: 3.0.0-alpha.23
+version: 3.0.0-alpha.24
 appVersion: 3.0.0-alpha
 
 icon: https://github.com/kyverno/kyverno/raw/main/img/logo.png
diff --git a/charts/policy-reporter/README.md b/charts/policy-reporter/README.md
index 3c801984..482e3546 100644
--- a/charts/policy-reporter/README.md
+++ b/charts/policy-reporter/README.md
@@ -3,7 +3,7 @@
 Policy Reporter watches for PolicyReport Resources.
 It creates Prometheus Metrics and can send rule validation events to different targets like Loki, Elasticsearch, Slack or Discord
 
-![Version: 3.0.0-alpha.23](https://img.shields.io/badge/Version-3.0.0--alpha.23-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.0-alpha](https://img.shields.io/badge/AppVersion-3.0.0--alpha-informational?style=flat-square)
+![Version: 3.0.0-alpha.24](https://img.shields.io/badge/Version-3.0.0--alpha.24-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.0-alpha](https://img.shields.io/badge/AppVersion-3.0.0--alpha-informational?style=flat-square)
 
 ## Documentation
 
@@ -56,7 +56,7 @@ Check the [Documentation](https://kyverno.github.io/policy-reporter/guide/02-get
 | image.registry | string | `"ghcr.io"` |  |
 | image.repository | string | `"kyverno/policy-reporter"` |  |
 | image.pullPolicy | string | `"IfNotPresent"` |  |
-| image.tag | string | `"446cc09"` |  |
+| image.tag | string | `"77b076f"` |  |
 | imagePullSecrets | list | `[]` |  |
 | priorityClassName | string | `""` |  |
 | replicaCount | int | `1` |  |
@@ -332,13 +332,14 @@ Check the [Documentation](https://kyverno.github.io/policy-reporter/guide/02-get
 | ui.image.registry | string | `"ghcr.io"` | Image registry |
 | ui.image.repository | string | `"kyverno/policy-reporter-ui"` | Image repository |
 | ui.image.pullPolicy | string | `"IfNotPresent"` | Image PullPolicy |
-| ui.image.tag | string | `"2.0.0-alpha.32"` | Image tag Defaults to `Chart.AppVersion` if omitted |
+| ui.image.tag | string | `"2.0.0-alpha.34"` | Image tag Defaults to `Chart.AppVersion` if omitted |
 | ui.replicaCount | int | `1` | Deployment replica count |
 | ui.tempDir | string | `"/tmp"` | Temporary Directory to persist session data for authentication |
 | ui.logging.encoding | string | `"console"` | log encoding possible encodings are console and json |
 | ui.logging.logLevel | int | `0` | log level default info |
 | ui.server.port | int | `8080` | Application port |
 | ui.server.logging | bool | `false` | Enables Access logging |
+| ui.server.overwriteHost | bool | `true` | Overwrites Request Host with Proxy Host and adds `X-Forwarded-Host` and `X-Origin-Host` headers |
 | ui.openIDConnect.enabled | bool | `false` | Enable openID Connect authentication |
 | ui.openIDConnect.discoveryUrl | string | `""` | OpenID Connect Discovery URL |
 | ui.openIDConnect.callbackUrl | string | `""` | OpenID Connect Callback URL |
@@ -396,7 +397,7 @@ Check the [Documentation](https://kyverno.github.io/policy-reporter/guide/02-get
 | plugin.kyverno.image.registry | string | `"ghcr.io"` | Image registry |
 | plugin.kyverno.image.repository | string | `"kyverno/policy-reporter/kyverno-plugin"` | Image repository |
 | plugin.kyverno.image.pullPolicy | string | `"IfNotPresent"` | Image PullPolicy |
-| plugin.kyverno.image.tag | string | `"0.0.7"` | Image tag Defaults to `Chart.AppVersion` if omitted |
+| plugin.kyverno.image.tag | string | `"0.0.8"` | Image tag Defaults to `Chart.AppVersion` if omitted |
 | plugin.kyverno.replicaCount | int | `1` | Deployment replica count |
 | plugin.kyverno.logging.encoding | string | `"console"` | log encoding possible encodings are console and json |
 | plugin.kyverno.logging.logLevel | int | `0` | log level default info |
diff --git a/charts/policy-reporter/configs/ui.tmpl b/charts/policy-reporter/configs/ui.tmpl
index a635888e..c31de981 100644
--- a/charts/policy-reporter/configs/ui.tmpl
+++ b/charts/policy-reporter/configs/ui.tmpl
@@ -3,6 +3,7 @@ namespace: {{ .Release.Namespace }}
 tempDir: {{ .Values.ui.tempDir }}
 
 logging:
+  enabled: {{ .Values.ui.logging.enabled }}
   encoding: {{ .Values.ui.logging.encoding }}
   logLevel: {{ .Values.ui.logging.logLevel }}
 
diff --git a/charts/policy-reporter/values.yaml b/charts/policy-reporter/values.yaml
index 3d72b2de..09707307 100644
--- a/charts/policy-reporter/values.yaml
+++ b/charts/policy-reporter/values.yaml
@@ -11,7 +11,7 @@ image:
   registry: ghcr.io
   repository: kyverno/policy-reporter
   pullPolicy: IfNotPresent
-  tag: 446cc09
+  tag: 77b076f
 
 imagePullSecrets: []
 
@@ -720,7 +720,7 @@ ui:
     pullPolicy: IfNotPresent
       # -- (string) Image tag
       # Defaults to `Chart.AppVersion` if omitted
-    tag: "2.0.0-alpha.32"
+    tag: "2.0.0-alpha.34"
 
   # -- Deployment replica count
   replicaCount: 1
@@ -741,6 +741,8 @@ ui:
     port: 8080
     # -- Enables Access logging
     logging: false
+    # -- Overwrites Request Host with Proxy Host and adds `X-Forwarded-Host` and `X-Origin-Host` headers
+    overwriteHost: true
 
   openIDConnect:
     # -- Enable openID Connect authentication
@@ -974,7 +976,7 @@ plugin:
       pullPolicy: IfNotPresent
         # -- (string) Image tag
         # Defaults to `Chart.AppVersion` if omitted
-      tag: "0.0.7"
+      tag: "0.0.8"
 
     # -- Deployment replica count
     replicaCount: 1
diff --git a/pkg/api/healthz_test.go b/pkg/api/healthz_test.go
index 675cd098..042394f0 100644
--- a/pkg/api/healthz_test.go
+++ b/pkg/api/healthz_test.go
@@ -7,8 +7,9 @@ import (
 	"testing"
 
 	"github.com/gin-gonic/gin"
-	"github.com/kyverno/policy-reporter/pkg/api"
 	"github.com/stretchr/testify/assert"
+
+	"github.com/kyverno/policy-reporter/pkg/api"
 )
 
 func TestHealthCheckSuccess(t *testing.T) {
diff --git a/pkg/api/metrics_test.go b/pkg/api/metrics_test.go
index e2cc8f6e..fffc8186 100644
--- a/pkg/api/metrics_test.go
+++ b/pkg/api/metrics_test.go
@@ -6,8 +6,9 @@ import (
 	"testing"
 
 	"github.com/gin-gonic/gin"
-	"github.com/kyverno/policy-reporter/pkg/api"
 	"github.com/stretchr/testify/assert"
+
+	"github.com/kyverno/policy-reporter/pkg/api"
 )
 
 func TestMetrics(t *testing.T) {
diff --git a/pkg/api/server_test.go b/pkg/api/server_test.go
index 1fbd0720..4d8299d3 100644
--- a/pkg/api/server_test.go
+++ b/pkg/api/server_test.go
@@ -6,9 +6,10 @@ import (
 	"testing"
 
 	"github.com/gin-gonic/gin"
-	"github.com/kyverno/policy-reporter/pkg/api"
 	"github.com/stretchr/testify/assert"
 	"go.uber.org/zap"
+
+	"github.com/kyverno/policy-reporter/pkg/api"
 )
 
 var check = func() error {
diff --git a/pkg/api/utils_test.go b/pkg/api/utils_test.go
index a7a21b1f..f62e8af4 100644
--- a/pkg/api/utils_test.go
+++ b/pkg/api/utils_test.go
@@ -8,9 +8,9 @@ import (
 	"testing"
 
 	"github.com/gin-gonic/gin"
-	"github.com/kyverno/policy-reporter/pkg/api"
 	"github.com/stretchr/testify/assert"
 
+	"github.com/kyverno/policy-reporter/pkg/api"
 	db "github.com/kyverno/policy-reporter/pkg/database"
 )
 
diff --git a/pkg/api/v2/api_test.go b/pkg/api/v2/api_test.go
index 345b6caf..359daa9f 100644
--- a/pkg/api/v2/api_test.go
+++ b/pkg/api/v2/api_test.go
@@ -9,20 +9,20 @@ import (
 	"testing"
 	"time"
 
+	"github.com/gin-gonic/gin"
+	"github.com/patrickmn/go-cache"
+	"github.com/stretchr/testify/assert"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/kubernetes/fake"
 	v1 "k8s.io/client-go/kubernetes/typed/core/v1"
 
-	"github.com/gin-gonic/gin"
 	"github.com/kyverno/policy-reporter/pkg/api"
 	v2 "github.com/kyverno/policy-reporter/pkg/api/v2"
 	"github.com/kyverno/policy-reporter/pkg/config"
 	"github.com/kyverno/policy-reporter/pkg/database"
 	"github.com/kyverno/policy-reporter/pkg/fixtures"
 	"github.com/kyverno/policy-reporter/pkg/kubernetes/namespaces"
-	"github.com/patrickmn/go-cache"
-	"github.com/stretchr/testify/assert"
 )
 
 const (
diff --git a/pkg/kubernetes/secrets/client.go b/pkg/kubernetes/secrets/client.go
index 733ec2ac..b9db5b02 100644
--- a/pkg/kubernetes/secrets/client.go
+++ b/pkg/kubernetes/secrets/client.go
@@ -2,7 +2,6 @@ package secrets
 
 import (
 	"context"
-
 	"strconv"
 
 	corev1 "k8s.io/api/core/v1"