fs.Var(componentconfig.IPVar{Val:&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.Int32Var(&s.HealthzPort,"healthz-port",s.HealthzPort,"The port to bind the health check server. Use 0 to disable.")
fs.Var(componentconfig.IPVar{Val:&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.Int32Var(s.OOMScoreAdj,"oom-score-adj",util.Int32PtrDerefOr(s.OOMScoreAdj,int32(qos.KubeProxyOOMScoreAdj)),"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.MarkDeprecated("resource-container","This feature will be removed in a later release.")
fs.StringVar(&s.Kubeconfig,"kubeconfig",s.Kubeconfig,"Path to kubeconfig file with authorization information (the master location is set by the master flag).")
fs.Var(componentconfig.PortRangeVar{Val:&s.PortRange},"proxy-port-range","Range of host ports (beginPort-endPort, inclusive) that may be consumed in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen.")
fs.StringVar(&s.HostnameOverride,"hostname-override",s.HostnameOverride,"If non-empty, will use this string as identification instead of the actual hostname.")
fs.Var(&s.Mode,"proxy-mode","Which proxy mode to use: 'userspace' (older) or 'iptables' (faster). 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.")
fs.Int32Var(s.IPTablesMasqueradeBit,"iptables-masquerade-bit",util.Int32PtrDerefOr(s.IPTablesMasqueradeBit,14),"If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].")
fs.DurationVar(&s.IPTablesSyncPeriod.Duration,"iptables-sync-period",s.IPTablesSyncPeriod.Duration,"The maximum interval of how often iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.")
fs.DurationVar(&s.IPTablesMinSyncPeriod.Duration,"iptables-min-sync-period",s.IPTablesMinSyncPeriod.Duration,"The minimum interval of how often the iptables rules can be refreshed as endpoints and services change (e.g. '5s', '1m', '2h22m').")
fs.DurationVar(&s.ConfigSyncPeriod,"config-sync-period",s.ConfigSyncPeriod,"How often configuration from the apiserver is refreshed. Must be greater than 0.")
fs.BoolVar(&s.MasqueradeAll,"masquerade-all",s.MasqueradeAll,"If using the pure iptables proxy, SNAT everything")
fs.StringVar(&s.ClusterCIDR,"cluster-cidr",s.ClusterCIDR,"The CIDR range of pods in the cluster. It is used to bridge traffic coming from outside of the cluster. If not provided, no off-cluster bridging will be performed.")
fs.BoolVar(&s.CleanupAndExit,"cleanup-iptables",s.CleanupAndExit,"If true cleanup iptables rules and exit.")
fs.StringVar(&s.ContentType,"kube-api-content-type",s.ContentType,"Content type of requests sent to apiserver.")
fs.Float32Var(&s.KubeAPIQPS,"kube-api-qps",s.KubeAPIQPS,"QPS to use while talking with kubernetes apiserver")
fs.Int32Var(&s.KubeAPIBurst,"kube-api-burst",s.KubeAPIBurst,"Burst to use while talking with kubernetes apiserver")
fs.DurationVar(&s.UDPIdleTimeout.Duration,"udp-timeout",s.UDPIdleTimeout.Duration,"How long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxy-mode=userspace")
"Minimum number of conntrack entries to allocate, regardless of conntrack-max-per-core (set conntrack-max-per-core=0 to leave the limit as-is).")
fs.DurationVar(&s.ConntrackTCPEstablishedTimeout.Duration,"conntrack-tcp-timeout-established",s.ConntrackTCPEstablishedTimeout.Duration,"Idle timeout for established TCP connections (0 to leave as-is)")
// Options contains everything necessary to create and run a proxy server.
clientclientset.Interface,
typeOptionsstruct{
eventClientv1core.EventsGetter,
// ConfigFile is the location of the proxy server's configuration file.
config*options.ProxyServerConfig,
ConfigFilestring
iptInterfaceutiliptables.Interface,
// CleanupAndExit, when true, makes the proxy server clean up iptables rules, then exit.
proxierproxy.ProxyProvider,
CleanupAndExitbool
broadcasterrecord.EventBroadcaster,
recorderrecord.EventRecorder,
// config is the proxy server's configuration object.
conntrackerConntracker,
config*componentconfig.KubeProxyConfiguration
proxyModestring,
)(*ProxyServer,error){
// The fields below here are placeholders for flags that can't be directly mapped into
return&ProxyServer{
// componentconfig.KubeProxyConfiguration.
Client:client,
//
EventClient:eventClient,
// TODO remove these fields once the deprecated flags are removed.
Config:config,
IptInterface:iptInterface,
// master is used to override the kubeconfig's URL to the apiserver.
Proxier:proxier,
masterstring
Broadcaster:broadcaster,
// healthzPort is the port to be used by the healthz server.
Recorder:recorder,
healthzPortint32
Conntracker:conntracker,
}
ProxyMode:proxyMode,
},nil
// AddFlags adds flags to fs and binds them to options.
funcAddFlags(options*Options,fs*pflag.FlagSet){
fs.StringVar(&options.ConfigFile,"config",options.ConfigFile,"The path to the configuration file.")
fs.BoolVar(&options.CleanupAndExit,"cleanup-iptables",options.CleanupAndExit,"If true cleanup iptables rules and exit.")
// All flags below here are deprecated and will eventually be removed.
fs.Var(componentconfig.IPVar{Val:&options.config.BindAddress},"bind-address","The IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)")
fs.StringVar(&options.master,"master",options.master,"The address of the Kubernetes API server (overrides any value in kubeconfig)")
fs.Int32Var(&options.healthzPort,"healthz-port",options.healthzPort,"The port to bind the health check server. Use 0 to disable.")
fs.Var(componentconfig.IPVar{Val:&options.config.HealthzBindAddress},"healthz-bind-address","The IP address and port for the health check server to serve on (set to 0.0.0.0 for all interfaces)")
fs.Int32Var(options.config.OOMScoreAdj,"oom-score-adj",util.Int32PtrDerefOr(options.config.OOMScoreAdj,int32(qos.KubeProxyOOMScoreAdj)),"The oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]")
fs.StringVar(&options.config.ResourceContainer,"resource-container",options.config.ResourceContainer,"Absolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).")
fs.MarkDeprecated("resource-container","This feature will be removed in a later release.")
fs.StringVar(&options.config.ClientConnection.KubeConfigFile,"kubeconfig",options.config.ClientConnection.KubeConfigFile,"Path to kubeconfig file with authorization information (the master location is set by the master flag).")
fs.Var(componentconfig.PortRangeVar{Val:&options.config.PortRange},"proxy-port-range","Range of host ports (beginPort-endPort, inclusive) that may be consumed in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen.")
fs.StringVar(&options.config.HostnameOverride,"hostname-override",options.config.HostnameOverride,"If non-empty, will use this string as identification instead of the actual hostname.")
fs.Var(&options.config.Mode,"proxy-mode","Which proxy mode to use: 'userspace' (older) or 'iptables' (faster). 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.")
fs.Int32Var(options.config.IPTables.MasqueradeBit,"iptables-masquerade-bit",util.Int32PtrDerefOr(options.config.IPTables.MasqueradeBit,14),"If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].")
fs.DurationVar(&options.config.IPTables.SyncPeriod.Duration,"iptables-sync-period",options.config.IPTables.SyncPeriod.Duration,"The maximum interval of how often iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.")
fs.DurationVar(&options.config.IPTables.MinSyncPeriod.Duration,"iptables-min-sync-period",options.config.IPTables.MinSyncPeriod.Duration,"The minimum interval of how often the iptables rules can be refreshed as endpoints and services change (e.g. '5s', '1m', '2h22m').")
fs.DurationVar(&options.config.ConfigSyncPeriod.Duration,"config-sync-period",options.config.ConfigSyncPeriod.Duration,"How often configuration from the apiserver is refreshed. Must be greater than 0.")
fs.BoolVar(&options.config.IPTables.MasqueradeAll,"masquerade-all",options.config.IPTables.MasqueradeAll,"If using the pure iptables proxy, SNAT everything")
fs.StringVar(&options.config.ClusterCIDR,"cluster-cidr",options.config.ClusterCIDR,"The CIDR range of pods in the cluster. It is used to bridge traffic coming from outside of the cluster. If not provided, no off-cluster bridging will be performed.")
fs.StringVar(&options.config.ClientConnection.ContentType,"kube-api-content-type",options.config.ClientConnection.ContentType,"Content type of requests sent to apiserver.")
fs.Float32Var(&options.config.ClientConnection.QPS,"kube-api-qps",options.config.ClientConnection.QPS,"QPS to use while talking with kubernetes apiserver")
fs.IntVar(&options.config.ClientConnection.Burst,"kube-api-burst",options.config.ClientConnection.Burst,"Burst to use while talking with kubernetes apiserver")
fs.DurationVar(&options.config.UDPIdleTimeout.Duration,"udp-timeout",options.config.UDPIdleTimeout.Duration,"How long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxy-mode=userspace")
"Minimum number of conntrack entries to allocate, regardless of conntrack-max-per-core (set conntrack-max-per-core=0 to leave the limit as-is).")
fs.DurationVar(&options.config.Conntrack.TCPEstablishedTimeout.Duration,"conntrack-tcp-timeout-established",options.config.Conntrack.TCPEstablishedTimeout.Duration,"Idle timeout for established TCP connections (0 to leave as-is)")