Open szvincze opened 3 weeks ago
A little hesitant to take this change since :::8081
isn't a spec conformant ip:port value. Is there another way this can be handled? Can the component that ingests the statusIP do a proper formation of statusIP:port instead of us teaching spire to accept malformed input?
Hi @azdagron, thanks for checking this PR.
A little hesitant to take this change since
:::8081
isn't a spec conformant ip:port value. Is there another way this can be handled? Can the component that ingests the statusIP do a proper formation of statusIP:port instead of us teaching spire to accept malformed input?
I see your point and it was my first reaction too when I bumped into this problem. But as I checked the configuration and the code I found that bind_address
and bind_port
are separately defined in the config file for the server socket and the health-checks too, and just combined inside spire. So, the address is coming in a normal IPv6 format from Kubernetes via an environment variable without square brackets and the port is configured separately. The problem happens when spire simply concatenates the address and the port, so :::8081
created by spire (maybe ::
was not the best example to show the fault). However, this IPv6 address format works properly for bundle endpoint and metrics.
In my opinion this PR should be taken to handle the IPv6 addresses in a consistent way in spire.
Ah, i misunderstood. Yes, I agree SPIRE should handle this gracefully.
Pull Request check list
Affected functionality
Configuration of bind_address for spire-server and health-checks.
We use status.podIP field in the configuration file to automatically set the bind address and similarly for health-check's too. It causes the following fault if the pod IP is an IPv6 address because it comes without square brackets:
could not resolve bind address ":::8081": address :::8081: too many colons in address
Similar happens in the health subsystem when the health check address is an IPv6 address in the same format:
Description of change
The string concatenation is replaced by net.JoinHostPort function that properly formats the IPv6 addresses too. IPv6 addresses formatted this way are accepted for both spire-server and health-check bind_address and the automation works fine: