mirror of https://github.com/grpc/grpc-java.git
xds: Allow unspecified listener traffic direction to work with Istio (#9173)
* Allow unspecified listener traffic direction to work with Istio
This commit is contained in:
parent
2c33e39f5d
commit
1d4e82e9ae
|
|
@ -385,7 +385,8 @@ final class ClientXdsClient extends XdsClient implements XdsResponseHandler, Res
|
||||||
Listener proto, Set<String> rdsResources, TlsContextManager tlsContextManager,
|
Listener proto, Set<String> rdsResources, TlsContextManager tlsContextManager,
|
||||||
FilterRegistry filterRegistry, Set<String> certProviderInstances, boolean parseHttpFilter)
|
FilterRegistry filterRegistry, Set<String> certProviderInstances, boolean parseHttpFilter)
|
||||||
throws ResourceInvalidException {
|
throws ResourceInvalidException {
|
||||||
if (!proto.getTrafficDirection().equals(TrafficDirection.INBOUND)) {
|
if (!proto.getTrafficDirection().equals(TrafficDirection.INBOUND)
|
||||||
|
&& !proto.getTrafficDirection().equals(TrafficDirection.UNSPECIFIED)) {
|
||||||
throw new ResourceInvalidException(
|
throw new ResourceInvalidException(
|
||||||
"Listener " + proto.getName() + " with invalid traffic direction: "
|
"Listener " + proto.getName() + " with invalid traffic direction: "
|
||||||
+ proto.getTrafficDirection());
|
+ proto.getTrafficDirection());
|
||||||
|
|
|
||||||
|
|
@ -2006,6 +2006,16 @@ public class ClientXdsClientDataTest {
|
||||||
listener, new HashSet<String>(), null, filterRegistry, null, true /* does not matter */);
|
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
|
@Test
|
||||||
public void parseServerSideListener_listenerFiltersPresent() throws ResourceInvalidException {
|
public void parseServerSideListener_listenerFiltersPresent() throws ResourceInvalidException {
|
||||||
Listener listener =
|
Listener listener =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue