@@ -70,10 +70,11 @@ Generate the list of ports automatically from the server definitions
70
70
{ {- range .Values.servers -} }
71
71
{ {/* Capture port to avoid scoping awkwardness */} }
72
72
{ {- $port := toString .port -} }
73
+ { {- $serviceport := default .port .servicePort -} }
73
74
74
75
{ {/* If none of the server blocks has mentioned this port yet take note of it */} }
75
76
{ {- 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 ) -} }
77
78
{ {- end -} }
78
79
{ {/* Retrieve the inner dict that holds the protocols for a given port */} }
79
80
{ {- $innerdict := index $ports $port -} }
@@ -116,10 +117,10 @@ Generate the list of ports automatically from the server definitions
116
117
{ {- range $port , $innerdict := $ports -} }
117
118
{ {- $portList := list -} }
118
119
{ {- 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 )) -} }
120
121
{ {- end -} }
121
122
{ {- 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 )) -} }
123
124
{ {- end -} }
124
125
125
126
{ {- range $portDict := $portList -} }
@@ -234,4 +235,4 @@ Create the name of the service account to use
234
235
{ {- else -} }
235
236
{ { template " coredns.fullname" . } }
236
237
{ {- end -} }
237
- { {- end -} }
238
+ { {- end -} }
0 commit comments