Revert "Fix destination staleness issue when adding EndpointSlices (#12427)" (#12589)

This reverts commit 4fccf3e9ec.

The early return was causing `pp.addresses = newAddressSet` to not be run when the list of addresses is empty; but setting that is still necessary so that labels are tracked correctly.

This was caught by the tap (viz) integration test run in the release workflow.
This commit is contained in:
Alejandro Pedraza 2024-05-13 18:25:50 -05:00 committed by GitHub
parent ad49cd116f
commit 9bd8c005da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 9 deletions

View File

@ -795,18 +795,15 @@ func (pp *portPublisher) updateEndpoints(endpoints *corev1.Endpoints) {
func (pp *portPublisher) addEndpointSlice(slice *discovery.EndpointSlice) {
newAddressSet := pp.endpointSliceToAddresses(slice)
for id, addr := range pp.addresses.Addresses {
if _, ok := newAddressSet.Addresses[id]; !ok {
newAddressSet.Addresses[id] = addr
}
newAddressSet.Addresses[id] = addr
newAddressSet.LocalTrafficPolicy = pp.localTrafficPolicy
}
add, _ := diffAddresses(pp.addresses, newAddressSet)
if len(add.Addresses) == 0 {
return
}
for _, listener := range pp.listeners {
listener.Add(add)
if len(add.Addresses) > 0 {
for _, listener := range pp.listeners {
listener.Add(add)
}
}
pp.addresses = newAddressSet