Create new dex config value extraStaticClients

Create a new dex config value called extraStaticClients. This new value
if present will be added to staticClients. This will allow a user to add
new static clients without overriding the current staticClients config
which is a array.  Helm does not currently merge arrays.

Story: 2008616
Task: 41804
Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
Change-Id: Iefe49331a5170f78e3f2996cd8312cd1bfb0536f
This commit is contained in:
Kristine Bujold 2021-02-08 12:50:48 -06:00
parent 70147e64e9
commit cb7820b32e
2 changed files with 96 additions and 0 deletions

View File

@ -29,6 +29,7 @@ Patch02: 0002-add-image-pull-secrets.patch
Patch03: 0003-Add-affinity-support.patch
Patch04: 0004-Automatically-roll-deployments.patch
Patch05: 0005-Update-Dex-chart-for-Helm-v3.patch
Patch06: 0006-Create-new-config-value-extraStaticClients.patch
BuildArch: noarch
@ -45,6 +46,7 @@ StarlingX OIDC auth Helm charts
%patch03 -p1
%patch04 -p1
%patch05 -p1
%patch06 -p1
%build
# This chart does not require chartmuseum server since

View File

@ -0,0 +1,94 @@
From 032c7e194811f37824a796d4c6293563bc8d9424 Mon Sep 17 00:00:00 2001
From: Kristine Bujold <kristine.bujold@windriver.com>
Date: Tue, 9 Feb 2021 08:37:42 -0600
Subject: [PATCH] Create new config value extraStaticClients
Create a new config value called extraStaticClients. This new value if
present will be added to staticClients. This will allow a user to add
new static clients without overriding the current staticClients config
which is a array. Helm does not currently merge arrays.
Jira: CGTS-20205
Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
---
stable/dex/templates/secret.yaml | 46 ++++++++++++++++++++++++++++++--
stable/dex/values.yaml | 9 +++++++
2 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/stable/dex/templates/secret.yaml b/stable/dex/templates/secret.yaml
index c5f03ff..a32b145 100644
--- a/stable/dex/templates/secret.yaml
+++ b/stable/dex/templates/secret.yaml
@@ -7,5 +7,47 @@ metadata:
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
name: {{ template "dex.fullname" . }}
-data:
- config.yaml: {{ toYaml .Values.config | b64enc }}
+stringData:
+ config.yaml: |-
+ {{- with .Values.config }}
+ issuer: {{ .issuer }}
+ storage:
+{{ toYaml .storage | indent 6 }}
+ logger:
+{{ toYaml .logger | indent 6 }}
+ web:
+{{ toYaml .web | indent 6 }}
+ {{- if $.Values.grpc }}
+ grpc:
+{{ toYaml .grpc | indent 6 }}
+ {{- end }}
+ {{- if .connectors }}
+ connectors:
+{{ toYaml .connectors | indent 4 }}
+ {{- end }}
+ oauth2:
+ {{ toYaml .oauth2 | indent 2 }}
+ staticClients:
+{{ toYaml .staticClients | trimSuffix "\n" | indent 4 }}
+ {{- if .extraStaticClients }}
+{{- range $key, $val := .extraStaticClients }}
+ - id: {{ $key }}
+ name: {{ $val.name }}
+ secret: {{ $val.secret }}
+ redirectURIs:
+ {{- range $uris := $val.redirectURIs }}
+ - {{ $uris }}
+ {{- end }}
+{{- end -}}
+ {{- end }}
+
+ enablePasswordDB: {{ .enablePasswordDB }}
+ {{- if .staticPasswords }}
+ staticPasswords:
+{{ toYaml .staticPasswords | indent 4 }}
+ {{- end }}
+ {{- if .expiry }}
+ expiry:
+{{ toYaml .expiry | indent 6 }}
+ {{- end }}
+ {{- end }}
diff --git a/stable/dex/values.yaml b/stable/dex/values.yaml
index 6753e8c..347cc06 100644
--- a/stable/dex/values.yaml
+++ b/stable/dex/values.yaml
@@ -127,6 +127,15 @@ config:
# name: 'Example App'
# secret: ZXhhbXBsZS1hcHAtc2VjcmV0
#
+
+# extraStaticClients:
+# example-app:
+# redirectURIs:
+# - 'http://192.168.42.219:31850/oauth2/callback'
+# name: 'Example App'
+# secret: ZXhhbXBsZS1hcHAtc2VjcmV0
+#
+
enablePasswordDB: true
# staticPasswords:
# - email: "admin@example.com"
--
2.22.0