From cfe096c4540e87a35acbeb7d11c3bbddb52535be Mon Sep 17 00:00:00 2001
From: Andri Joos <andri@joos.io>
Date: Sun, 2 Feb 2025 22:43:21 +0100
Subject: [PATCH] make traefik ingressroute routes a dict

---
 common/templates/_helpers.tpl              | 12 ++++++++++++
 common/templates/traefik/_ingressroute.tpl |  7 +++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/common/templates/_helpers.tpl b/common/templates/_helpers.tpl
index 2804f87..14a6fed 100644
--- a/common/templates/_helpers.tpl
+++ b/common/templates/_helpers.tpl
@@ -90,3 +90,15 @@ IngressRouteTCP
 {{- end }}
 {{- toYaml $routes -}}
 {{- end }}
+
+{{/*
+IngressRoute
+*/}}
+
+{{- define "common.traefik.variables.ingressroute.routes" -}}
+{{- $routes := list -}}
+{{- range $name, $route := .Values.routes -}}
+  {{- $routes = append $routes $route -}}
+{{- end }}
+{{- toYaml $routes -}}
+{{- end }}
diff --git a/common/templates/traefik/_ingressroute.tpl b/common/templates/traefik/_ingressroute.tpl
index 1b57604..be8826c 100644
--- a/common/templates/traefik/_ingressroute.tpl
+++ b/common/templates/traefik/_ingressroute.tpl
@@ -15,12 +15,11 @@ spec:
   entryPoints:
     {{- toYaml . | nindent 4 }}
   {{- end }}
-  {{- with .Values.routes }}
   routes:
-    {{- toYaml . | nindent 4 }}
-  {{- end }}
+    {{- (include "common.traefik.variables.ingressroutetcp.routes" .) | nindent 4 }}
   {{- with .Values.tls }}
   tls:
-    {{- toYaml . | nindent 4 }}
+    {{ toYaml . | nindent 4 }}
   {{- end }}
+---
 {{- end }}
-- 
GitLab