Skip to content

Commit

Permalink
Merge pull request #99 from utilitywarehouse/empty-zone
Browse files Browse the repository at this point in the history
Handle scenarios where EndpointSlices are missing Zone
  • Loading branch information
ffilippopoulos authored Aug 30, 2023
2 parents eda8e41 + 1092e80 commit 1d489ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion xds/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,18 @@ func endpointSliceToClusterEndpoints(e *discoveryv1.EndpointSlice, priority uint
ceps := []EdsClusterEndpoints{}
for _, p := range e.Ports {
for _, ep := range e.Endpoints {
// In case there is no zone specified we should add a dummy value and still register the
// endpoint and serve it to clients. Then we can rely on an alert which checks the zone
// since this might affect routing algorithms.
zone := "none"
if ep.Zone != nil {
zone = *ep.Zone
}
ceps = append(ceps, EdsClusterEndpoints{
addresses: ep.Addresses,
port: *p.Port,
priority: priority,
zone: *ep.Zone,
zone: zone,
subzone: ep.TargetRef.Name, // This should be the respective pod name, hacky way to have separate localities per endpoint.
healthy: *ep.Conditions.Ready,
})
Expand Down

0 comments on commit 1d489ca

Please sign in to comment.