// proxyRun defines the interface to run a specified ProxyServer
// proxyRun defines the interface to run a specified ProxyServer
typeproxyRuninterface{
typeproxyRuninterface{
Run()error
Run()error
CleanupAndExit()error
}
}
// Options contains everything necessary to create and run a proxy server.
// Options contains everything necessary to create and run a proxy server.
...
@@ -166,6 +167,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
...
@@ -166,6 +167,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&o.config.IPVS.SyncPeriod.Duration,"ipvs-sync-period",o.config.IPVS.SyncPeriod.Duration,"The maximum interval of how often ipvs rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.")
fs.DurationVar(&o.config.IPVS.SyncPeriod.Duration,"ipvs-sync-period",o.config.IPVS.SyncPeriod.Duration,"The maximum interval of how often ipvs rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.")
fs.DurationVar(&o.config.IPVS.MinSyncPeriod.Duration,"ipvs-min-sync-period",o.config.IPVS.MinSyncPeriod.Duration,"The minimum interval of how often the ipvs rules can be refreshed as endpoints and services change (e.g. '5s', '1m', '2h22m').")
fs.DurationVar(&o.config.IPVS.MinSyncPeriod.Duration,"ipvs-min-sync-period",o.config.IPVS.MinSyncPeriod.Duration,"The minimum interval of how often the ipvs rules can be refreshed as endpoints and services change (e.g. '5s', '1m', '2h22m').")
fs.StringSliceVar(&o.config.IPVS.ExcludeCIDRs,"ipvs-exclude-cidrs",o.config.IPVS.ExcludeCIDRs,"A comma-separated list of CIDR's which the ipvs proxier should not touch when cleaning up IPVS rules.")
fs.StringSliceVar(&o.config.IPVS.ExcludeCIDRs,"ipvs-exclude-cidrs",o.config.IPVS.ExcludeCIDRs,"A comma-separated list of CIDR's which the ipvs proxier should not touch when cleaning up IPVS rules.")
fs.BoolVar(&o.config.IPVS.StrictARP,"ipvs-strict-arp",o.config.IPVS.StrictARP,"Enable strict ARP by setting arp_ignore to 1 and arp_announce to 2")
fs.DurationVar(&o.config.ConfigSyncPeriod.Duration,"config-sync-period",o.config.ConfigSyncPeriod.Duration,"How often configuration from the apiserver is refreshed. Must be greater than 0.")
fs.DurationVar(&o.config.ConfigSyncPeriod.Duration,"config-sync-period",o.config.ConfigSyncPeriod.Duration,"How often configuration from the apiserver is refreshed. Must be greater than 0.")
fs.BoolVar(&o.config.IPTables.MasqueradeAll,"masquerade-all",o.config.IPTables.MasqueradeAll,"If using the pure iptables proxy, SNAT all traffic sent via Service cluster IPs (this not commonly needed)")
fs.BoolVar(&o.config.IPTables.MasqueradeAll,"masquerade-all",o.config.IPTables.MasqueradeAll,"If using the pure iptables proxy, SNAT all traffic sent via Service cluster IPs (this not commonly needed)")
fs.StringVar(&o.config.ClusterCIDR,"cluster-cidr",o.config.ClusterCIDR,"The CIDR range of pods in the cluster. When configured, traffic sent to a Service cluster IP from outside this range will be masqueraded and traffic sent from pods to an external LoadBalancer IP will be directed to the respective cluster IP instead")
fs.StringVar(&o.config.ClusterCIDR,"cluster-cidr",o.config.ClusterCIDR,"The CIDR range of pods in the cluster. When configured, traffic sent to a Service cluster IP from outside this range will be masqueraded and traffic sent from pods to an external LoadBalancer IP will be directed to the respective cluster IP instead")
...
@@ -305,6 +307,11 @@ func (o *Options) Run() error {
...
@@ -305,6 +307,11 @@ func (o *Options) Run() error {
iferr!=nil{
iferr!=nil{
returnerr
returnerr
}
}
ifo.CleanupAndExit{
returnproxyServer.CleanupAndExit()
}
o.proxyServer=proxyServer
o.proxyServer=proxyServer
returno.runLoop()
returno.runLoop()
}
}
...
@@ -498,7 +505,6 @@ type ProxyServer struct {
...
@@ -498,7 +505,6 @@ type ProxyServer struct {
ConntrackerConntracker// if nil, ignored
ConntrackerConntracker// if nil, ignored
ProxyModestring
ProxyModestring
NodeRef*v1.ObjectReference
NodeRef*v1.ObjectReference
CleanupAndExitbool
CleanupIPVSbool
CleanupIPVSbool
MetricsBindAddressstring
MetricsBindAddressstring
EnableProfilingbool
EnableProfilingbool
...
@@ -550,19 +556,10 @@ func createClients(config componentbaseconfig.ClientConnectionConfiguration, mas
...
@@ -550,19 +556,10 @@ func createClients(config componentbaseconfig.ClientConnectionConfiguration, mas
}
}
// Run runs the specified ProxyServer. This should never exit (unless CleanupAndExit is set).
// Run runs the specified ProxyServer. This should never exit (unless CleanupAndExit is set).
// TODO: At the moment, Run() cannot return a nil error, otherwise it's caller will never exit. Update callers of Run to handle nil errors.
"Pod %q has been removed from pod manager. However, it still has one or more containers in the non-exited state. Therefore, it will not be removed from volume manager.",
"Pod %q still has one or more containers in the non-exited state. Therefore, it will not be removed from desired state.",
klog.V(4).Infof(volumeToMount.GenerateMsgDetailed("Actual state has not yet has this information skip removing volume from desired state",""))
klog.V(4).Infof(
volumeToMount.GenerateMsgDetailed(fmt.Sprintf("Actual state has not yet has this volume mounted information and pod (%q) still exists in pod manager, skip removing volume from desired state",
format.Pod(volumeToMount.Pod)),""))
continue
continue
}
}
klog.V(4).Infof(volumeToMount.GenerateMsgDetailed("Removing volume from desired state",""))
klog.V(4).Infof(volumeToMount.GenerateMsgDetailed("Removing volume from desired state",""))