From bf185a6f7e0410f99167649589f38db37e71b106 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Mon, 1 Jul 2024 17:04:54 +0200 Subject: [PATCH] ozg-5634 use new ingress url --- src/main/helm/templates/_helpers.tpl | 10 ++++++++ src/main/helm/templates/deployment.yaml | 2 +- src/test/helm/deployment_url_value_test.yaml | 24 ++++++++++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index 010d7496..694bbf8c 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 2bebcaeb..041b2c94 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 981fe2a4..e650dfe8 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 -- GitLab