From f26dad360ed9497e8ffa645d6763a4b6d999b987 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Fri, 22 Sep 2023 11:14:09 +0200
Subject: [PATCH] add ingress adapter bezeichner

---
 src/main/helm/templates/_helpers.tpl |  4 +++-
 src/test/helm/ingress_test.yaml      | 11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl
index a4be54ca4..142c08058 100644
--- a/src/main/helm/templates/_helpers.tpl
+++ b/src/main/helm/templates/_helpers.tpl
@@ -71,7 +71,9 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
 {{- end -}}
 
 {{- define "app.ingress.host" }}
-{{- if eq (.Values.image).name "formsolutions-adapter" }}
+{{- if (.Values.ingress).adapterBezeichner }}
+{{- printf "%s-%s.%s" (include "app.kopBezeichner" .) .Values.ingress.adapterBezeichner .Values.baseUrl }}
+{{- else if eq (.Values.image).name "formsolutions-adapter" }}
 {{- printf "%s-fs.%s" (include "app.kopBezeichner" .) .Values.baseUrl }}
 {{- else if eq (.Values.image).name "formcycle-adapter" }}
 {{- printf "%s-formcycle.%s" (include "app.kopBezeichner" .) .Values.baseUrl }}
diff --git a/src/test/helm/ingress_test.yaml b/src/test/helm/ingress_test.yaml
index 8cb3a6872..7561bb305 100644
--- a/src/test/helm/ingress_test.yaml
+++ b/src/test/helm/ingress_test.yaml
@@ -92,6 +92,17 @@ tests:
           value: helm-formcycle.test.sh.ozg-cloud.de
 
 
+  - it: should create custom adapter host
+    set:
+      ingress.adapterBezeichner: test
+    asserts:
+      - equal:
+          path: spec.rules[0].host
+          value: helm-test.test.sh.ozg-cloud.de
+      - equal:
+          path: spec.tls[0].hosts[0]
+          value: helm-test.test.sh.ozg-cloud.de
+
   - it: should use letsencrypt-prod cluster-issuer as default
     asserts:
       - equal:
-- 
GitLab