From 32c17e01c2333801b49e316b00fd6c3756a5256a Mon Sep 17 00:00:00 2001
From: Mark Sanchez <mark.sanchez.8@us.af.mil>
Date: Wed, 17 Nov 2021 15:08:31 +0000
Subject: [PATCH] Resolve "Istio Gateway Servers block templating does noting"

---
 chart/templates/istio/controlplane/values.yaml | 14 +++++++++++++-
 chart/values.yaml                              | 11 +++++++++--
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/chart/templates/istio/controlplane/values.yaml b/chart/templates/istio/controlplane/values.yaml
index a1114e04dd..320d1ccdf2 100644
--- a/chart/templates/istio/controlplane/values.yaml
+++ b/chart/templates/istio/controlplane/values.yaml
@@ -50,8 +50,19 @@ gateways:
     autoHttpRedirect:
       enabled: {{ dig "autoHttpRedirect" "enabled" "true" $values }}
     servers:
+      {{- if ($values.ports) }}
+        {{- range $values.ports }}
     - hosts:
-      {{ tpl ($values.hosts | default (list) | toYaml) $ | nindent 8 }}
+      {{- tpl ($values.hosts | default (list) | toYaml) $ | nindent 8 }}
+      port:
+      {{- tpl ( . | default (list) | toYaml) $ | nindent 8 }}
+      tls:
+        credentialName: {{ $name }}-cert
+        mode: {{ dig "tls" "mode" "SIMPLE" $values }}
+        {{- end }}
+      {{ else }} 
+    - hosts:
+      {{- tpl ($values.hosts | default (list) | toYaml) $ | nindent 8 }} 
       port:
         name: https
         number: 8443
@@ -59,6 +70,7 @@ gateways:
       tls:
         credentialName: {{ $name }}-cert
         mode: {{ dig "tls" "mode" "SIMPLE" $values }}
+      {{- end }}  
 {{- end }}
 {{- end }}
 
diff --git a/chart/values.yaml b/chart/values.yaml
index f702349997..bb676896ce 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -157,10 +157,17 @@ istio:
     # private:
     #   ingressGateway: "private-ingressgateway"
     #   hosts:
-    #   - "*.{{ .Values.domain }}"
+    #   - "example.bigbang.dev"
+    #   ports:
+    #     - name: tls-2
+    #       number: 1234
+    #       protocol: TCP
+    #     - name: tls
+    #       number: 5678
+    #       protocol: TCP
     #   # -- Controls default HTTP/8080 server entry with HTTP to HTTPS Redirect.
     #   autoHttpRedirect:
-    #     enabled: true
+    #     enabled: false
     #   tls:
     #     key: ""
     #     cert: ""
-- 
GitLab