Skip to content

Commit

Permalink
xds: Allow unspecified listener traffic direction to work with Istio (#…
Browse files Browse the repository at this point in the history
…9173)

* Allow unspecified listener traffic direction to work with Istio
  • Loading branch information
cfredri4 committed May 16, 2022
1 parent 2c33e39 commit 1d4e82e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xds/src/main/java/io/grpc/xds/ClientXdsClient.java
Expand Up @@ -385,7 +385,8 @@ static EnvoyServerProtoData.Listener parseServerSideListener(
Listener proto, Set<String> rdsResources, TlsContextManager tlsContextManager,
FilterRegistry filterRegistry, Set<String> certProviderInstances, boolean parseHttpFilter)
throws ResourceInvalidException {
if (!proto.getTrafficDirection().equals(TrafficDirection.INBOUND)) {
if (!proto.getTrafficDirection().equals(TrafficDirection.INBOUND)
&& !proto.getTrafficDirection().equals(TrafficDirection.UNSPECIFIED)) {
throw new ResourceInvalidException(
"Listener " + proto.getName() + " with invalid traffic direction: "
+ proto.getTrafficDirection());
Expand Down
10 changes: 10 additions & 0 deletions xds/src/test/java/io/grpc/xds/ClientXdsClientDataTest.java
Expand Up @@ -2006,6 +2006,16 @@ public void parseServerSideListener_invalidTrafficDirection() throws ResourceInv
listener, new HashSet<String>(), null, filterRegistry, null, true /* does not matter */);
}

@Test
public void parseServerSideListener_noTrafficDirection() throws ResourceInvalidException {
Listener listener =
Listener.newBuilder()
.setName("listener1")
.build();
ClientXdsClient.parseServerSideListener(
listener, new HashSet<String>(), null, filterRegistry, null, true /* does not matter */);
}

@Test
public void parseServerSideListener_listenerFiltersPresent() throws ResourceInvalidException {
Listener listener =
Expand Down

0 comments on commit 1d4e82e

Please sign in to comment.