normalize -etcd_servers flag across all commands

The -etcd_servers flag is used inconsistently by the Kubernetes commands,
both externally and internally.

This patch fixes the issue by using the same type to represent a list of
etcd servers internally, and declares the -etcd_servers flag consistently
across all commands.

This patch should be 100% backwards compatible with no changes in behavior.
This commit is contained in:
Kelsey Hightower
2014-07-20 07:48:47 -07:00
parent 1e63719e02
commit dc7ee7c333
6 changed files with 29 additions and 18 deletions

View File

@@ -37,7 +37,6 @@ import (
var (
config = flag.String("config", "", "Path to the config file or directory of files")
etcdServers = flag.String("etcd_servers", "", "Url of etcd servers in the cluster")
syncFrequency = flag.Duration("sync_frequency", 10*time.Second, "Max period between synchronizing running containers and config")
fileCheckFrequency = flag.Duration("file_check_frequency", 20*time.Second, "Duration between checking config files for new data")
httpCheckFrequency = flag.Duration("http_check_frequency", 20*time.Second, "Duration between checking http for new data")
@@ -46,8 +45,13 @@ var (
port = flag.Uint("port", 10250, "The port for the info server to serve on")
hostnameOverride = flag.String("hostname_override", "", "If non-empty, will use this string as identification instead of the actual hostname.")
dockerEndpoint = flag.String("docker_endpoint", "", "If non-empty, use this for the docker endpoint to communicate with")
etcdServerList util.StringList
)
func init() {
flag.Var(&etcdServerList, "etcd_servers", "List of etcd servers to watch (http://ip:port), comma separated")
}
func getDockerEndpoint() string {
var endpoint string
if len(*dockerEndpoint) > 0 {
@@ -96,5 +100,5 @@ func main() {
SyncFrequency: *syncFrequency,
HTTPCheckFrequency: *httpCheckFrequency,
}
k.RunKubelet(*dockerEndpoint, *config, *manifestURL, *etcdServers, *address, *port)
k.RunKubelet(*dockerEndpoint, *config, *manifestURL, etcdServerList, *address, *port)
}