Merge pull request #12478 from eparis/use-pflag-network

Use pflags for net.IP and net.IPNet instead of custom flag types
This commit is contained in:
Alex Robinson
2015-08-10 11:55:54 -07:00
9 changed files with 60 additions and 231 deletions

View File

@@ -48,7 +48,7 @@ import (
// SchedulerServer has all the context and params needed to run a Scheduler
type SchedulerServer struct {
Port int
Address util.IP
Address net.IP
AlgorithmProvider string
PolicyConfigFile string
EnableProfiling bool
@@ -62,7 +62,7 @@ type SchedulerServer struct {
func NewSchedulerServer() *SchedulerServer {
s := SchedulerServer{
Port: ports.SchedulerPort,
Address: util.IP(net.ParseIP("127.0.0.1")),
Address: net.ParseIP("127.0.0.1"),
AlgorithmProvider: factory.DefaultProvider,
}
return &s
@@ -71,7 +71,7 @@ func NewSchedulerServer() *SchedulerServer {
// AddFlags adds flags for a specific SchedulerServer to the specified FlagSet
func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&s.Port, "port", s.Port, "The port that the scheduler'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.AlgorithmProvider, "algorithm-provider", s.AlgorithmProvider, "The scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders())
fs.StringVar(&s.PolicyConfigFile, "policy-config-file", s.PolicyConfigFile, "File with scheduler policy configuration")
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")