From 8c97833e9d3f85c1130216a32e574ae86389144b Mon Sep 17 00:00:00 2001
From: Bastian <bastian.heppener@mgm-tp.com>
Date: Fri, 10 Jan 2025 17:00:40 +0100
Subject: [PATCH] ozg-7121 ingress with ssl passthrough

---
 src/main/helm/templates/certificate.yaml |  1 -
 src/main/helm/templates/ingress.yaml     |  6 +++---
 src/main/helm/templates/route.yaml       | 23 -----------------------
 src/test/helm/ingress_test.yaml          | 14 +++++++-------
 4 files changed, 10 insertions(+), 34 deletions(-)
 delete mode 100644 src/main/helm/templates/route.yaml

diff --git a/src/main/helm/templates/certificate.yaml b/src/main/helm/templates/certificate.yaml
index 76aac3a..7ac0e72 100644
--- a/src/main/helm/templates/certificate.yaml
+++ b/src/main/helm/templates/certificate.yaml
@@ -40,5 +40,4 @@ spec:
     - key encipherment
     - key agreement
   dnsNames:
-    - "{{ .Release.Name }}-passthrough-{{ include "app.baseDomain" . }}"
     - "{{ .Release.Name }}-{{ include "app.baseDomain" . }}"
\ No newline at end of file
diff --git a/src/main/helm/templates/ingress.yaml b/src/main/helm/templates/ingress.yaml
index 3367822..f56f06a 100644
--- a/src/main/helm/templates/ingress.yaml
+++ b/src/main/helm/templates/ingress.yaml
@@ -4,7 +4,7 @@ metadata:
   name: {{ .Release.Name }}
   namespace: {{ include "app.namespace" . }}
   annotations:
-    haproxy-ingress.github.io/ssl-passthrough: "true"
+    route.openshift.io/termination: passthrough
 spec:
   {{- if (.Values.ingress).className }}
   ingressClassName: {{ .Values.ingress.className }}
@@ -13,8 +13,8 @@ spec:
     - host: "{{ .Release.Name }}-{{ include "app.baseDomain" . }}"
       http:
         paths:
-          - path: /
-            pathType: Prefix
+          - path: ""
+            pathType: ImplementationSpecific
             backend:
               service:
                 name: {{ .Release.Name }}
diff --git a/src/main/helm/templates/route.yaml b/src/main/helm/templates/route.yaml
deleted file mode 100644
index 0f86471..0000000
--- a/src/main/helm/templates/route.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
-kind: Route
-apiVersion: route.openshift.io/v1
-metadata:
-  name: {{ .Release.Name }}-passthrough
-  namespace: by-enable-dev
-
-spec:
-  host: {{ .Release.Name }}-passthrough-{{ include "app.baseDomain" . }}
-  to:
-    kind: Service
-    name: xta-test-server
-    weight: 100
-  port:
-    targetPort: 8443
-  tls:
-    termination: passthrough
-  wildcardPolicy: None
-status:
-  ingress:
-    - host: {{ .Release.Name }}-passthrough-{{ include "app.baseDomain" . }}
-      routerName: default
-      wildcardPolicy: None
-      routerCanonicalHostname: router-default.apps.okd.dev.by.ozg-cloud.systems
diff --git a/src/test/helm/ingress_test.yaml b/src/test/helm/ingress_test.yaml
index 668a3e7..8a67ad4 100644
--- a/src/test/helm/ingress_test.yaml
+++ b/src/test/helm/ingress_test.yaml
@@ -24,7 +24,7 @@
 
 suite: test ingress.yaml
 release:
-  name: matabase
+  name: xta-test-server
   namespace: sh-helm-test
 templates:
   - templates/ingress.yaml
@@ -41,8 +41,8 @@ tests:
   - it: should enable ssl passthrough
     asserts:
       - equal:
-          path: metadata.annotations["haproxy-ingress.github.io/ssl-passthrough"]
-          value: "true"
+          path: metadata.annotations["route.openshift.io/termination"]
+          value: "passthrough"
 
   - it: should not create ingress tls/ingressClass by default
     asserts:
@@ -61,11 +61,11 @@ tests:
       - equal:
           path: spec.rules[0].http.paths[0]
           value: 
-              path: /
-              pathType: Prefix
+              path: ""
+              pathType: ImplementationSpecific
               backend:
                 service:
-                  name: matabase
+                  name: xta-test-server
                   port: 
                     number: 8443
 
@@ -73,4 +73,4 @@ tests:
     asserts:
       - equal:
           path: spec.rules[0].host
-          value: matabase-helm.test.by.ozg-cloud.de
+          value: xta-test-server-helm.test.by.ozg-cloud.de
-- 
GitLab