Skip to content

Commit

Permalink
Merge pull request #1994 from sawsa307/change-duplicate-endpoints
Browse files Browse the repository at this point in the history
Update duplicate endpoint handling
  • Loading branch information
k8s-ci-robot authored Mar 14, 2023
2 parents 20d21e9 + d3403af commit 8e12b93
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/neg/syncers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,12 @@ func toZoneNetworkEndpointMap(eds []negtypes.EndpointsData, zoneGetter negtypes.
}
zoneNetworkEndpointMap[zone].Insert(networkEndpoint)

// increment the count for duplicated endpoint
if _, contains := networkEndpointPodMap[networkEndpoint]; contains {
// increment the count for duplicate endpoint
if existingPod, contains := networkEndpointPodMap[networkEndpoint]; contains {
dupCount += 1
if existingPod.Name < endpointAddress.TargetRef.Name {
continue // if existing name is alphabetically lower than current one, continue and don't replace
}
}
networkEndpointPodMap[networkEndpoint] = types.NamespacedName{Namespace: endpointAddress.TargetRef.Namespace, Name: endpointAddress.TargetRef.Name}
}
Expand Down

0 comments on commit 8e12b93

Please sign in to comment.