envoyproxy / envoyproxy/gateway

PreferSameNode unexpectedly acts like a PreferSameZone

Open
#9,537 3 comments 0 reactions 1 assignee Claimed by @jukie View on GitHub
area/envoy stale
Dominant language
Go
Stars
3k
Forks
864
Avg merge
1d 22h
Merged PRs (30d)
148

Description

*Description*:
I have a Service with `trafficDistribution: PreferSameNode`. After putting it behind Envoy Gateway I noticed each proxy only ever sends traffic to backend pods in its own zone. Through the gateway the value behaves exactly like `PreferSameZone`, even though I never asked for zone affinity.

Dug into the source and found the cause in `processPreferLocalZone()` (`internal/gatewayapi/route.go`):

```go
if trafficDist := svc.Spec.TrafficDistribution; trafficDist != nil {
return &ir.PreferLocalZone{
MinEndpointsThreshold: new(uint64(1)),
Force: &ir.ForceLocalZone{
MinEndpointsInZoneThreshold: new(uint32(1)),
},
}
}
```

It only checks that the field is set, never the value. So `PreferClose`, `PreferSameZone` and `PreferSameNode` all end up as the same thing: endpoints grouped into per-zone localities and `zone_aware_lb_config` with `force_local_zone.min_size: 1` on the cluster.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.