From d625c31d92c87ae862e9ae18115cd38060bad375 Mon Sep 17 00:00:00 2001
From: Andri Joos <andri@joos.io>
Date: Mon, 3 Feb 2025 23:09:58 +0100
Subject: [PATCH] namespace variables correctly

---
 common/templates/_configmap.tpl               |  2 +-
 common/templates/_helpers.tpl                 | 20 +++++++++----------
 common/templates/_ingress.tpl                 |  4 ++--
 common/templates/_secret.tpl                  |  2 +-
 common/templates/traefik/_ingressroute.tpl    |  2 +-
 common/templates/traefik/_ingressroutetcp.tpl |  2 +-
 common/templates/traefik/_tlsstore.tpl        |  2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/common/templates/_configmap.tpl b/common/templates/_configmap.tpl
index ae3c9bf..c566d70 100644
--- a/common/templates/_configmap.tpl
+++ b/common/templates/_configmap.tpl
@@ -10,6 +10,6 @@ metadata:
   labels:
     {{- include "common.variables.labels" . | nindent 4 }}
 data:
-  {{- (include "common.variables.configmap.data" .) | nindent 2 }}
+  {{- (include "common.configmap.variables.data" .) | nindent 2 }}
 ---
 {{- end }}
diff --git a/common/templates/_helpers.tpl b/common/templates/_helpers.tpl
index 8ae0f2f..e54df5e 100644
--- a/common/templates/_helpers.tpl
+++ b/common/templates/_helpers.tpl
@@ -20,13 +20,13 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
 {{- end }}
 
 {{/*
-Extra Ingress
+Ingress
 */}}
 
 {{/*
-Extra Ingress Rules
+Ingress Rules
 */}}
-{{- define "common.variables.ingress.rules" -}}
+{{- define "common.ingress.variables.rules" -}}
 {{- $rules := list -}}
 {{- range $name, $rule := .Values.rules -}}
   {{- $rules = append $rules $rule -}}
@@ -35,9 +35,9 @@ Extra Ingress Rules
 {{- end }}
 
 {{/*
-Extra Ingress TLS
+Ingress TLS
 */}}
-{{- define "common.variables.ingress.tls" -}}
+{{- define "common.ingress.variables.tls" -}}
 {{- $tlsDefinitions := list -}}
 {{- range $name, $tlsDefinition := .Values.tls -}}
   {{- $tlsDefinitions = append $tlsDefinitions $tlsDefinition -}}
@@ -52,7 +52,7 @@ Secret
 {{/*
 Secret data
 */}}
-{{- define "common.variables.secret.data" -}}
+{{- define "common.secret.variables.data" -}}
 {{- $data := dict -}}
 {{- range $key, $value := .Values.data -}}
   {{- $data = merge $data (dict $key $value) -}}
@@ -67,7 +67,7 @@ ConfigMap
 {{/*
 ConfigMap data
 */}}
-{{- define "common.variables.configmap.data" -}}
+{{- define "common.configmap.variables.data" -}}
 {{- $data := dict -}}
 {{- range $key, $value := .Values.data -}}
   {{- $data = merge $data (dict $key $value) -}}
@@ -83,7 +83,7 @@ Traefik
 IngressRouteTCP
 */}}
 
-{{- define "common.traefik.variables.ingressroutetcp.routes" -}}
+{{- define "common.traefik.ingressroutetcp.variables.routes" -}}
 {{- $routes := list -}}
 {{- range $name, $route := .Values.routes -}}
   {{- $routes = append $routes $route -}}
@@ -95,7 +95,7 @@ IngressRouteTCP
 IngressRoute
 */}}
 
-{{- define "common.traefik.variables.ingressroute.routes" -}}
+{{- define "common.traefik.ingressroute.variables.routes" -}}
 {{- $routes := list -}}
 {{- range $name, $route := .Values.routes -}}
   {{- $routes = append $routes $route -}}
@@ -107,7 +107,7 @@ IngressRoute
 TLSStore
 */}}
 
-{{- define "common.traefik.variables.tlsstore.certificates" -}}
+{{- define "common.traefik.tlsstore.variables.certificates" -}}
 {{- range $secretName := .Values.certificates -}}
 - secretName: {{ $secretName }}
 {{- end }}
diff --git a/common/templates/_ingress.tpl b/common/templates/_ingress.tpl
index b1869a2..25f1fbc 100644
--- a/common/templates/_ingress.tpl
+++ b/common/templates/_ingress.tpl
@@ -14,8 +14,8 @@ spec:
   ingressClassName: {{ . | quote }}
   {{- end }}
   rules:
-    {{- (include "common.variables.ingress.rules" .) | nindent 4 }}
+    {{- (include "common.ingress.variables.rules" .) | nindent 4 }}
   tls:
-    {{- (include "common.variables.ingress.tls" .) | nindent 4 }}
+    {{- (include "common.ingress.variables.tls" .) | nindent 4 }}
 ---
 {{- end }}
diff --git a/common/templates/_secret.tpl b/common/templates/_secret.tpl
index 53b6ac8..a5a1e38 100644
--- a/common/templates/_secret.tpl
+++ b/common/templates/_secret.tpl
@@ -11,6 +11,6 @@ metadata:
     {{- include "common.variables.labels" . | nindent 4 }}
 type: {{ .Values.type | default "Opaque" }}
 data:
-  {{- (include "common.variables.secret.data" .) | nindent 2 }}
+  {{- (include "common.secret.variables.data" .) | nindent 2 }}
 ---
 {{- end }}
diff --git a/common/templates/traefik/_ingressroute.tpl b/common/templates/traefik/_ingressroute.tpl
index be8826c..867fa89 100644
--- a/common/templates/traefik/_ingressroute.tpl
+++ b/common/templates/traefik/_ingressroute.tpl
@@ -16,7 +16,7 @@ spec:
     {{- toYaml . | nindent 4 }}
   {{- end }}
   routes:
-    {{- (include "common.traefik.variables.ingressroutetcp.routes" .) | nindent 4 }}
+    {{- (include "common.traefik.ingressroute.variables.routes" .) | nindent 4 }}
   {{- with .Values.tls }}
   tls:
     {{ toYaml . | nindent 4 }}
diff --git a/common/templates/traefik/_ingressroutetcp.tpl b/common/templates/traefik/_ingressroutetcp.tpl
index a2186c2..8073a2a 100644
--- a/common/templates/traefik/_ingressroutetcp.tpl
+++ b/common/templates/traefik/_ingressroutetcp.tpl
@@ -15,7 +15,7 @@ spec:
     {{- toYaml . | nindent 4}}
   {{- end }}
   routes:
-    {{- (include "common.traefik.variables.ingressroutetcp.routes" .) | nindent 4 }}
+    {{- (include "common.traefik.ingressroutetcp.variables.routes" .) | nindent 4 }}
   {{- with .Values.tls }}
   tls:
     {{ toYaml . | nindent 4 }}
diff --git a/common/templates/traefik/_tlsstore.tpl b/common/templates/traefik/_tlsstore.tpl
index e72dec0..0b4fc0c 100644
--- a/common/templates/traefik/_tlsstore.tpl
+++ b/common/templates/traefik/_tlsstore.tpl
@@ -16,6 +16,6 @@ spec:
     secretName: {{ toYaml . }}
   {{- end }}
   certificates:
-    {{- include "common.traefik.variables.tlsstore.certificates" . | nindent 4 }}
+    {{- include "common.traefik.tlsstore.variables.certificates" . | nindent 4 }}
 ---
 {{- end }}
-- 
GitLab