Permalink
Browse files

IPv6: Bootstrap extracting of addresses

For Pilot discovery, Zipkin, and statsd addresses, accept IPv6 values,
which will have square brackets.
  • Loading branch information...
pmichali committed Mar 5, 2018
1 parent 0502713 commit e7e5d4845ad8c8be245d58c6ae086c4d03d0863f
Showing with 16 additions and 7 deletions.
  1. +16 −7 pkg/bootstrap/bootstrap_config.go
@@ -17,9 +17,9 @@ package bootstrap
import (
"fmt"
"io/ioutil"
"net"
"os"
"path"
"strings"
"text/template"
meshconfig "istio.io/api/mesh/v1alpha1"
@@ -72,16 +72,25 @@ func WriteBootstrap(config *meshconfig.ProxyConfig, epoch int, pilotSAN []string
opts["refresh_delay"] = fmt.Sprintf("{\"seconds\": %d, \"nanos\": %d}", config.DiscoveryRefreshDelay.Seconds, config.DiscoveryRefreshDelay.Nanos)
opts["connect_timeout"] = fmt.Sprintf("{\"seconds\": %d, \"nanos\": %d}", config.ConnectTimeout.Seconds, config.ConnectTimeout.Nanos)
addPort := strings.Split(config.DiscoveryAddress, ":")
opts["pilot_address"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", addPort[0], addPort[1])
h, p, err := net.SplitHostPort(config.DiscoveryAddress)
if err != nil {
return "", fmt.Errorf("PCM: Unable to parse Discovery address %q: %s", config.DiscoveryAddress, err.Error())
}
opts["pilot_address"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", h, p)
if config.ZipkinAddress != "" {
addPort = strings.Split(config.ZipkinAddress, ":")
opts["zipkin"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", addPort[0], addPort[1])
h, p, err := net.SplitHostPort(config.ZipkinAddress)
if err != nil {
return "", fmt.Errorf("PCM: Unable to parse Zipkin address %q: %s", config.ZipkinAddress, err.Error())
}
opts["zipkin"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", h, p)
}
if config.StatsdUdpAddress != "" {
addPort = strings.Split(config.StatsdUdpAddress, ":")
opts["statsd"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", addPort[0], addPort[1])
h, p, err := net.SplitHostPort(config.StatsdUdpAddress)
if err != nil {
return "", fmt.Errorf("PCM: Unable to parse StatsdUdp address %q: %s", config.StatsdUdpAddress, err.Error())
}
opts["statsd"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", h, p)
}
fout, err := os.Create(fname)
if err != nil {

0 comments on commit e7e5d48

Please sign in to comment.