If an iptables proxier sync fails, retry after iptablesSyncPeriod
This commit is contained in:
parent
4c5f4cb353
commit
2fd42dee95
@ -189,6 +189,7 @@ type Proxier struct {
|
|||||||
servicesSynced bool
|
servicesSynced bool
|
||||||
initialized int32
|
initialized int32
|
||||||
syncRunner *async.BoundedFrequencyRunner // governs calls to syncProxyRules
|
syncRunner *async.BoundedFrequencyRunner // governs calls to syncProxyRules
|
||||||
|
syncPeriod time.Duration
|
||||||
|
|
||||||
// These are effectively const and do not need the mutex to be held.
|
// These are effectively const and do not need the mutex to be held.
|
||||||
iptables utiliptables.Interface
|
iptables utiliptables.Interface
|
||||||
@ -301,6 +302,7 @@ func NewProxier(ipt utiliptables.Interface,
|
|||||||
serviceChanges: proxy.NewServiceChangeTracker(newServiceInfo, &isIPv6, recorder),
|
serviceChanges: proxy.NewServiceChangeTracker(newServiceInfo, &isIPv6, recorder),
|
||||||
endpointsMap: make(proxy.EndpointsMap),
|
endpointsMap: make(proxy.EndpointsMap),
|
||||||
endpointsChanges: proxy.NewEndpointChangeTracker(hostname, newEndpointInfo, &isIPv6, recorder, endpointSlicesEnabled),
|
endpointsChanges: proxy.NewEndpointChangeTracker(hostname, newEndpointInfo, &isIPv6, recorder, endpointSlicesEnabled),
|
||||||
|
syncPeriod: syncPeriod,
|
||||||
iptables: ipt,
|
iptables: ipt,
|
||||||
masqueradeAll: masqueradeAll,
|
masqueradeAll: masqueradeAll,
|
||||||
masqueradeMark: masqueradeMark,
|
masqueradeMark: masqueradeMark,
|
||||||
@ -722,6 +724,14 @@ func (proxier *Proxier) syncProxyRules() {
|
|||||||
|
|
||||||
klog.V(3).Info("Syncing iptables rules")
|
klog.V(3).Info("Syncing iptables rules")
|
||||||
|
|
||||||
|
success := false
|
||||||
|
defer func() {
|
||||||
|
if !success {
|
||||||
|
klog.Infof("Sync failed; retrying in %s", proxier.syncPeriod)
|
||||||
|
proxier.syncRunner.RetryAfter(proxier.syncPeriod)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// Create and link the kube chains.
|
// Create and link the kube chains.
|
||||||
for _, jump := range iptablesJumpChains {
|
for _, jump := range iptablesJumpChains {
|
||||||
if _, err := proxier.iptables.EnsureChain(jump.table, jump.dstChain); err != nil {
|
if _, err := proxier.iptables.EnsureChain(jump.table, jump.dstChain); err != nil {
|
||||||
@ -1437,6 +1447,8 @@ func (proxier *Proxier) syncProxyRules() {
|
|||||||
utilproxy.RevertPorts(replacementPortsMap, proxier.portsMap)
|
utilproxy.RevertPorts(replacementPortsMap, proxier.portsMap)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
success = true
|
||||||
|
|
||||||
for name, lastChangeTriggerTimes := range endpointUpdateResult.LastChangeTriggerTimes {
|
for name, lastChangeTriggerTimes := range endpointUpdateResult.LastChangeTriggerTimes {
|
||||||
for _, lastChangeTriggerTime := range lastChangeTriggerTimes {
|
for _, lastChangeTriggerTime := range lastChangeTriggerTimes {
|
||||||
latency := metrics.SinceInSeconds(lastChangeTriggerTime)
|
latency := metrics.SinceInSeconds(lastChangeTriggerTime)
|
||||||
|
Loading…
Reference in New Issue
Block a user