Skip to content
Snippets Groups Projects
Commit 52923c7d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5238 Simplified keycloak clients

parent 3b134574
Branches
Tags
No related merge requests found
......@@ -60,20 +60,12 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- end -}}
{{- define "app.ssoClientName" -}}
{{- if (.Values.sso).keycloak_clients -}}
{{- if (first .Values.sso.keycloak_clients).client_name -}}
{{ printf "%s" (first .Values.sso.keycloak_clients).client_name }}
{{- if (.Values.sso.keycloak_client).client_name -}}
{{ printf "%s" (.Values.sso.keycloak_client).client_name }}
{{- else -}}
{{ include "app.defaultSsoClientName" . }}
{{- end -}}
{{- else -}}
{{ include "app.defaultSsoClientName" . }}
{{- end -}}
{{- end -}}
{{- define "app.defaultSsoClientName" -}}
{{ printf "admin" }}
{{- end -}}
{{- end -}}
{{- define "app.ssoServerUrl" -}}
{{- required "sso.serverUrl muss angegeben sein" (.Values.sso).serverUrl -}}
......
{{- if not (.Values.sso).disableOzgOperator -}}
{{ range $client := (.Values.sso).keycloak_clients }}
{{ $client := (.Values.sso).keycloak_client }}
---
apiVersion: operator.ozgcloud.de/v1
kind: OzgCloudKeycloakClient
......@@ -9,7 +9,7 @@ metadata:
spec:
keep_after_delete: {{ $.Values.sso.keep_after_delete | default false }}
client_name: {{ $client.client_name }}
client_base_url: https://{{ include "app.baseDomain" $ }}
client_base_url: https://{{ include "app.baseDomain" $ }}
client_web_origins:
- https://{{ include "app.baseDomain" $ }}
......@@ -32,5 +32,4 @@ spec:
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
{{ end }}
{{- end -}}
\ No newline at end of file
......@@ -75,8 +75,8 @@ tests:
- it: check different client name
set:
sso:
keycloak_clients:
- client_name: different-client
keycloak_client:
client_name: different-client
asserts:
- isKind:
of: Deployment
......@@ -85,17 +85,3 @@ 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
......@@ -37,8 +37,8 @@ tests:
- it: should contain header data
set:
sso:
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
asserts:
- isAPIVersion:
of: operator.ozgcloud.de/v1
......@@ -47,8 +47,8 @@ tests:
- it: should have metadata
set:
sso:
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
asserts:
- equal:
path: metadata.name
......@@ -59,8 +59,8 @@ tests:
- it: should set keep after delete default to false
set:
sso:
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
asserts:
- equal:
path: spec.keep_after_delete
......@@ -69,8 +69,8 @@ tests:
set:
sso:
keep_after_delete: true
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
asserts:
- equal:
path: spec.keep_after_delete
......@@ -78,8 +78,8 @@ tests:
- it: has client name value
set:
sso:
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
asserts:
- equal:
path: spec.client_name
......@@ -87,8 +87,8 @@ tests:
- it: should set client base url
set:
sso:
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
asserts:
- equal:
path: spec.client_base_url
......@@ -96,8 +96,8 @@ tests:
- it: should set client redirect uris
set:
sso:
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
asserts:
- equal:
path: spec.client_web_origins
......@@ -106,8 +106,8 @@ tests:
- it: should set client web origins
set:
sso:
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
asserts:
- equal:
path: spec.client_redirect_uris
......@@ -117,11 +117,11 @@ tests:
- it: should use additional client web origins
set:
sso:
keycloak_clients:
- client_name: admin
additional_client_web_origins:
- https://some.origin.de
- https://some.other.origin.de
keycloak_client:
client_name: admin
additional_client_web_origins:
- https://some.origin.de
- https://some.other.origin.de
asserts:
- equal:
path: spec.client_web_origins
......@@ -132,10 +132,10 @@ tests:
- it: should use additional redirect uris for client web origins
set:
sso:
keycloak_clients:
- client_name: admin
additional_redirect_uris:
- https://additional.url.de
keycloak_client:
client_name: admin
additional_redirect_uris:
- https://additional.url.de
asserts:
- equal:
path: spec.client_redirect_uris
......@@ -146,8 +146,8 @@ tests:
- it: should not create client cr if ozg operator is disabled
set:
sso:
keycloak_clients:
- client_name: admin
keycloak_client:
client_name: admin
disableOzgOperator: true
asserts:
- hasDocuments:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment