From 69e6855b624226f17623c85a1c9c7192e28e160a Mon Sep 17 00:00:00 2001
From: Jan Zickermann <jan.zickermann@dataport.de>
Date: Wed, 18 Dec 2024 20:27:47 +0100
Subject: [PATCH] #2 OZG-7121 helm: Use ingressClassname to ingress, again

---
 src/main/helm/templates/ingress.yaml |  3 +++
 src/test/helm/ingress_test.yaml      | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/main/helm/templates/ingress.yaml b/src/main/helm/templates/ingress.yaml
index 2285822..3367822 100644
--- a/src/main/helm/templates/ingress.yaml
+++ b/src/main/helm/templates/ingress.yaml
@@ -6,6 +6,9 @@ metadata:
   annotations:
     haproxy-ingress.github.io/ssl-passthrough: "true"
 spec:
+  {{- if (.Values.ingress).className }}
+  ingressClassName: {{ .Values.ingress.className }}
+  {{- end }}
   rules:
     - host: "{{ .Release.Name }}-{{ include "app.baseDomain" . }}"
       http:
diff --git a/src/test/helm/ingress_test.yaml b/src/test/helm/ingress_test.yaml
index 06b8b23..668a3e7 100644
--- a/src/test/helm/ingress_test.yaml
+++ b/src/test/helm/ingress_test.yaml
@@ -43,6 +43,19 @@ tests:
       - equal:
           path: metadata.annotations["haproxy-ingress.github.io/ssl-passthrough"]
           value: "true"
+
+  - it: should not create ingress tls/ingressClass by default
+    asserts:
+      - isNull:
+          path: spec.ingressClassName
+  - it: should set ingress tls/ingressClass
+    set:
+      ingress:
+        className: ingress
+    asserts:
+      - equal:
+          path: spec.ingressClassName
+          value: ingress
   - it: should create rules correctly
     asserts:
       - equal:
-- 
GitLab