From 9440d17041afb56e8d65bb38ffdec4eb73c1279f Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Wed, 14 Oct 2015 21:48:35 -0400 Subject: [PATCH] Proxy resync period should not be 30 seconds --- cmd/kube-proxy/app/server.go | 15 +++++++++------ hack/verify-flags/known-flags.txt | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index e91dc6af38e..f740cce098e 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -60,7 +60,8 @@ type ProxyServerConfig struct { PortRange util.PortRange HostnameOverride string ProxyMode string - SyncPeriod time.Duration + IptablesSyncPeriod time.Duration + ConfigSyncPeriod time.Duration nodeRef *api.ObjectReference // Reference to this node. MasqueradeAll bool CleanupAndExit bool @@ -87,7 +88,8 @@ func (s *ProxyServerConfig) AddFlags(fs *pflag.FlagSet) { fs.Var(&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.StringVar(&s.ProxyMode, "proxy-mode", "", "Which proxy mode to use: 'userspace' (older, stable) or 'iptables' (experimental). If blank, look at the Node object on the Kubernetes API and respect the '"+experimentalProxyModeAnnotation+"' annotation if provided. Otherwise use the best-available proxy (currently userspace, but may change in future versions). 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.DurationVar(&s.SyncPeriod, "iptables-sync-period", s.SyncPeriod, "How often iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.") + fs.DurationVar(&s.IptablesSyncPeriod, "iptables-sync-period", s.IptablesSyncPeriod, "How often iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.") + 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", false, "If using the pure iptables proxy, SNAT everything") fs.BoolVar(&s.CleanupAndExit, "cleanup-iptables", false, "If true cleanup iptables rules and exit.") fs.Float32Var(&s.KubeApiQps, "kube-api-qps", s.KubeApiQps, "QPS to use while talking with kubernetes apiserver") @@ -115,7 +117,8 @@ func NewProxyConfig() *ProxyServerConfig { HealthzBindAddress: net.ParseIP("127.0.0.1"), OOMScoreAdj: qos.KubeProxyOOMScoreAdj, ResourceContainer: "/kube-proxy", - SyncPeriod: 30 * time.Second, + IptablesSyncPeriod: 30 * time.Second, + ConfigSyncPeriod: 15 * time.Minute, KubeApiQps: 5.0, KubeApiBurst: 10, } @@ -217,7 +220,7 @@ func NewProxyServerDefault(config *ProxyServerConfig) (*ProxyServer, error) { if useIptablesProxy { glog.V(2).Info("Using iptables Proxier.") - proxierIptables, err := iptables.NewProxier(iptInterface, execer, config.SyncPeriod, config.MasqueradeAll) + proxierIptables, err := iptables.NewProxier(iptInterface, execer, config.IptablesSyncPeriod, config.MasqueradeAll) if err != nil { glog.Fatalf("Unable to create proxier: %v", err) } @@ -234,7 +237,7 @@ func NewProxyServerDefault(config *ProxyServerConfig) (*ProxyServer, error) { // set EndpointsConfigHandler to our loadBalancer endpointsHandler = loadBalancer - proxierUserspace, err := userspace.NewProxier(loadBalancer, config.BindAddress, iptInterface, config.PortRange, config.SyncPeriod) + proxierUserspace, err := userspace.NewProxier(loadBalancer, config.BindAddress, iptInterface, config.PortRange, config.IptablesSyncPeriod) if err != nil { glog.Fatalf("Unable to create proxier: %v", err) } @@ -257,7 +260,7 @@ func NewProxyServerDefault(config *ProxyServerConfig) (*ProxyServer, error) { proxyconfig.NewSourceAPI( client, - 30*time.Second, + config.ConfigSyncPeriod, serviceConfig.Channel("api"), endpointsConfig.Channel("api"), ) diff --git a/hack/verify-flags/known-flags.txt b/hack/verify-flags/known-flags.txt index 5300b41d0d1..e9625c8f743 100644 --- a/hack/verify-flags/known-flags.txt +++ b/hack/verify-flags/known-flags.txt @@ -46,6 +46,7 @@ cluster-domain cluster-name cluster-tag concurrent-endpoint-syncs +config-sync-period configure-cbr0 contain-pod-resources container-port