diff --git a/xds/src/main/java/com/linecorp/armeria/xds/XdsConverterUtil.java b/xds/src/main/java/com/linecorp/armeria/xds/XdsConverterUtil.java index bc61a78d50e..63152c7b146 100644 --- a/xds/src/main/java/com/linecorp/armeria/xds/XdsConverterUtil.java +++ b/xds/src/main/java/com/linecorp/armeria/xds/XdsConverterUtil.java @@ -84,13 +84,8 @@ private static List convertEndpoints(ClusterLoadAssignment clusterLoad private static boolean containsFilterMetadata(Struct filterMetadata, Struct endpointMetadata) { final Map endpointMetadataMap = endpointMetadata.getFieldsMap(); for (Entry 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; } } diff --git a/xds/src/main/java/com/linecorp/armeria/xds/XdsEndpointGroup.java b/xds/src/main/java/com/linecorp/armeria/xds/XdsEndpointGroup.java index 1dd0c4a49b9..993c2eb5001 100644 --- a/xds/src/main/java/com/linecorp/armeria/xds/XdsEndpointGroup.java +++ b/xds/src/main/java/com/linecorp/armeria/xds/XdsEndpointGroup.java @@ -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. @@ -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()); }