Convert for util.IP to just use a net.IP

pflag can handle IP addresses so use the pflag code instead of doing it
ourselves. This means our code just uses net.IP and we don't have all of
the useless casting back and forth!
This commit is contained in:
Eric Paris
2015-08-05 15:42:13 -04:00
parent 65bff3d187
commit fe6b633e2a
9 changed files with 52 additions and 112 deletions

View File

@@ -56,7 +56,7 @@ import (
// CMServer is the main context object for the controller manager.
type CMServer struct {
Port int
Address util.IP
Address net.IP
CloudProvider string
CloudConfigFile string
ConcurrentEndpointSyncs int
@@ -90,7 +90,7 @@ type CMServer struct {
func NewCMServer() *CMServer {
s := CMServer{
Port: ports.ControllerManagerPort,
Address: util.IP(net.ParseIP("127.0.0.1")),
Address: net.ParseIP("127.0.0.1"),
ConcurrentEndpointSyncs: 5,
ConcurrentRCSyncs: 5,
ServiceSyncPeriod: 5 * time.Minute,
@@ -108,7 +108,7 @@ func NewCMServer() *CMServer {
// AddFlags adds flags for a specific CMServer to the specified FlagSet
func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&s.Port, "port", s.Port, "The port that the controller-manager's http service runs on")
fs.Var(&s.Address, "address", "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
fs.IPVar(&s.Address, "address", s.Address, "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
fs.StringVar(&s.CloudProvider, "cloud-provider", s.CloudProvider, "The provider for cloud services. Empty string for no provider.")
fs.StringVar(&s.CloudConfigFile, "cloud-config", s.CloudConfigFile, "The path to the cloud provider configuration file. Empty string for no configuration file.")
fs.IntVar(&s.ConcurrentEndpointSyncs, "concurrent-endpoint-syncs", s.ConcurrentEndpointSyncs, "The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load")