mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Fix ExternalAddress parsing problem under IPv6
`!strings.Contains(host, ":")` will fail miserably under ipv6
This commit is contained in:
parent
0b0254f03e
commit
c258d4df84
@ -342,10 +342,10 @@ func (c *Config) Complete(informers informers.SharedInformerFactory) CompletedCo
|
|||||||
if host == "" && c.PublicAddress != nil {
|
if host == "" && c.PublicAddress != nil {
|
||||||
host = c.PublicAddress.String()
|
host = c.PublicAddress.String()
|
||||||
}
|
}
|
||||||
if !strings.Contains(host, ":") {
|
|
||||||
if c.ReadWritePort != 0 {
|
// if there is no port, and we have a ReadWritePort, use that
|
||||||
host = net.JoinHostPort(host, strconv.Itoa(c.ReadWritePort))
|
if _, _, err := net.SplitHostPort(host); err != nil && c.ReadWritePort != 0 {
|
||||||
}
|
host = net.JoinHostPort(host, strconv.Itoa(c.ReadWritePort))
|
||||||
}
|
}
|
||||||
c.ExternalAddress = host
|
c.ExternalAddress = host
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user