flag.Var(&etcdServerList,"etcd_servers","List of etcd servers to watch (http://ip:port), comma separated (optional). Mutually exclusive with -etcd_config")
flag.Var(&bindAddress,"bind_address","The IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)")
// ProxyServer contains configures and runs a Kubernetes proxy server
typeProxyServerstruct{
EtcdServerListutil.StringList
EtcdConfigFilestring
BindAddressutil.IP
ClientConfigclient.Config
HealthzPortint
OOMScoreAdjint
}
// NewProxyServer creates a new ProxyServer object with default parameters
funcNewProxyServer()*ProxyServer{
return&ProxyServer{
BindAddress:util.IP(net.ParseIP("0.0.0.0")),
HealthzPort:10249,
OOMScoreAdj:-899,
}
}
// NewHyperkubeServer creates a new hyperkube Server object that includes the
// description and flags.
funcNewHyperkubeServer()*hyperkube.Server{
s:=NewProxyServer()
hks:=hyperkube.Server{
SimpleUsage:"proxy",
Long:`The Kubernetes proxy server is responsible for taking traffic directed at
services and forwarding it to the appropriate pods. It generally runs on
nodes next to the Kubelet and proxies traffic from local pods to remote pods.
It is also used when handling incoming external traffic.`,
Run:func(_*hyperkube.Server,args[]string)error{
returns.Run(args)
},
}
s.AddFlags(hks.Flags())
return&hks
}
// AddFlags adds flags for a specific ProxyServer to the specified FlagSet
func(s*ProxyServer)AddFlags(fs*pflag.FlagSet){
fs.StringVar(&s.EtcdConfigFile,"etcd_config",s.EtcdConfigFile,"The config file for the etcd client. Mutually exclusive with -etcd_servers")
fs.Var(&s.EtcdServerList,"etcd_servers","List of etcd servers to watch (http://ip:port), comma separated (optional). Mutually exclusive with -etcd_config")
fs.Var(&s.BindAddress,"bind_address","The IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)")
client.BindClientConfigFlags(fs,&s.ClientConfig)
fs.IntVar(&s.HealthzPort,"healthz_port",s.HealthzPort,"The port to bind the health check server. Use 0 to disable.")
fs.IntVar(&s.OOMScoreAdj,"oom_score_adj",s.OOMScoreAdj,"The oom_score_adj value for kube-proxy process. Values must be within the range [-1000, 1000]")
}
// Run runs the specified ProxyServer. This should never exit.