Skip to content

Commit 3e5915f

Browse files
perf: [NPM-WIN] only track updatepods on-node (#1743)
only track updatepods on-node
1 parent 8bbb99e commit 3e5915f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

npm/pkg/dataplane/dataplane.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ func (dp *DataPlane) AddToSets(setNames []*ipsets.IPSetMetadata, podMetadata *Po
134134
if err != nil {
135135
return fmt.Errorf("[DataPlane] error while adding to set: %w", err)
136136
}
137-
if dp.shouldUpdatePod() {
137+
138+
if dp.shouldUpdatePod() && podMetadata.NodeName == dp.nodeName {
138139
klog.Infof("[DataPlane] Updating Sets to Add for pod key %s", podMetadata.PodKey)
139140

140141
// lock updatePodCache while reading/modifying or setting the updatePod in the cache
@@ -162,7 +163,7 @@ func (dp *DataPlane) RemoveFromSets(setNames []*ipsets.IPSetMetadata, podMetadat
162163
return fmt.Errorf("[DataPlane] error while removing from set: %w", err)
163164
}
164165

165-
if dp.shouldUpdatePod() {
166+
if dp.shouldUpdatePod() && podMetadata.NodeName == dp.nodeName {
166167
klog.Infof("[DataPlane] Updating Sets to Remove for pod key %s", podMetadata.PodKey)
167168

168169
// lock updatePodCache while reading/modifying or setting the updatePod in the cache
@@ -213,6 +214,7 @@ func (dp *DataPlane) ApplyDataPlane() error {
213214
return fmt.Errorf("[DataPlane] error while applying IPSets: %w", err)
214215
}
215216

217+
// NOTE: ideally we won't refresh Pod Endpoints if the updatePodCache is empty
216218
if dp.shouldUpdatePod() {
217219
err := dp.refreshPodEndpoints()
218220
if err != nil {

0 commit comments

Comments
 (0)