Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only send server updates to listeners when the opaque protocol changes #11907

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions controller/api/destination/watcher/endpoints_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,7 @@ func (pp *portPublisher) unsubscribe(listener EndpointUpdateListener) {
}

func (pp *portPublisher) updateServer(server *v1beta1.Server, selector labels.Selector, isAdd bool) {
updated := false
for id, address := range pp.addresses.Addresses {
if address.Pod != nil && selector.Matches(labels.Set(address.Pod.Labels)) {
var portMatch bool
Expand All @@ -1207,12 +1208,18 @@ func (pp *portPublisher) updateServer(server *v1beta1.Server, selector labels.Se
} else {
address.OpaqueProtocol = false
}
pp.addresses.Addresses[id] = address
if pp.addresses.Addresses[id].OpaqueProtocol != address.OpaqueProtocol {
pp.addresses.Addresses[id] = address
updated = true
}
}
}
}
for _, listener := range pp.listeners {
listener.Add(pp.addresses)
if updated {
for _, listener := range pp.listeners {
listener.Add(pp.addresses)
}
pp.metrics.incUpdates()
}
}

Expand Down
Loading