From b78d0456be9c6815fd131f4909b5986957378ffb Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Mon, 4 Apr 2022 11:50:43 +0200
Subject: [PATCH] remove https from ingress

---
 templates/_helpers.tpl       | 14 +++++++-------
 unit-tests/ingress_test.yaml | 36 ++++++++++++++++++------------------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl
index fc26695d7..4bc3ea99f 100644
--- a/templates/_helpers.tpl
+++ b/templates/_helpers.tpl
@@ -89,28 +89,28 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
 
 {{- define "app.ingress.host" }}
 {{- if .Values.ingress.overrideHost }}
-{{- printf "%s" .Values.ingress.overrideHost }}
+{{- printf "%s" ( trimPrefix "https://" .Values.ingress.overrideHost ) }}
 {{- else }}
 
 {{- if eq (include "app.kopEnvironment" . ) "prod" }}
 {{- if eq (.Values.image).name "formsolutions-adapter" }}
-{{- printf "https://%s-fs.ozg-sh.de" (include "app.kopBezeichner" .) }}
+{{- printf "%s-fs.ozg-sh.de" (include "app.kopBezeichner" .) }}
 {{- else }}
-{{- printf "https://%s.afm.ozg-sh.de" (include "app.kopBezeichner" .) }}
+{{- printf "%s.afm.ozg-sh.de" (include "app.kopBezeichner" .) }}
 {{- end }}
 
 {{- else if eq (include "app.kopEnvironment" . ) "stage" }}
 {{- if eq (.Values.image).name "formsolutions-adapter" }}
-{{- printf "https://%s-fs.stage.ozg-sh.de" (include "app.kopBezeichner" .) }}
+{{- printf "%s-fs.stage.ozg-sh.de" (include "app.kopBezeichner" .) }}
 {{- else }}
-{{- printf "https://%s.stage.afm.ozg-sh.de" (include "app.kopBezeichner" .) }}
+{{- printf "%s.stage.afm.ozg-sh.de" (include "app.kopBezeichner" .) }}
 {{- end }}
 
 {{- else }}
 {{- if eq (.Values.image).name "formsolutions-adapter" }}
-{{- printf "https://%s-fs.%s.ozg-sh.de" (include "app.kopBezeichner" .)  (include "app.kopEnvironment" . ) }}
+{{- printf "%s-fs.%s.ozg-sh.de" (include "app.kopBezeichner" .)  (include "app.kopEnvironment" . ) }}
 {{- else }}
-{{- printf "https://%s-afm.%s.ozg-sh.de" (include "app.kopBezeichner" .) (include "app.kopEnvironment" . ) }}
+{{- printf "%s-afm.%s.ozg-sh.de" (include "app.kopBezeichner" .) (include "app.kopEnvironment" . ) }}
 {{- end }}
 {{- end }}
 {{- end }}
diff --git a/unit-tests/ingress_test.yaml b/unit-tests/ingress_test.yaml
index 44611be7e..74e1a4628 100644
--- a/unit-tests/ingress_test.yaml
+++ b/unit-tests/ingress_test.yaml
@@ -57,10 +57,10 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://unit-afm.dev.ozg-sh.de
+          value: unit-afm.dev.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://unit-afm.dev.ozg-sh.de
+          value: unit-afm.dev.ozg-sh.de
   - it: should create afm test host
     set:
       kop.environment: test
@@ -68,10 +68,10 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://unit-afm.test.ozg-sh.de
+          value: unit-afm.test.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://unit-afm.test.ozg-sh.de
+          value: unit-afm.test.ozg-sh.de
   - it: should create afm prod host
     set:
       kop.environment: prod
@@ -79,10 +79,10 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://unit.afm.ozg-sh.de
+          value: unit.afm.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://unit.afm.ozg-sh.de
+          value: unit.afm.ozg-sh.de
   - it: should create afm stage host
     set:
       kop.environment: stage
@@ -90,10 +90,10 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://unit.stage.afm.ozg-sh.de
+          value: unit.stage.afm.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://unit.stage.afm.ozg-sh.de
+          value: unit.stage.afm.ozg-sh.de
   - it: should set host
     release:
       namespace: sh-unit-stage
@@ -104,10 +104,10 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://host.dev.ozg-sh.de
+          value: host.dev.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://host.dev.ozg-sh.de
+          value: host.dev.ozg-sh.de
 
   - it: should create fs dev host
     set:
@@ -117,10 +117,10 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://unit-fs.dev.ozg-sh.de
+          value: unit-fs.dev.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://unit-fs.dev.ozg-sh.de
+          value: unit-fs.dev.ozg-sh.de
   - it: should create fs test host
     set:
       image.name: formsolutions-adapter
@@ -129,10 +129,10 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://unit-fs.test.ozg-sh.de
+          value: unit-fs.test.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://unit-fs.test.ozg-sh.de
+          value: unit-fs.test.ozg-sh.de
   - it: should create fs prod host
     set:
       image.name: formsolutions-adapter
@@ -141,10 +141,10 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://unit-fs.ozg-sh.de
+          value: unit-fs.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://unit-fs.ozg-sh.de
+          value: unit-fs.ozg-sh.de
   - it: should create fs stage host
     set:
       image.name: formsolutions-adapter
@@ -153,7 +153,7 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: https://unit-fs.stage.ozg-sh.de
+          value: unit-fs.stage.ozg-sh.de
       - equal:
           path: spec.tls[0].hosts[0]
-          value: https://unit-fs.stage.ozg-sh.de
\ No newline at end of file
+          value: unit-fs.stage.ozg-sh.de
\ No newline at end of file
-- 
GitLab