@@ -70,10 +70,11 @@ Generate the list of ports automatically from the server definitions
7070 { {- range .Values.servers -} }
7171 { {/* Capture port to avoid scoping awkwardness */} }
7272 { {- $port := toString .port -} }
73+ { {- $serviceport := default .port .servicePort -} }
7374
7475 { {/* If none of the server blocks has mentioned this port yet take note of it */} }
7576 { {- if not (hasKey $ports $port ) -} }
76- { {- $ports := set $ports $port (dict " istcp" false " isudp" false ) -} }
77+ { {- $ports := set $ports $port (dict " istcp" false " isudp" false " serviceport " $ serviceport ) -} }
7778 { {- end -} }
7879 { {/* Retrieve the inner dict that holds the protocols for a given port */} }
7980 { {- $innerdict := index $ports $port -} }
@@ -116,10 +117,10 @@ Generate the list of ports automatically from the server definitions
116117 { {- range $port , $innerdict := $ports -} }
117118 { {- $portList := list -} }
118119 { {- if index $innerdict " isudp" -} }
119- { {- $portList = append $portList (dict " port" ($ port | int ) " protocol" " UDP" " name" (printf " udp-%s" $port )) -} }
120+ { {- $portList = append $portList (dict " port" (get $ innerdict " serviceport " ) " protocol" " UDP" " name" (printf " udp-%s" $port ) " targetPort " ( $ port | int )) -} }
120121 { {- end -} }
121122 { {- if index $innerdict " istcp" -} }
122- { {- $portList = append $portList (dict " port" ($ port | int ) " protocol" " TCP" " name" (printf " tcp-%s" $port )) -} }
123+ { {- $portList = append $portList (dict " port" (get $ innerdict " serviceport " ) " protocol" " TCP" " name" (printf " tcp-%s" $port ) " targetPort " ( $ port | int )) -} }
123124 { {- end -} }
124125
125126 { {- range $portDict := $portList -} }
@@ -234,4 +235,4 @@ Create the name of the service account to use
234235{ {- else -} }
235236 { { template " coredns.fullname" . } }
236237{ {- end -} }
237- { {- end -} }
238+ { {- end -} }
0 commit comments