From f1a3941c27fac2092bf1e02a1875143ce1a9a712 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Tue, 27 Feb 2024 16:54:51 +0100 Subject: [PATCH] set baseDomain --- src/main/helm/templates/_helpers.tpl | 4 ++++ src/test/helm/deployment-url-value-test.yaml | 13 ++++++++++++- src/test/helm/ingress-nginx-tests.yaml | 18 +++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index af6ba3ea..49b22dd9 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -99,8 +99,12 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- end -}} {{- define "app.baseDomain" -}} +{{- if (.Values.baseDomain) -}} +{{ .Values.baseDomain }} +{{- else -}} {{ printf "%s-%s.%s" (include "app.ozgcloudBezeichner" .) (include "app.name" .) (include "app.baseUrl" .) }} {{- end -}} +{{- end -}} {{- define "app.alfaAddress" -}} {{ printf "https://%s.%s" (include "app.ozgcloudBezeichner" .) (required "baseUrl must be set" .Values.baseUrl) }} diff --git a/src/test/helm/deployment-url-value-test.yaml b/src/test/helm/deployment-url-value-test.yaml index f5b2b82f..49a89498 100644 --- a/src/test/helm/deployment-url-value-test.yaml +++ b/src/test/helm/deployment-url-value-test.yaml @@ -44,4 +44,15 @@ tests: path: spec.template.spec.containers[0].env content: name: OZGCLOUD_USER_MANAGER_URL - value: https://helm-user-manager.test.company.local \ No newline at end of file + value: https://helm-user-manager.test.company.local + + - it: set baseDomain for ozgcloud_user_manager_url + template: deployment.yaml + set: + baseDomain: helm-usm.test.company.local + asserts: + - contains: + 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 diff --git a/src/test/helm/ingress-nginx-tests.yaml b/src/test/helm/ingress-nginx-tests.yaml index f64e9b17..970ad9af 100644 --- a/src/test/helm/ingress-nginx-tests.yaml +++ b/src/test/helm/ingress-nginx-tests.yaml @@ -92,4 +92,20 @@ tests: asserts: - equal: path: spec.tls[0].hosts[0] - value: helm-user-manager.test.sh.ozg-cloud.de \ No newline at end of file + value: helm-user-manager.test.sh.ozg-cloud.de + + - it: should set ingress host + set: + baseDomain: helm-usm.test.company.local + asserts: + - equal: + path: spec.rules[0].host + value: helm-usm.test.company.local + + - it: should set ingress tls host + set: + baseDomain: helm-usm.test.company.local + asserts: + - equal: + path: spec.tls[0].hosts[0] + value: helm-usm.test.company.local \ No newline at end of file -- GitLab