diff --git a/charts/coredns/Chart.yaml b/charts/coredns/Chart.yaml index 38a134a..3d13cb1 100644 --- a/charts/coredns/Chart.yaml +++ b/charts/coredns/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: coredns -version: 1.33.0 +version: 1.34.0 appVersion: 1.11.3 home: https://coredns.io icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png @@ -20,4 +20,4 @@ type: application annotations: artifacthub.io/changes: | - kind: added - description: Add support for specifying the service loadBalancerClass. + description: Support different service and container ports diff --git a/charts/coredns/templates/_helpers.tpl b/charts/coredns/templates/_helpers.tpl index e6f7491..954c71a 100644 --- a/charts/coredns/templates/_helpers.tpl +++ b/charts/coredns/templates/_helpers.tpl @@ -70,10 +70,11 @@ Generate the list of ports automatically from the server definitions {{- range .Values.servers -}} {{/* Capture port to avoid scoping awkwardness */}} {{- $port := toString .port -}} + {{- $serviceport := default .port .servicePort -}} {{/* If none of the server blocks has mentioned this port yet take note of it */}} {{- if not (hasKey $ports $port) -}} - {{- $ports := set $ports $port (dict "istcp" false "isudp" false) -}} + {{- $ports := set $ports $port (dict "istcp" false "isudp" false "serviceport" $serviceport) -}} {{- end -}} {{/* Retrieve the inner dict that holds the protocols for a given port */}} {{- $innerdict := index $ports $port -}} @@ -116,10 +117,10 @@ Generate the list of ports automatically from the server definitions {{- range $port, $innerdict := $ports -}} {{- $portList := list -}} {{- if index $innerdict "isudp" -}} - {{- $portList = append $portList (dict "port" ($port | int) "protocol" "UDP" "name" (printf "udp-%s" $port)) -}} + {{- $portList = append $portList (dict "port" (get $innerdict "serviceport") "protocol" "UDP" "name" (printf "udp-%s" $port) "targetPort" ($port | int)) -}} {{- end -}} {{- if index $innerdict "istcp" -}} - {{- $portList = append $portList (dict "port" ($port | int) "protocol" "TCP" "name" (printf "tcp-%s" $port)) -}} + {{- $portList = append $portList (dict "port" (get $innerdict "serviceport") "protocol" "TCP" "name" (printf "tcp-%s" $port) "targetPort" ($port | int)) -}} {{- end -}} {{- range $portDict := $portList -}} @@ -234,4 +235,4 @@ Create the name of the service account to use {{- else -}} {{ template "coredns.fullname" . }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/charts/coredns/values.yaml b/charts/coredns/values.yaml index a7a612e..240c93a 100644 --- a/charts/coredns/values.yaml +++ b/charts/coredns/values.yaml @@ -103,6 +103,8 @@ servers: - zones: - zone: . port: 53 + # -- expose the service on a different port + # servicePort: 5353 # If serviceType is nodePort you can specify nodePort here # nodePort: 30053 # hostPort: 53