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

OZG-5238 Simplified keycloak clients

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