Drop PendingChanges methods from change trackers, move into UpdateResults
This fixes a race condition where the tracker could be updated in between us calling .PendingChanges() and .Update().
This commit is contained in:
@@ -793,11 +793,6 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
klog.V(2).InfoS("SyncProxyRules complete", "elapsed", time.Since(start))
|
||||
}()
|
||||
|
||||
var serviceChanged, endpointsChanged sets.Set[string]
|
||||
if tryPartialSync {
|
||||
serviceChanged = proxier.serviceChanges.PendingChanges()
|
||||
endpointsChanged = proxier.endpointsChanges.PendingChanges()
|
||||
}
|
||||
serviceUpdateResult := proxier.svcPortMap.Update(proxier.serviceChanges)
|
||||
endpointUpdateResult := proxier.endpointsMap.Update(proxier.endpointsChanges)
|
||||
|
||||
@@ -1189,7 +1184,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
// then we can omit them from the restore input. However, we have to still
|
||||
// figure out how many chains we _would_ have written, to make the metrics
|
||||
// come out right, so we just compute them and throw them away.
|
||||
if tryPartialSync && !serviceChanged.Has(svcName.NamespacedName.String()) && !endpointsChanged.Has(svcName.NamespacedName.String()) {
|
||||
if tryPartialSync && !serviceUpdateResult.UpdatedServices.Has(svcName.NamespacedName) && !endpointUpdateResult.UpdatedServices.Has(svcName.NamespacedName) {
|
||||
natChains = skippedNatChains
|
||||
natRules = skippedNatRules
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user