From 8f5239b5484e3b815add58f54a28139a9f0c5b08 Mon Sep 17 00:00:00 2001 From: Etienne Divet Date: Tue, 24 Dec 2024 17:16:44 +0100 Subject: [PATCH] avoid adding empty username/password when not set --- charts/policy-reporter/templates/cluster-secret.yaml | 8 ++++++-- .../templates/{ui => }/extra-manifests.yaml | 0 2 files changed, 6 insertions(+), 2 deletions(-) rename charts/policy-reporter/templates/{ui => }/extra-manifests.yaml (100%) diff --git a/charts/policy-reporter/templates/cluster-secret.yaml b/charts/policy-reporter/templates/cluster-secret.yaml index 50d54e280..237a3a413 100644 --- a/charts/policy-reporter/templates/cluster-secret.yaml +++ b/charts/policy-reporter/templates/cluster-secret.yaml @@ -15,8 +15,12 @@ data: {{- $username := .Values.basicAuth.username }} {{- $password := .Values.basicAuth.password }} host: {{ printf "http://%s:%d" (include "policyreporter.fullname" .) (.Values.service.port | int) | b64enc }} - username: {{ $username | b64enc }} - password: {{ $password | b64enc }} + {{- if .Values.basicAuth.username }} + username: {{ .Values.basicAuth.username | b64enc }} + {{- end }} + {{- if .Values.basicAuth.password }} + password: {{ .Values.basicAuth.password | b64enc }} + {{- end }} {{- if .Values.plugin.kyverno.enabled }} {{- $host := printf "http://%s:%d" (include "kyverno-plugin.fullname" .) (.Values.plugin.kyverno.service.port | int) }} plugin.kyverno: {{ (printf "{\"host\":\"%s\", \"name\":\"kyverno\", \"username\":\"%s\", \"password\":\"%s\"}" $host $username $password) | b64enc }} diff --git a/charts/policy-reporter/templates/ui/extra-manifests.yaml b/charts/policy-reporter/templates/extra-manifests.yaml similarity index 100% rename from charts/policy-reporter/templates/ui/extra-manifests.yaml rename to charts/policy-reporter/templates/extra-manifests.yaml