Skip to content
Snippets Groups Projects
Commit 3b134574 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5238 Correctly construct sso client

parent 37a25762
Branches
Tags
No related merge requests found
......@@ -60,13 +60,21 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- end -}}
{{- define "app.ssoClientName" -}}
{{- if (.Values.sso).client_name -}}
{{ printf "%s" (.Values.sso).client_name }}
{{- if (.Values.sso).keycloak_clients -}}
{{- if (first .Values.sso.keycloak_clients).client_name -}}
{{ printf "%s" (first .Values.sso.keycloak_clients).client_name }}
{{- else -}}
{{ printf "admin" }}
{{ include "app.defaultSsoClientName" . }}
{{- end -}}
{{- else -}}
{{ include "app.defaultSsoClientName" . }}
{{- end -}}
{{- end -}}
{{- define "app.defaultSsoClientName" -}}
{{ printf "admin" }}
{{- end -}}
{{- define "app.ssoServerUrl" -}}
{{- required "sso.serverUrl muss angegeben sein" (.Values.sso).serverUrl -}}
{{- end -}}
\ No newline at end of file
......@@ -75,7 +75,8 @@ tests:
- it: check different client name
set:
sso:
client_name: different-client
keycloak_clients:
- client_name: different-client
asserts:
- isKind:
of: Deployment
......@@ -84,3 +85,17 @@ tests:
content:
name: ozgcloud_oauth2_resource
value: different-client
- it: should have default client name
set:
sso:
keycloak_clients:
- client_name_typo: different-client
asserts:
- isKind:
of: Deployment
- contains:
path: spec.template.spec.containers[0].env
content:
name: ozgcloud_oauth2_resource
value: admin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment