Do we have implementation for ignoredServices and ignoredPatterns in gateway as in zuul?
The gateway isnt proactive like Zuul is and automatically creates routes based on service discovery they have to be explicitly configured (as far as I know). Can you provide an example of where this would be necessary?
I'd rather have some metadata that is set that would tell the integration to setup a route (edge=true) or something. @ryanjbaxter internal only services come to mind.
You can now specify an expression that works on the ServiceInstace to test if the particular service should be included in as a route.
Setting spring.cloud.gateway.discovery.locator.include-expression=metadata['edge'] == 'true' will test for a metadata field named edge whose value is true.
The gateway isnt proactive like Zuul is and automatically creates routes based on service discovery they have to be explicitly configured (as far as I know). Can you provide an example of where this would be necessary?
In my Zoo i have some services that should be gatewayed' and others that don't and should be ingnored-services as in zuul. How to achieve a functionality like in zuul?
You can now specify an expression that works on the ServiceInstace to test if the particular service should be included in as a route.
Setting spring.cloud.gateway.discovery.locator.include-expression=metadata['edge'] == 'true' will test for a metadata field named edge whose value is true.
You can now specify an expression that works on the ServiceInstace to test if the particular service should be included in as a route.
Setting spring.cloud.gateway.discovery.locator.include-expression=metadata['edge'] == 'true' will test for a metadata field named edge whose value is true.
im sorry, i don't get it.
e.g. if i have 3 services, eureka name: "backend", "stream", "oldbackend" and i want to include discovery of backend and stream, but not of oldbackend.. i would set:
spring.cloud.gateway.discovery.locator.include-expression=metadata['backend','stream'] == 'true'
?
No, you would include a bit of metadata in the discovery configuration of each service that you want in gateway such as 'edge=true'. Then gateway will only include those.
No, you would include a bit of metadata in the discovery configuration of each service that you want in gateway such as 'edge=true'. Then gateway will only include those.
i see.
.. so for my "backend" and "stream" service i'd do
spring:
cloud:
discovery:
client:
simple:
local:
metadata:
isongateway: true
in the bootstrap.yml of the backend and stream service and then check on the gateway via spring.cloud.gateway.discovery.locator.include-expression=metadata['isongateway']=='true' --- and all other services, though still discovered by eureka, are not reachable via gateway.
@spencergibb @ryanjbaxter this works nice, thanks for support. keep up the good work!
@spencergibb @ryanjbaxter What is about the IgnoredPatterns? There is some rest interface is internal in some service.
@xiaoshao if you have read thru this issue, you'll see that is not necessary and there is no ignore services in gateway
Most helpful comment
You can now specify an expression that works on the
ServiceInstaceto test if the particular service should be included in as a route.Setting
spring.cloud.gateway.discovery.locator.include-expression=metadata['edge'] == 'true'will test for a metadata field namededgewhose value istrue.