diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 347774117a..3664255cd7 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -380,7 +380,7 @@ }, { "ImportPath": "github.com/spf13/pflag", - "Rev": "18d831e92d67eafd1b0db8af9ffddbd04f7ae1f4" + "Rev": "60d4c375939ff7ba397a84117d5281256abb298f" }, { "ImportPath": "github.com/stretchr/objx", diff --git a/Godeps/_workspace/src/github.com/spf13/pflag/flag.go b/Godeps/_workspace/src/github.com/spf13/pflag/flag.go index 5dc53732b4..33db47c63b 100644 --- a/Godeps/_workspace/src/github.com/spf13/pflag/flag.go +++ b/Godeps/_workspace/src/github.com/spf13/pflag/flag.go @@ -120,6 +120,10 @@ const ( PanicOnError ) +// normalizedName is a flag name that has been normalized according to rules +// for the FlagSet (e.g. making '-' and '_' equivalent). +type normalizedName string + // A FlagSet represents a set of defined flags. type FlagSet struct { // Usage is the function called when an error occurs while parsing flags. @@ -127,26 +131,27 @@ type FlagSet struct { // a custom error handler. Usage func() - name string - parsed bool - actual map[string]*Flag - formal map[string]*Flag - shorthands map[byte]*Flag - args []string // arguments after flags - exitOnError bool // does the program exit if there's an error? - errorHandling ErrorHandling - output io.Writer // nil means stderr; use out() accessor - interspersed bool // allow interspersed option/non-option args + name string + parsed bool + actual map[normalizedName]*Flag + formal map[normalizedName]*Flag + shorthands map[byte]*Flag + args []string // arguments after flags + exitOnError bool // does the program exit if there's an error? + errorHandling ErrorHandling + output io.Writer // nil means stderr; use out() accessor + interspersed bool // allow interspersed option/non-option args + wordSeparators []string } // A Flag represents the state of a flag. type Flag struct { - Name string // name as it appears on command line - Shorthand string // one-letter abbreviated flag - Usage string // help message - Value Value // value as set - DefValue string // default value (as text); for usage message - Changed bool // If the user set the value (or if left to default) + Name string // name as it appears on command line + Shorthand string // one-letter abbreviated flag + Usage string // help message + Value Value // value as set + DefValue string // default value (as text); for usage message + Changed bool // If the user set the value (or if left to default) Annotations map[string][]string // used by cobra.Command bash autocomple code } @@ -159,21 +164,30 @@ type Value interface { } // sortFlags returns the flags as a slice in lexicographical sorted order. -func sortFlags(flags map[string]*Flag) []*Flag { +func sortFlags(flags map[normalizedName]*Flag) []*Flag { list := make(sort.StringSlice, len(flags)) i := 0 - for _, f := range flags { - list[i] = f.Name + for k := range flags { + list[i] = string(k) i++ } list.Sort() result := make([]*Flag, len(list)) for i, name := range list { - result[i] = flags[name] + result[i] = flags[normalizedName(name)] } return result } +func (f *FlagSet) normalizeFlagName(name string) normalizedName { + result := name + for _, sep := range f.wordSeparators { + result = strings.Replace(result, sep, "-", -1) + } + // Type convert to indicate normalization has been done. + return normalizedName(result) +} + func (f *FlagSet) out() io.Writer { if f.output == nil { return os.Stderr @@ -221,18 +235,24 @@ func Visit(fn func(*Flag)) { // Lookup returns the Flag structure of the named flag, returning nil if none exists. func (f *FlagSet) Lookup(name string) *Flag { + return f.lookup(f.normalizeFlagName(name)) +} + +// lookup returns the Flag structure of the named flag, returning nil if none exists. +func (f *FlagSet) lookup(name normalizedName) *Flag { return f.formal[name] } // Lookup returns the Flag structure of the named command-line flag, // returning nil if none exists. func Lookup(name string) *Flag { - return CommandLine.formal[name] + return CommandLine.Lookup(name) } // Set sets the value of the named flag. func (f *FlagSet) Set(name, value string) error { - flag, ok := f.formal[name] + normalName := f.normalizeFlagName(name) + flag, ok := f.formal[normalName] if !ok { return fmt.Errorf("no such flag -%v", name) } @@ -241,10 +261,10 @@ func (f *FlagSet) Set(name, value string) error { return err } if f.actual == nil { - f.actual = make(map[string]*Flag) + f.actual = make(map[normalizedName]*Flag) } - f.actual[name] = flag - f.Lookup(name).Changed = true + f.actual[normalName] = flag + f.lookup(normalName).Changed = true return nil } @@ -359,21 +379,27 @@ func (f *FlagSet) Var(value Value, name string, usage string) { // Like Var, but accepts a shorthand letter that can be used after a single dash. func (f *FlagSet) VarP(value Value, name, shorthand, usage string) { // Remember the default value as a string; it won't change. - flag := &Flag{name, shorthand, usage, value, value.String(), false, make(map[string][]string)} + flag := &Flag{ + Name: name, + Shorthand: shorthand, + Usage: usage, + Value: value, + DefValue: value.String(), + } f.AddFlag(flag) } func (f *FlagSet) AddFlag(flag *Flag) { - _, alreadythere := f.formal[flag.Name] + _, alreadythere := f.formal[f.normalizeFlagName(flag.Name)] if alreadythere { msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name) fmt.Fprintln(f.out(), msg) panic(msg) // Happens only if flags are declared with identical names } if f.formal == nil { - f.formal = make(map[string]*Flag) + f.formal = make(map[normalizedName]*Flag) } - f.formal[flag.Name] = flag + f.formal[f.normalizeFlagName(flag.Name)] = flag if len(flag.Shorthand) == 0 { return @@ -436,9 +462,9 @@ func (f *FlagSet) setFlag(flag *Flag, value string, origArg string) error { } // mark as visited for Visit() if f.actual == nil { - f.actual = make(map[string]*Flag) + f.actual = make(map[normalizedName]*Flag) } - f.actual[flag.Name] = flag + f.actual[f.normalizeFlagName(flag.Name)] = flag flag.Changed = true return nil } @@ -457,7 +483,7 @@ func (f *FlagSet) parseLongArg(s string, args []string) (a []string, err error) split := strings.SplitN(name, "=", 2) name = split[0] m := f.formal - flag, alreadythere := m[name] // BUG + flag, alreadythere := m[f.normalizeFlagName(name)] // BUG if !alreadythere { if name == "help" { // special case for nice help message. f.usage() @@ -507,7 +533,8 @@ func (f *FlagSet) parseShortArg(s string, args []string) (a []string, err error) continue } if i < len(shorthands)-1 { - if e := f.setFlag(flag, shorthands[i+1:], s); e != nil { + v := strings.TrimPrefix(shorthands[i+1:], "=") + if e := f.setFlag(flag, v, s); e != nil { err = e return } @@ -554,7 +581,7 @@ func (f *FlagSet) parseArgs(args []string) (err error) { args, err = f.parseShortArg(s, args) } if err != nil { - return + return } } return @@ -598,6 +625,19 @@ func SetInterspersed(interspersed bool) { CommandLine.SetInterspersed(interspersed) } +// SetWordSeparators sets a list of strings to be considerered as word +// separators and normalized for the pruposes of lookups. For example, if this +// is set to {"-", "_", "."} then --foo_bar, --foo-bar, and --foo.bar are +// considered equivalent flags. This must be called before flags are parsed, +// and may only be called once. +func (f *FlagSet) SetWordSeparators(separators []string) { + f.wordSeparators = separators + for k, v := range f.formal { + delete(f.formal, k) + f.formal[f.normalizeFlagName(string(k))] = v + } +} + // Parsed returns true if the command-line flags have been parsed. func Parsed() bool { return CommandLine.Parsed() diff --git a/Godeps/_workspace/src/github.com/spf13/pflag/flag_test.go b/Godeps/_workspace/src/github.com/spf13/pflag/flag_test.go index a33c601bc5..c4055ed96b 100644 --- a/Godeps/_workspace/src/github.com/spf13/pflag/flag_test.go +++ b/Godeps/_workspace/src/github.com/spf13/pflag/flag_test.go @@ -185,7 +185,8 @@ func TestShorthand(t *testing.T) { boolaFlag := f.BoolP("boola", "a", false, "bool value") boolbFlag := f.BoolP("boolb", "b", false, "bool2 value") boolcFlag := f.BoolP("boolc", "c", false, "bool3 value") - stringFlag := f.StringP("string", "s", "0", "string value") + stringaFlag := f.StringP("stringa", "s", "0", "string value") + stringzFlag := f.StringP("stringz", "z", "0", "string value") extra := "interspersed-argument" notaflag := "--i-look-like-a-flag" args := []string{ @@ -193,6 +194,7 @@ func TestShorthand(t *testing.T) { extra, "-cs", "hello", + "-z=something", "--", notaflag, } @@ -212,8 +214,11 @@ func TestShorthand(t *testing.T) { if *boolcFlag != true { t.Error("boolc flag should be true, is ", *boolcFlag) } - if *stringFlag != "hello" { - t.Error("string flag should be `hello`, is ", *stringFlag) + if *stringaFlag != "hello" { + t.Error("stringa flag should be `hello`, is ", *stringaFlag) + } + if *stringzFlag != "something" { + t.Error("stringz flag should be `something`, is ", *stringzFlag) } if len(f.Args()) != 2 { t.Error("expected one argument, got", len(f.Args())) @@ -233,6 +238,56 @@ func TestFlagSetParse(t *testing.T) { testParse(NewFlagSet("test", ContinueOnError), t) } +func testNormalizedNames(args []string, t *testing.T) { + f := NewFlagSet("normalized", ContinueOnError) + if f.Parsed() { + t.Error("f.Parse() = true before Parse") + } + withDashFlag := f.Bool("with-dash-flag", false, "bool value") + // Set this after some flags have been added and before others. + f.SetWordSeparators([]string{"-", "_"}) + withUnderFlag := f.Bool("with_under_flag", false, "bool value") + withBothFlag := f.Bool("with-both_flag", false, "bool value") + if err := f.Parse(args); err != nil { + t.Fatal(err) + } + if !f.Parsed() { + t.Error("f.Parse() = false after Parse") + } + if *withDashFlag != true { + t.Error("withDashFlag flag should be true, is ", *withDashFlag) + } + if *withUnderFlag != true { + t.Error("withUnderFlag flag should be true, is ", *withUnderFlag) + } + if *withBothFlag != true { + t.Error("withBothFlag flag should be true, is ", *withBothFlag) + } +} + +func TestNormalizedNames(t *testing.T) { + args := []string{ + "--with-dash-flag", + "--with-under-flag", + "--with-both-flag", + } + testNormalizedNames(args, t) + + args = []string{ + "--with_dash_flag", + "--with_under_flag", + "--with_both_flag", + } + testNormalizedNames(args, t) + + args = []string{ + "--with-dash_flag", + "--with-under_flag", + "--with-both_flag", + } + testNormalizedNames(args, t) +} + // Declare a user-defined flag type. type flagVar []string diff --git a/cmd/e2e/e2e.go b/cmd/e2e/e2e.go index 101d31304f..1135ef22e0 100644 --- a/cmd/e2e/e2e.go +++ b/cmd/e2e/e2e.go @@ -35,7 +35,7 @@ var ( cloudConfig = &context.CloudConfig orderseed = flag.Int64("orderseed", 0, "If non-zero, seed of random test shuffle order. (Otherwise random.)") - reportDir = flag.String("report_dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.") + reportDir = flag.String("report-dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.") times = flag.Int("times", 1, "Number of times each test is eligible to be run. Individual order is determined by shuffling --times instances of each test using --orderseed (like a multi-deck shoe of cards).") testList util.StringList ) @@ -45,16 +45,16 @@ func init() { flag.StringVar(&context.KubeConfig, clientcmd.RecommendedConfigPathFlag, "", "Path to kubeconfig containing embeded authinfo.") flag.StringVar(&context.KubeContext, clientcmd.FlagContext, "", "kubeconfig context to use/override. If unset, will use value from 'current-context'") - flag.StringVar(&context.AuthConfig, "auth_config", "", "Path to the auth info file.") - flag.StringVar(&context.CertDir, "cert_dir", "", "Path to the directory containing the certs. Default is empty, which doesn't use certs.") + flag.StringVar(&context.AuthConfig, "auth-config", "", "Path to the auth info file.") + flag.StringVar(&context.CertDir, "cert-dir", "", "Path to the directory containing the certs. Default is empty, which doesn't use certs.") flag.StringVar(&context.Host, "host", "", "The host, or apiserver, to connect to") - flag.StringVar(&context.RepoRoot, "repo_root", "./", "Root directory of kubernetes repository, for finding test files. Default assumes working directory is repository root") + flag.StringVar(&context.RepoRoot, "repo-root", "./", "Root directory of kubernetes repository, for finding test files. Default assumes working directory is repository root") flag.StringVar(&context.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, vagrant, etc.)") // TODO: Flags per provider? Rename gce_project/gce_zone? - flag.StringVar(&cloudConfig.MasterName, "kube_master", "", "Name of the kubernetes master. Only required if provider is gce or gke") - flag.StringVar(&cloudConfig.ProjectID, "gce_project", "", "The GCE project being used, if applicable") - flag.StringVar(&cloudConfig.Zone, "gce_zone", "", "GCE zone being used, if applicable") + flag.StringVar(&cloudConfig.MasterName, "kube-master", "", "Name of the kubernetes master. Only required if provider is gce or gke") + flag.StringVar(&cloudConfig.ProjectID, "gce-project", "", "The GCE project being used, if applicable") + flag.StringVar(&cloudConfig.Zone, "gce-zone", "", "GCE zone being used, if applicable") } func main() { @@ -72,7 +72,7 @@ func main() { if context.Provider == "aws" { awsConfig := "[Global]\n" if cloudConfig.Zone == "" { - glog.Error("gce_zone must be specified for AWS") + glog.Error("--gce-zone must be specified for AWS") os.Exit(1) } awsConfig += fmt.Sprintf("Zone=%s\n", cloudConfig.Zone) diff --git a/cmd/hyperkube/hyperkube.go b/cmd/hyperkube/hyperkube.go index fefbde22f6..1d5511787c 100644 --- a/cmd/hyperkube/hyperkube.go +++ b/cmd/hyperkube/hyperkube.go @@ -70,6 +70,7 @@ func (hk *HyperKube) Flags() *pflag.FlagSet { if hk.baseFlags == nil { hk.baseFlags = pflag.NewFlagSet(hk.Name, pflag.ContinueOnError) hk.baseFlags.SetOutput(ioutil.Discard) + hk.baseFlags.SetWordSeparators([]string{"-", "_"}) hk.baseFlags.BoolVarP(&hk.helpFlagVal, "help", "h", false, "help for "+hk.Name) // These will add all of the "global" flags (defined with both the diff --git a/cmd/hyperkube/server.go b/cmd/hyperkube/server.go index 4c29f1df32..4bf5422f3a 100644 --- a/cmd/hyperkube/server.go +++ b/cmd/hyperkube/server.go @@ -68,6 +68,7 @@ func (s *Server) Flags() *pflag.FlagSet { if s.flags == nil { s.flags = pflag.NewFlagSet(s.Name(), pflag.ContinueOnError) s.flags.SetOutput(ioutil.Discard) + s.flags.SetWordSeparators([]string{"-", "_"}) } return s.flags } diff --git a/cmd/integration/integration.go b/cmd/integration/integration.go index a847b34aa0..10b0ca2560 100644 --- a/cmd/integration/integration.go +++ b/cmd/integration/integration.go @@ -948,9 +948,9 @@ func runSchedulerNoPhantomPodsTest(client *client.Client) { type testFunc func(*client.Client) func addFlags(fs *pflag.FlagSet) { - fs.StringVar(&apiVersion, "apiVersion", latest.Version, "API version that should be used by the client for communicating with the server") + fs.StringVar(&apiVersion, "api-version", latest.Version, "API version that should be used by the client for communicating with the server") fs.IntVar( - &maxConcurrency, "maxConcurrency", -1, "Maximum number of tests to be run simultaneously. Unlimited if set to negative.") + &maxConcurrency, "max-concurrency", -1, "Maximum number of tests to be run simultaneously. Unlimited if set to negative.") } func main() { diff --git a/cmd/kube-apiserver/app/server.go b/cmd/kube-apiserver/app/server.go index 7565987097..02831b96c6 100644 --- a/cmd/kube-apiserver/app/server.go +++ b/cmd/kube-apiserver/app/server.go @@ -120,67 +120,67 @@ func NewAPIServer() *APIServer { func (s *APIServer) AddFlags(fs *pflag.FlagSet) { // Note: the weird ""+ in below lines seems to be the only way to get gofmt to // arrange these text blocks sensibly. Grrr. - fs.IntVar(&s.InsecurePort, "insecure_port", s.InsecurePort, ""+ + fs.IntVar(&s.InsecurePort, "insecure-port", s.InsecurePort, ""+ "The port on which to serve unsecured, unauthenticated access. Default 8080. It is assumed "+ "that firewall rules are set up such that this port is not reachable from outside of "+ "the cluster and that port 443 on the cluster's public address is proxied to this "+ "port. This is performed by nginx in the default setup.") - fs.IntVar(&s.InsecurePort, "port", s.InsecurePort, "DEPRECATED: see --insecure_port instead") - fs.Var(&s.InsecureBindAddress, "insecure_bind_address", ""+ - "The IP address on which to serve the --insecure_port (set to 0.0.0.0 for all interfaces). "+ + fs.IntVar(&s.InsecurePort, "port", s.InsecurePort, "DEPRECATED: see --insecure-port instead") + fs.Var(&s.InsecureBindAddress, "insecure-bind-address", ""+ + "The IP address on which to serve the --insecure-port (set to 0.0.0.0 for all interfaces). "+ "Defaults to localhost.") - fs.Var(&s.InsecureBindAddress, "address", "DEPRECATED: see --insecure_bind_address instead") - fs.Var(&s.BindAddress, "bind_address", ""+ - "The IP address on which to serve the --read_only_port and --secure_port ports. This "+ + fs.Var(&s.InsecureBindAddress, "address", "DEPRECATED: see --insecure-bind-address instead") + fs.Var(&s.BindAddress, "bind-address", ""+ + "The IP address on which to serve the --read-only-port and --secure-port ports. This "+ "address must be reachable by the rest of the cluster. If blank, all interfaces will be used.") - fs.Var(&s.BindAddress, "public_address_override", "DEPRECATED: see --bind_address instead") - fs.IntVar(&s.ReadOnlyPort, "read_only_port", s.ReadOnlyPort, ""+ + fs.Var(&s.BindAddress, "public-address-override", "DEPRECATED: see --bind-address instead") + fs.IntVar(&s.ReadOnlyPort, "read-only-port", s.ReadOnlyPort, ""+ "The port on which to serve read-only resources. If 0, don't serve read-only "+ "at all. It is assumed that firewall rules are set up such that this port is "+ "not reachable from outside of the cluster.") - fs.IntVar(&s.SecurePort, "secure_port", s.SecurePort, ""+ + fs.IntVar(&s.SecurePort, "secure-port", s.SecurePort, ""+ "The port on which to serve HTTPS with authentication and authorization. If 0, "+ "don't serve HTTPS at all.") - fs.Float32Var(&s.APIRate, "api_rate", s.APIRate, "API rate limit as QPS for the read only port") - fs.IntVar(&s.APIBurst, "api_burst", s.APIBurst, "API burst amount for the read only port") - fs.StringVar(&s.TLSCertFile, "tls_cert_file", s.TLSCertFile, ""+ + fs.Float32Var(&s.APIRate, "api-rate", s.APIRate, "API rate limit as QPS for the read only port") + fs.IntVar(&s.APIBurst, "api-burst", s.APIBurst, "API burst amount for the read only port") + fs.StringVar(&s.TLSCertFile, "tls-cert-file", s.TLSCertFile, ""+ "File containing x509 Certificate for HTTPS. (CA cert, if any, concatenated after server cert). "+ - "If HTTPS serving is enabled, and --tls_cert_file and --tls_private_key_file are not provided, "+ + "If HTTPS serving is enabled, and --tls-cert-file and --tls-private-key-file are not provided, "+ "a self-signed certificate and key are generated for the public address and saved to /var/run/kubernetes.") - fs.StringVar(&s.TLSPrivateKeyFile, "tls_private_key_file", s.TLSPrivateKeyFile, "File containing x509 private key matching --tls_cert_file.") - fs.StringVar(&s.CertDirectory, "cert_dir", s.CertDirectory, "The directory where the TLS certs are located (by default /var/run/kubernetes). "+ - "If --tls_cert_file and --tls_private_key_file are provided, this flag will be ignored.") - fs.StringVar(&s.APIPrefix, "api_prefix", s.APIPrefix, "The prefix for API requests on the server. Default '/api'.") - fs.StringVar(&s.StorageVersion, "storage_version", s.StorageVersion, "The version to store resources with. Defaults to server preferred") - 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.DurationVar(&s.EventTTL, "event_ttl", s.EventTTL, "Amount of time to retain events. Default 1 hour.") - fs.StringVar(&s.ClientCAFile, "client_ca_file", s.ClientCAFile, "If set, any request presenting a client certificate signed by one of the authorities in the client_ca_file is authenticated with an identity corresponding to the CommonName of the client certificate.") - fs.StringVar(&s.TokenAuthFile, "token_auth_file", s.TokenAuthFile, "If set, the file that will be used to secure the secure port of the API server via token authentication.") - fs.StringVar(&s.AuthorizationMode, "authorization_mode", s.AuthorizationMode, "Selects how to do authorization on the secure port. One of: "+strings.Join(apiserver.AuthorizationModeChoices, ",")) - fs.StringVar(&s.AuthorizationPolicyFile, "authorization_policy_file", s.AuthorizationPolicyFile, "File with authorization policy in csv format, used with --authorization_mode=ABAC, on the secure port.") - fs.StringVar(&s.AdmissionControl, "admission_control", s.AdmissionControl, "Ordered list of plug-ins to do admission control of resources into cluster. Comma-delimited list of: "+strings.Join(admission.GetPlugins(), ", ")) - fs.StringVar(&s.AdmissionControlConfigFile, "admission_control_config_file", s.AdmissionControlConfigFile, "File with admission control configuration.") - fs.Var(&s.EtcdServerList, "etcd_servers", "List of etcd servers to watch (http://ip:port), comma separated. Mutually exclusive with -etcd_config") - fs.StringVar(&s.EtcdConfigFile, "etcd_config", s.EtcdConfigFile, "The config file for the etcd client. Mutually exclusive with -etcd_servers.") - fs.StringVar(&s.EtcdPathPrefix, "etcd_prefix", s.EtcdPathPrefix, "The prefix for all resource paths in etcd.") - fs.Var(&s.CorsAllowedOriginList, "cors_allowed_origins", "List of allowed origins for CORS, comma separated. An allowed origin can be a regular expression to support subdomain matching. If this list is empty CORS will not be enabled.") - fs.BoolVar(&s.AllowPrivileged, "allow_privileged", s.AllowPrivileged, "If true, allow privileged containers.") - fs.Var(&s.PortalNet, "portal_net", "A CIDR notation IP range from which to assign portal IPs. This must not overlap with any IP ranges assigned to nodes for pods.") - fs.StringVar(&s.MasterServiceNamespace, "master_service_namespace", s.MasterServiceNamespace, "The namespace from which the kubernetes master services should be injected into pods") - fs.Var(&s.RuntimeConfig, "runtime_config", "A set of key=value pairs that describe runtime configuration that may be passed to the apiserver.") + fs.StringVar(&s.TLSPrivateKeyFile, "tls-private-key-file", s.TLSPrivateKeyFile, "File containing x509 private key matching --tls-cert-file.") + fs.StringVar(&s.CertDirectory, "cert-dir", s.CertDirectory, "The directory where the TLS certs are located (by default /var/run/kubernetes). "+ + "If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.") + fs.StringVar(&s.APIPrefix, "api-prefix", s.APIPrefix, "The prefix for API requests on the server. Default '/api'.") + fs.StringVar(&s.StorageVersion, "storage-version", s.StorageVersion, "The version to store resources with. Defaults to server preferred") + 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.DurationVar(&s.EventTTL, "event-ttl", s.EventTTL, "Amount of time to retain events. Default 1 hour.") + fs.StringVar(&s.ClientCAFile, "client-ca-file", s.ClientCAFile, "If set, any request presenting a client certificate signed by one of the authorities in the client-ca-file is authenticated with an identity corresponding to the CommonName of the client certificate.") + fs.StringVar(&s.TokenAuthFile, "token-auth-file", s.TokenAuthFile, "If set, the file that will be used to secure the secure port of the API server via token authentication.") + fs.StringVar(&s.AuthorizationMode, "authorization-mode", s.AuthorizationMode, "Selects how to do authorization on the secure port. One of: "+strings.Join(apiserver.AuthorizationModeChoices, ",")) + fs.StringVar(&s.AuthorizationPolicyFile, "authorization-policy-file", s.AuthorizationPolicyFile, "File with authorization policy in csv format, used with --authorization-mode=ABAC, on the secure port.") + fs.StringVar(&s.AdmissionControl, "admission-control", s.AdmissionControl, "Ordered list of plug-ins to do admission control of resources into cluster. Comma-delimited list of: "+strings.Join(admission.GetPlugins(), ", ")) + fs.StringVar(&s.AdmissionControlConfigFile, "admission-control-config-file", s.AdmissionControlConfigFile, "File with admission control configuration.") + fs.Var(&s.EtcdServerList, "etcd-servers", "List of etcd servers to watch (http://ip:port), comma separated. Mutually exclusive with -etcd-config") + fs.StringVar(&s.EtcdConfigFile, "etcd-config", s.EtcdConfigFile, "The config file for the etcd client. Mutually exclusive with -etcd-servers.") + fs.StringVar(&s.EtcdPathPrefix, "etcd-prefix", s.EtcdPathPrefix, "The prefix for all resource paths in etcd.") + fs.Var(&s.CorsAllowedOriginList, "cors-allowed-origins", "List of allowed origins for CORS, comma separated. An allowed origin can be a regular expression to support subdomain matching. If this list is empty CORS will not be enabled.") + fs.BoolVar(&s.AllowPrivileged, "allow-privileged", s.AllowPrivileged, "If true, allow privileged containers.") + fs.Var(&s.PortalNet, "portal-net", "A CIDR notation IP range from which to assign portal IPs. This must not overlap with any IP ranges assigned to nodes for pods.") + fs.StringVar(&s.MasterServiceNamespace, "master-service-namespace", s.MasterServiceNamespace, "The namespace from which the kubernetes master services should be injected into pods") + fs.Var(&s.RuntimeConfig, "runtime-config", "A set of key=value pairs that describe runtime configuration that may be passed to the apiserver.") client.BindKubeletClientConfigFlags(fs, &s.KubeletConfig) - fs.StringVar(&s.ClusterName, "cluster_name", s.ClusterName, "The instance prefix for the cluster") + fs.StringVar(&s.ClusterName, "cluster-name", s.ClusterName, "The instance prefix for the cluster") fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/") - fs.StringVar(&s.ExternalHost, "external_hostname", "", "The hostname to use when generating externalized URLs for this master (e.g. Swagger API Docs.)") - fs.IntVar(&s.MaxRequestsInFlight, "max_requests_inflight", 400, "The maximum number of requests in flight at a given time. When the server exceeds this, it rejects requests. Zero for no limit.") - fs.StringVar(&s.LongRunningRequestRE, "long_running_request_regexp", "[.*\\/watch$][^\\/proxy.*]", "A regular expression matching long running requests which should be excluded from maximum inflight request handling.") + fs.StringVar(&s.ExternalHost, "external-hostname", "", "The hostname to use when generating externalized URLs for this master (e.g. Swagger API Docs.)") + fs.IntVar(&s.MaxRequestsInFlight, "max-requests-inflight", 400, "The maximum number of requests in flight at a given time. When the server exceeds this, it rejects requests. Zero for no limit.") + fs.StringVar(&s.LongRunningRequestRE, "long-running-request-regexp", "[.*\\/watch$][^\\/proxy.*]", "A regular expression matching long running requests which should be excluded from maximum inflight request handling.") } // TODO: Longer term we should read this from some config store, rather than a flag. func (s *APIServer) verifyPortalFlags() { if s.PortalNet.IP == nil { - glog.Fatal("No --portal_net specified") + glog.Fatal("No --portal-net specified") } } @@ -203,7 +203,7 @@ func (s *APIServer) Run(_ []string) error { s.verifyPortalFlags() if (s.EtcdConfigFile != "" && len(s.EtcdServerList) != 0) || (s.EtcdConfigFile == "" && len(s.EtcdServerList) == 0) { - glog.Fatalf("specify either --etcd_servers or --etcd_config") + glog.Fatalf("specify either --etcd-servers or --etcd-config") } capabilities.Initialize(capabilities.Capabilities{ diff --git a/cmd/kube-controller-manager/app/controllermanager.go b/cmd/kube-controller-manager/app/controllermanager.go index bb985ea14b..b3f052cdd6 100644 --- a/cmd/kube-controller-manager/app/controllermanager.go +++ b/cmd/kube-controller-manager/app/controllermanager.go @@ -108,39 +108,39 @@ func NewCMServer() *CMServer { 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.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") - fs.StringVar(&s.MinionRegexp, "minion_regexp", s.MinionRegexp, "If non empty, and --cloud_provider is specified, a regular expression for matching minion VMs.") - fs.DurationVar(&s.NodeSyncPeriod, "node_sync_period", s.NodeSyncPeriod, ""+ + 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") + fs.StringVar(&s.MinionRegexp, "minion-regexp", s.MinionRegexp, "If non empty, and --cloud-provider is specified, a regular expression for matching minion VMs.") + fs.DurationVar(&s.NodeSyncPeriod, "node-sync-period", s.NodeSyncPeriod, ""+ "The period for syncing nodes from cloudprovider. Longer periods will result in "+ "fewer calls to cloud provider, but may delay addition of new nodes to cluster.") - fs.DurationVar(&s.ResourceQuotaSyncPeriod, "resource_quota_sync_period", s.ResourceQuotaSyncPeriod, "The period for syncing quota usage status in the system") - fs.DurationVar(&s.NamespaceSyncPeriod, "namespace_sync_period", s.NamespaceSyncPeriod, "The period for syncing namespace life-cycle updates") - fs.DurationVar(&s.PVClaimBinderSyncPeriod, "pvclaimbinder_sync_period", s.PVClaimBinderSyncPeriod, "The period for syncing persistent volumes and persistent volume claims") - fs.BoolVar(&s.EnablePVCClaimBinder, "enable_alpha_pvclaimbinder", s.EnablePVCClaimBinder, "Optionally enable persistent volume claim binding. This feature is experimental and expected to change.") - fs.DurationVar(&s.PodEvictionTimeout, "pod_eviction_timeout", s.PodEvictionTimeout, "The grace peroid for deleting pods on failed nodes.") - fs.Float32Var(&s.DeletingPodsQps, "deleting_pods_qps", 0.1, "Number of nodes per second on which pods are deleted in case of node failure.") - fs.IntVar(&s.DeletingPodsBurst, "deleting_pods_burst", 10, "Number of nodes on which pods are bursty deleted in case of node failure. For more details look into RateLimiter.") - fs.IntVar(&s.RegisterRetryCount, "register_retry_count", s.RegisterRetryCount, ""+ - "The number of retries for initial node registration. Retry interval equals node_sync_period.") + fs.DurationVar(&s.ResourceQuotaSyncPeriod, "resource-quota-sync-period", s.ResourceQuotaSyncPeriod, "The period for syncing quota usage status in the system") + fs.DurationVar(&s.NamespaceSyncPeriod, "namespace-sync-period", s.NamespaceSyncPeriod, "The period for syncing namespace life-cycle updates") + fs.DurationVar(&s.PVClaimBinderSyncPeriod, "pvclaimbinder-sync-period", s.PVClaimBinderSyncPeriod, "The period for syncing persistent volumes and persistent volume claims") + fs.BoolVar(&s.EnablePVCClaimBinder, "enable-alpha-pvclaimbinder", s.EnablePVCClaimBinder, "Optionally enable persistent volume claim binding. This feature is experimental and expected to change.") + fs.DurationVar(&s.PodEvictionTimeout, "pod-eviction-timeout", s.PodEvictionTimeout, "The grace peroid for deleting pods on failed nodes.") + fs.Float32Var(&s.DeletingPodsQps, "deleting-pods-qps", 0.1, "Number of nodes per second on which pods are deleted in case of node failure.") + fs.IntVar(&s.DeletingPodsBurst, "deleting-pods-burst", 10, "Number of nodes on which pods are bursty deleted in case of node failure. For more details look into RateLimiter.") + fs.IntVar(&s.RegisterRetryCount, "register-retry-count", s.RegisterRetryCount, ""+ + "The number of retries for initial node registration. Retry interval equals node-sync-period.") fs.Var(&s.MachineList, "machines", "List of machines to schedule onto, comma separated.") - fs.BoolVar(&s.SyncNodeList, "sync_nodes", s.SyncNodeList, "If true, and --cloud_provider is specified, sync nodes from the cloud provider. Default true.") - fs.BoolVar(&s.SyncNodeStatus, "sync_node_status", s.SyncNodeStatus, + fs.BoolVar(&s.SyncNodeList, "sync-nodes", s.SyncNodeList, "If true, and --cloud-provider is specified, sync nodes from the cloud provider. Default true.") + fs.BoolVar(&s.SyncNodeStatus, "sync-node-status", s.SyncNodeStatus, "DEPRECATED. Does not have any effect now and it will be removed in a later release.") - fs.DurationVar(&s.NodeMonitorGracePeriod, "node_monitor_grace_period", 40*time.Second, + fs.DurationVar(&s.NodeMonitorGracePeriod, "node-monitor-grace-period", 40*time.Second, "Amount of time which we allow running Node to be unresponsive before marking it unhealty. "+ "Must be N times more than kubelet's nodeStatusUpdateFrequency, "+ "where N means number of retries allowed for kubelet to post node status.") - fs.DurationVar(&s.NodeStartupGracePeriod, "node_startup_grace_period", 60*time.Second, + fs.DurationVar(&s.NodeStartupGracePeriod, "node-startup-grace-period", 60*time.Second, "Amount of time which we allow starting Node to be unresponsive before marking it unhealty.") - fs.DurationVar(&s.NodeMonitorPeriod, "node_monitor_period", 5*time.Second, + fs.DurationVar(&s.NodeMonitorPeriod, "node-monitor-period", 5*time.Second, "The period for syncing NodeStatus in NodeController.") // TODO: Discover these by pinging the host machines, and rip out these flags. // TODO: in the meantime, use resource.QuantityFlag() instead of these - fs.Int64Var(&s.NodeMilliCPU, "node_milli_cpu", s.NodeMilliCPU, "The amount of MilliCPU provisioned on each node") - fs.Var(resource.NewQuantityFlagValue(&s.NodeMemory), "node_memory", "The amount of memory (in bytes) provisioned on each node") - fs.StringVar(&s.ClusterName, "cluster_name", s.ClusterName, "The instance prefix for the cluster") + fs.Int64Var(&s.NodeMilliCPU, "node-milli-cpu", s.NodeMilliCPU, "The amount of MilliCPU provisioned on each node") + fs.Var(resource.NewQuantityFlagValue(&s.NodeMemory), "node-memory", "The amount of memory (in bytes) provisioned on each node") + fs.StringVar(&s.ClusterName, "cluster-name", s.ClusterName, "The instance prefix for the cluster") fs.BoolVar(&s.EnableProfiling, "profiling", false, "Enable profiling via web interface host:port/debug/pprof/") fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)") fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.") @@ -148,7 +148,7 @@ func (s *CMServer) AddFlags(fs *pflag.FlagSet) { func (s *CMServer) verifyMinionFlags() { if !s.SyncNodeList && s.MinionRegexp != "" { - glog.Info("--minion_regexp is ignored by --sync_nodes=false") + glog.Info("--minion-regexp is ignored by --sync-nodes=false") } if s.CloudProvider == "" || s.MinionRegexp == "" { if len(s.MachineList) == 0 { @@ -157,7 +157,7 @@ func (s *CMServer) verifyMinionFlags() { return } if len(s.MachineList) != 0 { - glog.Info("--machines is overwritten by --minion_regexp") + glog.Info("--machines is overwritten by --minion-regexp") } } @@ -218,7 +218,7 @@ func (s *CMServer) Run(_ []string) error { } if s.SyncNodeStatus { - glog.Warning("DEPRECATION NOTICE: sync_node_status flag is being deprecated. It has no effect now and it will be removed in a future version.") + glog.Warning("DEPRECATION NOTICE: sync-node-status flag is being deprecated. It has no effect now and it will be removed in a future version.") } nodeController := nodecontroller.NewNodeController(cloud, s.MinionRegexp, s.MachineList, nodeResources, diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index e497251d37..d3380b9fe9 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -63,12 +63,12 @@ func NewProxyServer() *ProxyServer { // AddFlags adds flags for a specific ProxyServer to the specified FlagSet func (s *ProxyServer) AddFlags(fs *pflag.FlagSet) { - 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)") + 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)") fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)") - fs.IntVar(&s.HealthzPort, "healthz_port", s.HealthzPort, "The port to bind the health check server. Use 0 to disable.") - fs.Var(&s.HealthzBindAddress, "healthz_bind_address", "The IP address for the health check server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)") - 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]") - fs.StringVar(&s.ResourceContainer, "resource_container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).") + fs.IntVar(&s.HealthzPort, "healthz-port", s.HealthzPort, "The port to bind the health check server. Use 0 to disable.") + fs.Var(&s.HealthzBindAddress, "healthz-bind-address", "The IP address for the health check server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)") + 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]") + fs.StringVar(&s.ResourceContainer, "resource-container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).") fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.") } diff --git a/cmd/kube-version-change/version.go b/cmd/kube-version-change/version.go index db84e9d455..9e6936ea80 100644 --- a/cmd/kube-version-change/version.go +++ b/cmd/kube-version-change/version.go @@ -55,6 +55,7 @@ func isYAML(data []byte) bool { func main() { runtime.GOMAXPROCS(runtime.NumCPU()) + flag.CommandLine.SetWordSeparators([]string{"-", "_"}) flag.Parse() if *rewrite != "" { diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index b41848db01..baac8510fe 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -157,55 +157,55 @@ func NewKubeletServer() *KubeletServer { // AddFlags adds flags for a specific KubeletServer to the specified FlagSet func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&s.Config, "config", s.Config, "Path to the config file or directory of files") - fs.DurationVar(&s.SyncFrequency, "sync_frequency", s.SyncFrequency, "Max period between synchronizing running containers and config") - fs.DurationVar(&s.FileCheckFrequency, "file_check_frequency", s.FileCheckFrequency, "Duration between checking config files for new data") - fs.DurationVar(&s.HTTPCheckFrequency, "http_check_frequency", s.HTTPCheckFrequency, "Duration between checking http for new data") - fs.StringVar(&s.ManifestURL, "manifest_url", s.ManifestURL, "URL for accessing the container manifest") - fs.BoolVar(&s.EnableServer, "enable_server", s.EnableServer, "Enable the info server") + fs.DurationVar(&s.SyncFrequency, "sync-frequency", s.SyncFrequency, "Max period between synchronizing running containers and config") + fs.DurationVar(&s.FileCheckFrequency, "file-check-frequency", s.FileCheckFrequency, "Duration between checking config files for new data") + fs.DurationVar(&s.HTTPCheckFrequency, "http-check-frequency", s.HTTPCheckFrequency, "Duration between checking http for new data") + fs.StringVar(&s.ManifestURL, "manifest-url", s.ManifestURL, "URL for accessing the container manifest") + fs.BoolVar(&s.EnableServer, "enable-server", s.EnableServer, "Enable the info server") fs.Var(&s.Address, "address", "The IP address for the info server to serve on (set to 0.0.0.0 for all interfaces)") fs.UintVar(&s.Port, "port", s.Port, "The port for the info server to serve on") - fs.UintVar(&s.ReadOnlyPort, "read_only_port", s.ReadOnlyPort, "The read-only port for the info server to serve on (set to 0 to disable)") - fs.StringVar(&s.TLSCertFile, "tls_cert_file", s.TLSCertFile, ""+ + fs.UintVar(&s.ReadOnlyPort, "read-only-port", s.ReadOnlyPort, "The read-only port for the info server to serve on (set to 0 to disable)") + fs.StringVar(&s.TLSCertFile, "tls-cert-file", s.TLSCertFile, ""+ "File containing x509 Certificate for HTTPS. (CA cert, if any, concatenated after server cert). "+ "If --tls_cert_file and --tls_private_key_file are not provided, a self-signed certificate and key "+ "are generated for the public address and saved to the directory passed to --cert_dir.") - fs.StringVar(&s.TLSPrivateKeyFile, "tls_private_key_file", s.TLSPrivateKeyFile, "File containing x509 private key matching --tls_cert_file.") - fs.StringVar(&s.CertDirectory, "cert_dir", s.CertDirectory, "The directory where the TLS certs are located (by default /var/run/kubernetes). "+ + fs.StringVar(&s.TLSPrivateKeyFile, "tls-private-key-file", s.TLSPrivateKeyFile, "File containing x509 private key matching --tls_cert_file.") + fs.StringVar(&s.CertDirectory, "cert-dir", s.CertDirectory, "The directory where the TLS certs are located (by default /var/run/kubernetes). "+ "If --tls_cert_file and --tls_private_key_file are provided, this flag will be ignored.") - fs.StringVar(&s.HostnameOverride, "hostname_override", s.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.") - fs.StringVar(&s.PodInfraContainerImage, "pod_infra_container_image", s.PodInfraContainerImage, "The image whose network/ipc namespaces containers in each pod will use.") - fs.StringVar(&s.DockerEndpoint, "docker_endpoint", s.DockerEndpoint, "If non-empty, use this for the docker endpoint to communicate with") - fs.StringVar(&s.RootDirectory, "root_dir", s.RootDirectory, "Directory path for managing kubelet files (volume mounts,etc).") - fs.BoolVar(&s.AllowPrivileged, "allow_privileged", s.AllowPrivileged, "If true, allow containers to request privileged mode. [default=false]") - fs.StringVar(&s.HostNetworkSources, "host_network_sources", s.HostNetworkSources, "Comma-separated list of sources from which the Kubelet allows pods to use of host network. For all sources use \"*\" [default=\"file\"]") - fs.Float64Var(&s.RegistryPullQPS, "registry_qps", s.RegistryPullQPS, "If > 0, limit registry pull QPS to this value. If 0, unlimited. [default=0.0]") - fs.IntVar(&s.RegistryBurst, "registry_burst", s.RegistryBurst, "Maximum size of a bursty pulls, temporarily allows pulls to burst to this number, while still not exceeding registry_qps. Only used if --registry_qps > 0") + fs.StringVar(&s.HostnameOverride, "hostname-override", s.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.") + fs.StringVar(&s.PodInfraContainerImage, "pod-infra-container-image", s.PodInfraContainerImage, "The image whose network/ipc namespaces containers in each pod will use.") + fs.StringVar(&s.DockerEndpoint, "docker-endpoint", s.DockerEndpoint, "If non-empty, use this for the docker endpoint to communicate with") + fs.StringVar(&s.RootDirectory, "root-dir", s.RootDirectory, "Directory path for managing kubelet files (volume mounts,etc).") + fs.BoolVar(&s.AllowPrivileged, "allow-privileged", s.AllowPrivileged, "If true, allow containers to request privileged mode. [default=false]") + fs.StringVar(&s.HostNetworkSources, "host-network-sources", s.HostNetworkSources, "Comma-separated list of sources from which the Kubelet allows pods to use of host network. For all sources use \"*\" [default=\"file\"]") + fs.Float64Var(&s.RegistryPullQPS, "registry-qps", s.RegistryPullQPS, "If > 0, limit registry pull QPS to this value. If 0, unlimited. [default=0.0]") + fs.IntVar(&s.RegistryBurst, "registry-burst", s.RegistryBurst, "Maximum size of a bursty pulls, temporarily allows pulls to burst to this number, while still not exceeding registry_qps. Only used if --registry_qps > 0") fs.BoolVar(&s.RunOnce, "runonce", s.RunOnce, "If true, exit after spawning pods from local manifests or remote urls. Exclusive with --api_servers, and --enable-server") - fs.BoolVar(&s.EnableDebuggingHandlers, "enable_debugging_handlers", s.EnableDebuggingHandlers, "Enables server endpoints for log collection and local running of containers and commands") - fs.DurationVar(&s.MinimumGCAge, "minimum_container_ttl_duration", s.MinimumGCAge, "Minimum age for a finished container before it is garbage collected. Examples: '300ms', '10s' or '2h45m'") - fs.IntVar(&s.MaxPerPodContainerCount, "maximum_dead_containers_per_container", s.MaxPerPodContainerCount, "Maximum number of old instances of a container to retain per container. Each container takes up some disk space. Default: 5.") - fs.IntVar(&s.MaxContainerCount, "maximum_dead_containers", s.MaxContainerCount, "Maximum number of old instances of a containers to retain globally. Each container takes up some disk space. Default: 100.") - fs.StringVar(&s.AuthPath, "auth_path", s.AuthPath, "Path to .kubernetes_auth file, specifying how to authenticate to API server.") - fs.UintVar(&s.CadvisorPort, "cadvisor_port", s.CadvisorPort, "The port of the localhost cAdvisor endpoint") - fs.IntVar(&s.HealthzPort, "healthz_port", s.HealthzPort, "The port of the localhost healthz endpoint") - fs.Var(&s.HealthzBindAddress, "healthz_bind_address", "The IP address for the healthz server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)") - fs.IntVar(&s.OOMScoreAdj, "oom_score_adj", s.OOMScoreAdj, "The oom_score_adj value for kubelet process. Values must be within the range [-1000, 1000]") - fs.Var(&s.APIServerList, "api_servers", "List of Kubernetes API servers for publishing events, and reading pods and services. (ip:port), comma separated.") - fs.StringVar(&s.ClusterDomain, "cluster_domain", s.ClusterDomain, "Domain for this cluster. If set, kubelet will configure all containers to search this domain in addition to the host's search domains") - fs.StringVar(&s.MasterServiceNamespace, "master_service_namespace", s.MasterServiceNamespace, "The namespace from which the kubernetes master services should be injected into pods") - fs.Var(&s.ClusterDNS, "cluster_dns", "IP address for a cluster DNS server. If set, kubelet will configure all containers to use this for DNS resolution in addition to the host's DNS servers") - fs.DurationVar(&s.StreamingConnectionIdleTimeout, "streaming_connection_idle_timeout", 0, "Maximum time a streaming connection can be idle before the connection is automatically closed. Example: '5m'") - fs.DurationVar(&s.NodeStatusUpdateFrequency, "node_status_update_frequency", s.NodeStatusUpdateFrequency, "Specifies how often kubelet posts node status to master. Note: be cautious when changing the constant, it must work with nodeMonitorGracePeriod in nodecontroller. Default: 10s") - fs.IntVar(&s.ImageGCHighThresholdPercent, "image_gc_high_threshold", s.ImageGCHighThresholdPercent, "The percent of disk usage after which image garbage collection is always run. Default: 90%%") - fs.IntVar(&s.ImageGCLowThresholdPercent, "image_gc_low_threshold", s.ImageGCLowThresholdPercent, "The percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to. Default: 80%%") - fs.StringVar(&s.NetworkPluginName, "network_plugin", s.NetworkPluginName, " The name of the network plugin to be invoked for various events in kubelet/pod lifecycle") - 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.StringVar(&s.ResourceContainer, "resource_container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kubelet in (Default: /kubelet).") + fs.BoolVar(&s.EnableDebuggingHandlers, "enable-debugging-handlers", s.EnableDebuggingHandlers, "Enables server endpoints for log collection and local running of containers and commands") + fs.DurationVar(&s.MinimumGCAge, "minimum-container-ttl-duration", s.MinimumGCAge, "Minimum age for a finished container before it is garbage collected. Examples: '300ms', '10s' or '2h45m'") + fs.IntVar(&s.MaxPerPodContainerCount, "maximum-dead-containers-per-container", s.MaxPerPodContainerCount, "Maximum number of old instances of a container to retain per container. Each container takes up some disk space. Default: 5.") + fs.IntVar(&s.MaxContainerCount, "maximum-dead-containers", s.MaxContainerCount, "Maximum number of old instances of a containers to retain globally. Each container takes up some disk space. Default: 100.") + fs.StringVar(&s.AuthPath, "auth-path", s.AuthPath, "Path to .kubernetes_auth file, specifying how to authenticate to API server.") + fs.UintVar(&s.CadvisorPort, "cadvisor-port", s.CadvisorPort, "The port of the localhost cAdvisor endpoint") + fs.IntVar(&s.HealthzPort, "healthz-port", s.HealthzPort, "The port of the localhost healthz endpoint") + fs.Var(&s.HealthzBindAddress, "healthz-bind-address", "The IP address for the healthz server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)") + fs.IntVar(&s.OOMScoreAdj, "oom-score-adj", s.OOMScoreAdj, "The oom_score_adj value for kubelet process. Values must be within the range [-1000, 1000]") + fs.Var(&s.APIServerList, "api-servers", "List of Kubernetes API servers for publishing events, and reading pods and services. (ip:port), comma separated.") + fs.StringVar(&s.ClusterDomain, "cluster-domain", s.ClusterDomain, "Domain for this cluster. If set, kubelet will configure all containers to search this domain in addition to the host's search domains") + fs.StringVar(&s.MasterServiceNamespace, "master-service-namespace", s.MasterServiceNamespace, "The namespace from which the kubernetes master services should be injected into pods") + fs.Var(&s.ClusterDNS, "cluster-dns", "IP address for a cluster DNS server. If set, kubelet will configure all containers to use this for DNS resolution in addition to the host's DNS servers") + fs.DurationVar(&s.StreamingConnectionIdleTimeout, "streaming-connection-idle-timeout", 0, "Maximum time a streaming connection can be idle before the connection is automatically closed. Example: '5m'") + fs.DurationVar(&s.NodeStatusUpdateFrequency, "node-status-update-frequency", s.NodeStatusUpdateFrequency, "Specifies how often kubelet posts node status to master. Note: be cautious when changing the constant, it must work with nodeMonitorGracePeriod in nodecontroller. Default: 10s") + fs.IntVar(&s.ImageGCHighThresholdPercent, "image-gc-high-threshold", s.ImageGCHighThresholdPercent, "The percent of disk usage after which image garbage collection is always run. Default: 90%%") + fs.IntVar(&s.ImageGCLowThresholdPercent, "image-gc-low-threshold", s.ImageGCLowThresholdPercent, "The percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to. Default: 80%%") + fs.StringVar(&s.NetworkPluginName, "network-plugin", s.NetworkPluginName, " The name of the network plugin to be invoked for various events in kubelet/pod lifecycle") + 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.StringVar(&s.ResourceContainer, "resource-container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kubelet in (Default: /kubelet).") // Flags intended for testing, not recommended used in production environments. - fs.BoolVar(&s.ReallyCrashForTesting, "really_crash_for_testing", s.ReallyCrashForTesting, "If true, when panics occur crash. Intended for testing.") - fs.Float64Var(&s.ChaosChance, "chaos_chance", s.ChaosChance, "If > 0.0, introduce random client errors and latency. Intended for testing. [default=0.0]") + fs.BoolVar(&s.ReallyCrashForTesting, "really-crash-for-testing", s.ReallyCrashForTesting, "If true, when panics occur crash. Intended for testing.") + fs.Float64Var(&s.ChaosChance, "chaos-chance", s.ChaosChance, "If > 0.0, introduce random client errors and latency. Intended for testing. [default=0.0]") } // Run runs the specified KubeletServer. This should never exit. diff --git a/cmd/kubernetes/kubernetes.go b/cmd/kubernetes/kubernetes.go index c24e5a1abe..63b4bdddc7 100644 --- a/cmd/kubernetes/kubernetes.go +++ b/cmd/kubernetes/kubernetes.go @@ -55,15 +55,15 @@ import ( var ( addr = flag.String("addr", "127.0.0.1", "The address to use for the apiserver.") port = flag.Int("port", 8080, "The port for the apiserver to use.") - dockerEndpoint = flag.String("docker_endpoint", "", "If non-empty, use this for the docker endpoint to communicate with") - etcdServer = flag.String("etcd_server", "http://localhost:4001", "If non-empty, path to the set of etcd server to use") + dockerEndpoint = flag.String("docker-endpoint", "", "If non-empty, use this for the docker endpoint to communicate with") + etcdServer = flag.String("etcd-server", "http://localhost:4001", "If non-empty, path to the set of etcd server to use") // TODO: Discover these by pinging the host machines, and rip out these flags. - nodeMilliCPU = flag.Int64("node_milli_cpu", 1000, "The amount of MilliCPU provisioned on each node") - nodeMemory = flag.Int64("node_memory", 3*1024*1024*1024, "The amount of memory (in bytes) provisioned on each node") - masterServiceNamespace = flag.String("master_service_namespace", api.NamespaceDefault, "The namespace from which the kubernetes master services should be injected into pods") + nodeMilliCPU = flag.Int64("node-milli-cpu", 1000, "The amount of MilliCPU provisioned on each node") + nodeMemory = flag.Int64("node-memory", 3*1024*1024*1024, "The amount of memory (in bytes) provisioned on each node") + masterServiceNamespace = flag.String("master-service-namespace", api.NamespaceDefault, "The namespace from which the kubernetes master services should be injected into pods") enableProfiling = flag.Bool("profiling", false, "Enable profiling via web interface host:port/debug/pprof/") - deletingPodsQps = flag.Float32("deleting_pods_qps", 0.1, "") - deletingPodsBurst = flag.Int("deleting_pods_burst", 10, "") + deletingPodsQps = flag.Float32("deleting-pods-qps", 0.1, "") + deletingPodsBurst = flag.Int("deleting-pods-burst", 10, "") ) type delegateHandler struct { diff --git a/docs/kubectl.md b/docs/kubectl.md index 12eaad356c..c027af7e09 100644 --- a/docs/kubectl.md +++ b/docs/kubectl.md @@ -66,4 +66,4 @@ kubectl * [kubectl update](kubectl_update.md) - Update a resource by filename or stdin. * [kubectl version](kubectl_version.md) - Print the client and server version information. -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.641615471 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.529528989 +0000 UTC diff --git a/docs/kubectl_api-versions.md b/docs/kubectl_api-versions.md index c19dd3b1d3..66650fa970 100644 --- a/docs/kubectl_api-versions.md +++ b/docs/kubectl_api-versions.md @@ -50,4 +50,4 @@ kubectl api-versions ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.640579424 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.529124749 +0000 UTC diff --git a/docs/kubectl_cluster-info.md b/docs/kubectl_cluster-info.md index 9d7a9e4dcd..cb6b41dbb2 100644 --- a/docs/kubectl_cluster-info.md +++ b/docs/kubectl_cluster-info.md @@ -50,4 +50,4 @@ kubectl cluster-info ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.640382538 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.528967691 +0000 UTC diff --git a/docs/kubectl_config.md b/docs/kubectl_config.md index 2a247e9c52..2aa5dd00a0 100644 --- a/docs/kubectl_config.md +++ b/docs/kubectl_config.md @@ -63,4 +63,4 @@ kubectl config SUBCOMMAND * [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a kubeconfig file * [kubectl config view](kubectl_config_view.md) - displays Merged kubeconfig settings or a specified kubeconfig file. -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.640154327 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.528802509 +0000 UTC diff --git a/docs/kubectl_config_set-cluster.md b/docs/kubectl_config_set-cluster.md index 3f747caec5..ee112abf58 100644 --- a/docs/kubectl_config_set-cluster.md +++ b/docs/kubectl_config_set-cluster.md @@ -65,4 +65,4 @@ $ kubectl config set-cluster e2e --insecure-skip-tls-verify=true ### SEE ALSO * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.638291301 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.527769365 +0000 UTC diff --git a/docs/kubectl_config_set-context.md b/docs/kubectl_config_set-context.md index aef55a5b16..a0fa389140 100644 --- a/docs/kubectl_config_set-context.md +++ b/docs/kubectl_config_set-context.md @@ -58,4 +58,4 @@ $ kubectl config set-context gce --user=cluster-admin ### SEE ALSO * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.638842283 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.528131768 +0000 UTC diff --git a/docs/kubectl_config_set-credentials.md b/docs/kubectl_config_set-credentials.md index 39cd1a5ff8..ee1aee4ee7 100644 --- a/docs/kubectl_config_set-credentials.md +++ b/docs/kubectl_config_set-credentials.md @@ -78,4 +78,4 @@ $ kubectl set-credentials cluster-admin --client-certificate=~/.kube/admin.crt - ### SEE ALSO * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.638596132 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.527942873 +0000 UTC diff --git a/docs/kubectl_config_set.md b/docs/kubectl_config_set.md index 2f1c321115..037f53e87b 100644 --- a/docs/kubectl_config_set.md +++ b/docs/kubectl_config_set.md @@ -52,4 +52,4 @@ kubectl config set PROPERTY_NAME PROPERTY_VALUE ### SEE ALSO * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.639475859 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.528303344 +0000 UTC diff --git a/docs/kubectl_config_unset.md b/docs/kubectl_config_unset.md index 8047df8def..c1c99fab75 100644 --- a/docs/kubectl_config_unset.md +++ b/docs/kubectl_config_unset.md @@ -51,4 +51,4 @@ kubectl config unset PROPERTY_NAME ### SEE ALSO * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.639702273 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.528464868 +0000 UTC diff --git a/docs/kubectl_config_use-context.md b/docs/kubectl_config_use-context.md index 3a4f7ba6a4..2b8beacd2e 100644 --- a/docs/kubectl_config_use-context.md +++ b/docs/kubectl_config_use-context.md @@ -50,4 +50,4 @@ kubectl config use-context CONTEXT_NAME ### SEE ALSO * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.639928664 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.528626589 +0000 UTC diff --git a/docs/kubectl_config_view.md b/docs/kubectl_config_view.md index b52fa7768a..e0dfd7c607 100644 --- a/docs/kubectl_config_view.md +++ b/docs/kubectl_config_view.md @@ -73,4 +73,4 @@ $ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2 ### SEE ALSO * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.638011058 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.527582988 +0000 UTC diff --git a/docs/kubectl_create.md b/docs/kubectl_create.md index b0f5d95dd5..e694758fa7 100644 --- a/docs/kubectl_create.md +++ b/docs/kubectl_create.md @@ -63,4 +63,4 @@ $ cat pod.json | kubectl create -f - ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.633893126 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.52422236 +0000 UTC diff --git a/docs/kubectl_delete.md b/docs/kubectl_delete.md index cc343b9dbb..d4087b5dcb 100644 --- a/docs/kubectl_delete.md +++ b/docs/kubectl_delete.md @@ -81,4 +81,4 @@ $ kubectl delete pods --all ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.634491315 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.524590507 +0000 UTC diff --git a/docs/kubectl_describe.md b/docs/kubectl_describe.md index b83976fe61..29d123d889 100644 --- a/docs/kubectl_describe.md +++ b/docs/kubectl_describe.md @@ -63,4 +63,4 @@ $ kubectl describe pods/nginx ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.633584776 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.524047164 +0000 UTC diff --git a/docs/kubectl_exec.md b/docs/kubectl_exec.md index 7af2248d2e..4de0ffc651 100644 --- a/docs/kubectl_exec.md +++ b/docs/kubectl_exec.md @@ -64,4 +64,4 @@ $ kubectl exec -p 123456-7890 -c ruby-container -i -t -- bash -il ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.636226358 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.52551618 +0000 UTC diff --git a/docs/kubectl_expose.md b/docs/kubectl_expose.md index d777f261ba..c604c6126a 100644 --- a/docs/kubectl_expose.md +++ b/docs/kubectl_expose.md @@ -82,4 +82,4 @@ $ kubectl expose streamer --port=4100 --protocol=udp --service-name=video-stream ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.637486796 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.527149074 +0000 UTC diff --git a/docs/kubectl_get.md b/docs/kubectl_get.md index 993cf2bfdf..3f7446d355 100644 --- a/docs/kubectl_get.md +++ b/docs/kubectl_get.md @@ -85,4 +85,4 @@ $ kubectl get rc/web service/frontend pods/web-pod-13je7 ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.633184922 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.523839103 +0000 UTC diff --git a/docs/kubectl_label.md b/docs/kubectl_label.md index 112ed0fe5c..5b4d2da412 100644 --- a/docs/kubectl_label.md +++ b/docs/kubectl_label.md @@ -81,4 +81,4 @@ $ kubectl label pods foo bar- ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.637727935 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.527386643 +0000 UTC diff --git a/docs/kubectl_log.md b/docs/kubectl_log.md index 8a13e3c78b..027b8ef6a8 100644 --- a/docs/kubectl_log.md +++ b/docs/kubectl_log.md @@ -62,4 +62,4 @@ $ kubectl log -f 123456-7890 ruby-container ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.634970712 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.524938744 +0000 UTC diff --git a/docs/kubectl_namespace.md b/docs/kubectl_namespace.md index b5a0cb407e..6fd03526d7 100644 --- a/docs/kubectl_namespace.md +++ b/docs/kubectl_namespace.md @@ -53,4 +53,4 @@ kubectl namespace [namespace] ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.634703492 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.524751287 +0000 UTC diff --git a/docs/kubectl_port-forward.md b/docs/kubectl_port-forward.md index 5030b5494a..42e4d8473d 100644 --- a/docs/kubectl_port-forward.md +++ b/docs/kubectl_port-forward.md @@ -68,4 +68,4 @@ $ kubectl port-forward -p mypod 0:5000 ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.636454335 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.525691097 +0000 UTC diff --git a/docs/kubectl_proxy.md b/docs/kubectl_proxy.md index 7920e0f5c6..7f69bda388 100644 --- a/docs/kubectl_proxy.md +++ b/docs/kubectl_proxy.md @@ -65,4 +65,4 @@ $ kubectl proxy --api-prefix=k8s-api ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.636689051 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.525864716 +0000 UTC diff --git a/docs/kubectl_resize.md b/docs/kubectl_resize.md index 83b995f69c..2dd1889179 100644 --- a/docs/kubectl_resize.md +++ b/docs/kubectl_resize.md @@ -68,4 +68,4 @@ $ kubectl resize --current-replicas=2 --replicas=3 replicationcontrollers foo ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.635916597 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.52532658 +0000 UTC diff --git a/docs/kubectl_rolling-update.md b/docs/kubectl_rolling-update.md index 53757150f8..6577204b67 100644 --- a/docs/kubectl_rolling-update.md +++ b/docs/kubectl_rolling-update.md @@ -79,4 +79,4 @@ $ kubectl rolling-update frontend-v1 frontend-v2 --image=image:v2 ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-24 04:16:19.186748349 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.525154396 +0000 UTC diff --git a/docs/kubectl_run-container.md b/docs/kubectl_run-container.md index 1daf164e84..83af9746a7 100644 --- a/docs/kubectl_run-container.md +++ b/docs/kubectl_run-container.md @@ -78,4 +78,4 @@ $ kubectl run-container nginx --image=nginx --overrides='{ "apiVersion": "v1beta ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.636970945 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.526080215 +0000 UTC diff --git a/docs/kubectl_stop.md b/docs/kubectl_stop.md index 6090f70fa5..ff16d71850 100644 --- a/docs/kubectl_stop.md +++ b/docs/kubectl_stop.md @@ -72,4 +72,4 @@ $ kubectl stop -f path/to/resources ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.637194082 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.526923863 +0000 UTC diff --git a/docs/kubectl_update.md b/docs/kubectl_update.md index 3bd196f2bb..54961ea2b9 100644 --- a/docs/kubectl_update.md +++ b/docs/kubectl_update.md @@ -67,4 +67,4 @@ $ kubectl update pods my-pod --patch='{ "apiVersion": "v1beta1", "desiredState": ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.634205944 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.52440746 +0000 UTC diff --git a/docs/kubectl_version.md b/docs/kubectl_version.md index 735bd74bf4..7c84feabd7 100644 --- a/docs/kubectl_version.md +++ b/docs/kubectl_version.md @@ -51,4 +51,4 @@ kubectl version ### SEE ALSO * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-04-23 23:29:05.640847018 +0000 UTC +###### Auto generated by spf13/cobra at 2015-04-27 22:01:46.529297188 +0000 UTC diff --git a/hack/test-integration.sh b/hack/test-integration.sh index 01d253874d..7ed40f14f6 100755 --- a/hack/test-integration.sh +++ b/hack/test-integration.sh @@ -45,8 +45,8 @@ runTests() { kube::log::status "Running integration test scenario" - "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} --apiVersion="$1" \ - --maxConcurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}" + "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} --api-version="$1" \ + --max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}" cleanup } diff --git a/pkg/credentialprovider/gcp/jwt.go b/pkg/credentialprovider/gcp/jwt.go index 3cf7a7c71b..e7c1c5c20c 100644 --- a/pkg/credentialprovider/gcp/jwt.go +++ b/pkg/credentialprovider/gcp/jwt.go @@ -34,7 +34,7 @@ const ( ) var ( - flagJwtFile = pflag.String("google_json_key", "", + flagJwtFile = pflag.String("google-json-key", "", "The Google Cloud Platform Service Account JSON Key to use for authentication.") ) diff --git a/pkg/kubectl/cmd/util/factory.go b/pkg/kubectl/cmd/util/factory.go index baeafc1687..ae383c52b5 100644 --- a/pkg/kubectl/cmd/util/factory.go +++ b/pkg/kubectl/cmd/util/factory.go @@ -17,6 +17,7 @@ limitations under the License. package util import ( + "flag" "fmt" "io" "os" @@ -85,6 +86,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { mapper := kubectl.ShortcutExpander{latest.RESTMapper} flags := pflag.NewFlagSet("", pflag.ContinueOnError) + flags.SetWordSeparators([]string{"-", "_"}) clientConfig := optionalClientConfig if optionalClientConfig == nil { @@ -225,7 +227,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { // BindFlags adds any flags that are common to all kubectl sub commands. func (f *Factory) BindFlags(flags *pflag.FlagSet) { // any flags defined by external projects (not part of pflags) - util.AddAllFlagsToPFlagSet(flags) + util.AddFlagSetToPFlagSet(flag.CommandLine, flags) // This is necessary as github.com/spf13/cobra doesn't support "global" // pflags currently. See https://github.com/spf13/cobra/issues/44. diff --git a/pkg/util/flags.go b/pkg/util/flags.go index 80687267f9..87c3f38e1e 100644 --- a/pkg/util/flags.go +++ b/pkg/util/flags.go @@ -16,12 +16,11 @@ limitations under the License. package util -import ( - flag "github.com/spf13/pflag" -) +import "github.com/spf13/pflag" // InitFlags normalizes and parses the command line flags func InitFlags() { + pflag.CommandLine.SetWordSeparators([]string{"-", "_"}) AddAllFlagsToPFlags() - flag.Parse() + pflag.Parse() } diff --git a/pkg/util/logs.go b/pkg/util/logs.go index 2f331dcb62..8365add9b0 100644 --- a/pkg/util/logs.go +++ b/pkg/util/logs.go @@ -25,6 +25,7 @@ import ( "github.com/spf13/pflag" ) +// Uses _ instead of - to better align with glog flags. var logFlushFreq = pflag.Duration("log_flush_frequency", 5*time.Second, "Maximum number of seconds between log flushes") // TODO(thockin): This is temporary until we agree on log dirs and put those into each cmd. diff --git a/pkg/util/pflag_import.go b/pkg/util/pflag_import.go index fcef3175de..71a3523e6f 100644 --- a/pkg/util/pflag_import.go +++ b/pkg/util/pflag_import.go @@ -79,7 +79,7 @@ func (v *flagValueWrapper) IsBoolFlag() bool { // Imports a 'flag.Flag' into a 'pflag.FlagSet'. The "short" option is unset // and the type is inferred using reflection. -func AddFlagToPFlagSet(f *flag.Flag, fs *pflag.FlagSet) { +func addFlagToPFlagSet(f *flag.Flag, fs *pflag.FlagSet) { if fs.Lookup(f.Name) == nil { fs.Var(wrapFlagValue(f.Value), f.Name, f.Usage) } @@ -88,16 +88,11 @@ func AddFlagToPFlagSet(f *flag.Flag, fs *pflag.FlagSet) { // Adds all of the flags in a 'flag.FlagSet' package flags to a 'pflag.FlagSet'. func AddFlagSetToPFlagSet(fsIn *flag.FlagSet, fsOut *pflag.FlagSet) { fsIn.VisitAll(func(f *flag.Flag) { - AddFlagToPFlagSet(f, fsOut) + addFlagToPFlagSet(f, fsOut) }) } -// Adds all of the top level 'flag' package flags to a 'pflag.FlagSet'. -func AddAllFlagsToPFlagSet(fs *pflag.FlagSet) { - AddFlagSetToPFlagSet(flag.CommandLine, fs) -} - -// Add al of the top level 'flag' package flags to the top level 'pflag' flags. +// Add all of the top level 'flag' package flags to the top level 'pflag' flags. func AddAllFlagsToPFlags() { AddFlagSetToPFlagSet(flag.CommandLine, pflag.CommandLine) } diff --git a/plugin/cmd/kube-scheduler/app/server.go b/plugin/cmd/kube-scheduler/app/server.go index 9366e5a12a..3658e79c7e 100644 --- a/plugin/cmd/kube-scheduler/app/server.go +++ b/plugin/cmd/kube-scheduler/app/server.go @@ -70,8 +70,8 @@ func NewSchedulerServer() *SchedulerServer { 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.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.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/") fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)") fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")