diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index 010d749611edd3797a12660a34ee2010018af555..694bbf8c5c44e69f79f66ec6e7240f146760d5d7 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -103,6 +103,16 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{ printf "https://%s.%s" (include "app.ozgcloudBezeichner" .) (required "baseUrl must be set" .Values.baseUrl) }} {{- end -}} +{{- define "app.userManagerUrl" -}} +{{- if .Values.userManagerUrl -}} +{{ .Values.userManagerUrl }} +{{- else if (.Values.ingress).disabled -}} +{{ printf "https://%s.%s/user-manager" (include "app.ozgcloudBezeichner" .) (include "app.baseUrl" .) }} +{{- else -}} +{{ printf "https://%s" (include "app.baseDomain" .) }} +{{- end -}} +{{- end -}} + {{- define "app.replaceAllNonAlphanumeric" -}} {{- regexReplaceAll "[^a-zA-Z0-9]" . "" }} {{- end -}} diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 2bebcaeb28b0b22578d5b4b70bb9f74fc27e8e2b..041b2c942dc3c60fc5d54902ef2404a6acd1be2c 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -100,7 +100,7 @@ spec: - name: KEYCLOAK_URL value: {{ include "app.ssoServerUrl" . }} - name: OZGCLOUD_USER_MANAGER_URL - value: https://{{ include "app.baseDomain" . }} + value: {{ include "app.userManagerUrl" . }} {{- if ((.Values.ozgcloud).usersync).period }} - name: OZGCLOUD_USERSYNC_PERIOD value: {{ .Values.ozgcloud.usersync.period }} diff --git a/src/test/helm/deployment_url_value_test.yaml b/src/test/helm/deployment_url_value_test.yaml index 981fe2a4ef21f71a6f658730a5fa25f43c866a5a..e650dfe83eae3e25c64cfe7413d1f05959a22f1f 100644 --- a/src/test/helm/deployment_url_value_test.yaml +++ b/src/test/helm/deployment_url_value_test.yaml @@ -46,7 +46,7 @@ tests: name: OZGCLOUD_USER_MANAGER_URL value: https://helm-user-manager.test.company.local - - it: set baseDomain for ozgcloud_user_manager_url + - it: set baseDomain for ozgcloud_user_manager_url as default set: baseDomain: helm-usm.test.company.local asserts: @@ -54,4 +54,24 @@ tests: path: spec.template.spec.containers[0].env content: name: OZGCLOUD_USER_MANAGER_URL - value: https://helm-usm.test.company.local \ No newline at end of file + value: https://helm-usm.test.company.local + + - it: set ozgcloud_user_manager_url + set: + userManagerUrl: https://user-manager.test.company.local + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: OZGCLOUD_USER_MANAGER_URL + value: https://user-manager.test.company.local + + - it: should use new user-manager ingress url + set: + ingress.disabled: true + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: OZGCLOUD_USER_MANAGER_URL + value: https://helm.test.company.local/user-manager \ No newline at end of file