Skip to content

Commit

Permalink
do not create endpoints resource when the endpoints array is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmurret committed Nov 7, 2023
1 parent 2e4d96f commit 11701af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
5 changes: 5 additions & 0 deletions agent/xds/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ func (s *ResourceGenerator) endpointsFromDiscoveryChain(
continue // skip the cluster if we're still populating the snapshot
}

if len(endpointGroup.Endpoints) == 0 {
s.Logger.Trace("skipping endpoint generation because no endpoints found for target group", "cluster", clusterName)
continue // skip the cluster if we're still populating the snapshot
}

la := makeLoadAssignment(
s.Logger,
cfgSnap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@
]
}
]
},
{
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
"clusterName": "no-endpoints.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
"endpoints": [
{}
]
}
],
"typeUrl": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
Expand Down
7 changes: 0 additions & 7 deletions agent/xds/testdata/endpoints/transparent-proxy.latest.golden
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@
]
}
]
},
{
"@type": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
"clusterName": "no-endpoints.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
"endpoints": [
{}
]
}
],
"typeUrl": "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment",
Expand Down

0 comments on commit 11701af

Please sign in to comment.