diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index fa3b0906289..a0a920f3e0d 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -165,9 +165,9 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&o.CleanupAndExit, "cleanup", o.CleanupAndExit, "If true cleanup iptables and ipvs rules and exit.") - fs.Var(utilflag.IPVar{Val: &o.config.BindAddress}, "bind-address", "The IP address for the proxy server to serve on (set to '0.0.0.0' for all IPv4 interfaces and '::' for all IPv6 interfaces)") - fs.Var(utilflag.IPPortVar{Val: &o.config.HealthzBindAddress}, "healthz-bind-address", "The IP address with port for the health check server to serve on (set to '0.0.0.0:10256' for all IPv4 interfaces and '[::]:10256' for all IPv6 interfaces). Set empty to disable.") - fs.Var(utilflag.IPPortVar{Val: &o.config.MetricsBindAddress}, "metrics-bind-address", "The IP address with port for the metrics server to serve on (set to '0.0.0.0:10249' for all IPv4 interfaces and '[::]:10249' for all IPv6 interfaces). Set empty to disable.") + fs.Var(&utilflag.IPVar{Val: &o.config.BindAddress}, "bind-address", "The IP address for the proxy server to serve on (set to '0.0.0.0' for all IPv4 interfaces and '::' for all IPv6 interfaces)") + fs.Var(&utilflag.IPPortVar{Val: &o.config.HealthzBindAddress}, "healthz-bind-address", "The IP address with port for the health check server to serve on (set to '0.0.0.0:10256' for all IPv4 interfaces and '[::]:10256' for all IPv6 interfaces). Set empty to disable.") + fs.Var(&utilflag.IPPortVar{Val: &o.config.MetricsBindAddress}, "metrics-bind-address", "The IP address with port for the metrics server to serve on (set to '0.0.0.0:10249' for all IPv4 interfaces and '[::]:10249' for all IPv6 interfaces). Set empty to disable.") fs.BoolVar(&o.config.BindAddressHardFail, "bind-address-hard-fail", o.config.BindAddressHardFail, "If true kube-proxy will treat failure to bind to a port as fatal and exit") fs.Var(utilflag.PortRangeVar{Val: &o.config.PortRange}, "proxy-port-range", "Range of host ports (beginPort-endPort, single port or beginPort+offset, inclusive) that may be consumed in order to proxy service traffic. If (unspecified, 0, or 0-0) then ports will be randomly chosen.") fs.Var(&o.config.Mode, "proxy-mode", "Which proxy mode to use: 'userspace' (older) or 'iptables' (faster) or 'ipvs' or 'kernelspace' (windows). If blank, use the best-available proxy (currently iptables). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient, this always falls back to the userspace proxy.") diff --git a/cmd/kubelet/app/options/options.go b/cmd/kubelet/app/options/options.go index 8f096e4f277..5e2b5b7640e 100644 --- a/cmd/kubelet/app/options/options.go +++ b/cmd/kubelet/app/options/options.go @@ -405,7 +405,7 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig fs.DurationVar(&c.HTTPCheckFrequency.Duration, "http-check-frequency", c.HTTPCheckFrequency.Duration, "Duration between checking http for new data") fs.StringVar(&c.StaticPodURL, "manifest-url", c.StaticPodURL, "URL for accessing additional Pod specifications to run") fs.Var(cliflag.NewColonSeparatedMultimapStringString(&c.StaticPodURLHeader), "manifest-url-header", "Comma-separated list of HTTP headers to use when accessing the url provided to --manifest-url. Multiple headers with the same name will be added in the same order provided. This flag can be repeatedly invoked. For example: --manifest-url-header 'a:hello,b:again,c:world' --manifest-url-header 'b:beautiful'") - fs.Var(utilflag.IPVar{Val: &c.Address}, "address", "The IP address for the Kubelet to serve on (set to '0.0.0.0' or '::' for listening in all interfaces and IP families)") + fs.Var(&utilflag.IPVar{Val: &c.Address}, "address", "The IP address for the Kubelet to serve on (set to '0.0.0.0' or '::' for listening in all interfaces and IP families)") fs.Int32Var(&c.Port, "port", c.Port, "The port for the Kubelet to serve on.") fs.Int32Var(&c.ReadOnlyPort, "read-only-port", c.ReadOnlyPort, "The read-only port for the Kubelet to serve on with no authentication/authorization (set to 0 to disable)") diff --git a/pkg/util/flag/flags.go b/pkg/util/flag/flags.go index 5ecc283974e..63c48e413d6 100644 --- a/pkg/util/flag/flags.go +++ b/pkg/util/flag/flags.go @@ -50,7 +50,7 @@ type IPVar struct { } // Set sets the flag value -func (v IPVar) Set(s string) error { +func (v *IPVar) Set(s string) error { if len(s) == 0 { v.Val = nil return nil @@ -67,7 +67,7 @@ func (v IPVar) Set(s string) error { } // String returns the flag value -func (v IPVar) String() string { +func (v *IPVar) String() string { if v.Val == nil { return "" } @@ -75,7 +75,7 @@ func (v IPVar) String() string { } // Type gets the flag type -func (v IPVar) Type() string { +func (v *IPVar) Type() string { return "ip" } @@ -85,7 +85,7 @@ type IPPortVar struct { } // Set sets the flag value -func (v IPPortVar) Set(s string) error { +func (v *IPPortVar) Set(s string) error { if len(s) == 0 { v.Val = nil return nil @@ -119,7 +119,7 @@ func (v IPPortVar) Set(s string) error { } // String returns the flag value -func (v IPPortVar) String() string { +func (v *IPPortVar) String() string { if v.Val == nil { return "" } @@ -127,7 +127,7 @@ func (v IPPortVar) String() string { } // Type gets the flag type -func (v IPPortVar) Type() string { +func (v *IPPortVar) Type() string { return "ipport" } diff --git a/pkg/util/flag/flags_test.go b/pkg/util/flag/flags_test.go index 04daa8ddb2f..938715b3537 100644 --- a/pkg/util/flag/flags_test.go +++ b/pkg/util/flag/flags_test.go @@ -51,7 +51,7 @@ func TestIPVar(t *testing.T) { for _, tc := range testCases { fs := pflag.NewFlagSet("blah", pflag.PanicOnError) ip := defaultIP - fs.Var(IPVar{&ip}, "ip", "the ip") + fs.Var(&IPVar{&ip}, "ip", "the ip") var err error func() { @@ -145,7 +145,7 @@ func TestIPPortVar(t *testing.T) { for _, tc := range testCases { fs := pflag.NewFlagSet("blah", pflag.PanicOnError) ipport := defaultIPPort - fs.Var(IPPortVar{&ipport}, "ipport", "the ip:port") + fs.Var(&IPPortVar{&ipport}, "ipport", "the ip:port") var err error func() {