helm icon indicating copy to clipboard operation
helm copied to clipboard

coredns.containerPorts template helper does not properly handle missing ports

Open jmmk opened this issue 3 years ago • 1 comments
trafficstars

In charts/coredns/templates/configmap.yaml, port is allowed to be missing:

{{- if .port }}:{{ .port }} {{ end -}}

However, in charts/coredns/templates/_helpers.tpl, there is no check if the port is missing, only a call to toString:

{{- $port := toString .port -}}

When templated, this produces containerPorts like this:

- containerPort: <nil>
  name: udp-<nil>
  protocol: UDP
- containerPort: <nil>
  name: tcp-<nil>
  protocol: TCP

The workaround is to explicitly specify the default port 53

jmmk avatar May 25 '22 19:05 jmmk

/assign

shubham-cmyk avatar Jul 26 '23 17:07 shubham-cmyk