Skip to content

fix: allow for ipv6 address for prometheus - #266

Merged
hagaibarel merged 1 commit into
coredns:masterfrom
EuanFH:master
Jul 16, 2026
Merged

fix: allow for ipv6 address for prometheus#266
hagaibarel merged 1 commit into
coredns:masterfrom
EuanFH:master

Conversation

@EuanFH

@EuanFH EuanFH commented Jul 15, 2026

Copy link
Copy Markdown

Why is this pull request needed and what does it do?

if you set prometheus parameters from and ipv4 address "0.0.0.0:91543" to a ipv6 address "[::]:91543" the template will fail to render.
Currently the port generation code is assuming the second value in the split is the port which will work on ipv4 but wont work on ipv6 addresses.
The code now picks the last colon split in the list which should always be the port and will work for both ipv4 and ipv6.

What would be better instead of string splitting would be to use the sprig urlParse function
example:

            {{- if eq .name "prometheus" -}}
                {{- $prometheus_params := toString .parameters -}}
		{{- $prometheus_url := urlParse $prometheus_params -}}
                {{- $ports := set $ports $prometheus_url.port (dict "istcp" true "isudp" false) -}}
            {{- end -}}

but this function is also broken for ipv6 it seems.

Checklist:

  • I have bumped the chart version according to versioning.
  • I have updated the chart changelog with all the changes that come with this pull request according to changelog.
  • Any new values are backwards compatible and/or have sensible default.
  • I have signed off all my commits as required by DCO.

… ipv6 addresses

Signed-off-by: Euan Haahr <euan@haahr.co.uk>
@hagaibarel
hagaibarel merged commit e1db0d2 into coredns:master Jul 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants