Skip to content

Commit

Permalink
Address comments from @jrhee17
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoox committed Feb 15, 2024
1 parent 0662f68 commit 584e37a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,8 @@ private static List<Endpoint> convertEndpoints(ClusterLoadAssignment clusterLoad
private static boolean containsFilterMetadata(Struct filterMetadata, Struct endpointMetadata) {
final Map<String, Value> endpointMetadataMap = endpointMetadata.getFieldsMap();
for (Entry<String, Value> entry : filterMetadata.getFieldsMap().entrySet()) {
final Value filterMetadataValue = entry.getValue();
if (filterMetadataValue == Value.getDefaultInstance()) {
// If the value is the default, consider they are the same.
continue;
}
final Value value = endpointMetadataMap.get(entry.getKey());
if (value == null || !value.equals(filterMetadataValue)) {
if (value == null || !value.equals(entry.getValue())) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment;
import io.envoyproxy.envoy.config.route.v3.Route;
import io.envoyproxy.envoy.config.route.v3.RouteAction;
import io.envoyproxy.envoy.config.route.v3.VirtualHost;

/**
* Provides a simple {@link EndpointGroup} which listens to an xDS cluster to select endpoints.
Expand Down Expand Up @@ -157,10 +156,9 @@ private void setEndpoints(EndpointSnapshot endpointSnapshot) {
}

private static Struct filterMetadata(ClusterSnapshot clusterSnapshot) {
final VirtualHost virtualHost = clusterSnapshot.virtualHost();
assert virtualHost != null;
final Route routes = virtualHost.getRoutes(0);
final RouteAction action = routes.getRoute();
final Route route = clusterSnapshot.route();
assert route != null;
final RouteAction action = route.getRoute();
return action.getMetadataMatch().getFilterMetadataOrDefault(SUBSET_LOAD_BALANCING_FILTER_NAME,
Struct.getDefaultInstance());
}
Expand Down

0 comments on commit 584e37a

Please sign in to comment.