influxdata / influxdata/kapacitor

Can't create Influx subscription when using a bare IPv6 address as Kapacitor hostname

Open
#2,400 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

If you configure Kapacitor to listen on an IPv6 address and then set the Kapacitor hostname to be that address, this causes an issue when Kapacitor tries to link the Influx subscription, because it leads to Kapacitor constructing an invalid URL.

These are the relevant pieces of the Kapacitor config:
`hostname = "2001:470:8a15:0:0:0:ac1f:101"`
`[http]`
`bind-address = "[2001:470:8a15:0:0:0:ac1f:101]:9094"`

This leads to the following error in the logs on startup:
`kapacitor: ts=2020-08-12T11:27:01.744-04:00 lvl=error msg="encountered error" service=run err="open server: open service *influxdb.Service: failed to link subscription on startup: creating sub kapacitor-d1a58090-5518-4b59-8144-c94475e60bd4 for db \"db\" and rp \"autogen\": invalid subscription URL: http://2001:470:8a15:0:0:0:ac1f:101:9094"`

You can work around this by setting the hostname field in the config file either to a hostname that resolves to the IPv6 address or to the address wrapped in brackets. However, it's not immediately clear to a user that the hostname field will be used to generate a URL.

It would be nice if the Kapacitor config either validated that the hostname did not contain invalid characters or determined that the hostname looked like an ipv6 address and wrapped it in brackets before using it to construct the subscription URL.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the subscription URL construction used during startup, using the hostname and bind-address examples in the issue. Done means a bare IPv6 hostname either produces a valid bracketed subscription URL or is rejected with a clear configuration error, with coverage for the reported address.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.