Commit c258d4df authored by Davanum Srinivas's avatar Davanum Srinivas

Fix ExternalAddress parsing problem under IPv6

`!strings.Contains(host, ":")` will fail miserably under ipv6
parent 0b0254f0
...@@ -342,11 +342,11 @@ func (c *Config) Complete(informers informers.SharedInformerFactory) CompletedCo ...@@ -342,11 +342,11 @@ 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
if _, _, err := net.SplitHostPort(host); err != nil && c.ReadWritePort != 0 {
host = net.JoinHostPort(host, strconv.Itoa(c.ReadWritePort)) host = net.JoinHostPort(host, strconv.Itoa(c.ReadWritePort))
} }
}
c.ExternalAddress = host c.ExternalAddress = host
if c.OpenAPIConfig != nil && c.OpenAPIConfig.SecurityDefinitions != nil { if c.OpenAPIConfig != nil && c.OpenAPIConfig.SecurityDefinitions != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment