Set Per-route Sidecar Filters
Last updated
Was this helpful?
Last updated
Was this helpful?
The Grey Matter Route object offers the ability to configure on specific routes of a domain. Read the reference documentation on per route filter configuration .
This guide will walk through the steps of setting two different configurations of the Grey Matter on different routes. To demonstrate this, provides the files to deploy a fibonacci service and configure it into the mesh for testing. For a step by step guide on service deployment, see the or the . To test the per filter route configuration for observables on a service already existing in the mesh, skip to .
An existing Grey Matter deployment following the guide.
This guide assumes you've followed the step to configure a load balancer for ingress access to the mesh. If so, you should have a URL to access the Grey Matter Intelligence 360 application (e.g. a2832d300724811eaac960a7ca83e992-749721369.us-east-1.elb.amazonaws.com:10808
).
Make note of your load balancer ingress URL and use it wherever this guide references {your-gm-ingress-url}
.
setup with a running Fabric mesh.
Deploy and configure a Fibonacci service
Enable the Grey Matter observables filter
Enable per filter route configurations on a specific route
Deploy and configure a fibonacci service following the .
Before you move on to the next step of this guide, you should be able to see Fibonacci
on the dashboard and successfully connect to the service. The fibonacci service route will be at https:///{your-gm-ingress-url}:30000/services/fibonacci/
. You should see Alive
when you navigate to this route in a browser. Try https:///{your-gm-ingress-url}:30000/services/fibonacci/fibonacci/37
to get the 37th fibonacci in response, 24157817
.
Add the following configuration
Check the logs kubectl logs deployment/fibonacci sidecar -f
and hit the fibonacci endpoint https://{your-gm-ingress-url}/services/fibonacci/
in a browser, you should see something that looks like the following:
followed by the observable string of JSON.
Now we will configure and test per route filter configurations. To do this, we'll add a route from the fibonacci sidecar to the fibonacci service.
The route looks for the /fibonacci/37
path, so any request into the mesh at https://{your-gm-ingress-url}/services/fibonacci/fibonacci/37
, looking for exactly the 37th fibonacci number, will use this route.
Save this route in the /mesh directory as fibonacci-route-37.json
Follow the logs again kubectl logs deployment/fibonacci sidecar -f
.
First, hit any endpoint that isn't the 37th fibonacci number, try https://{your-gm-ingress-url}/services/fibonacci/
, or https://{your-gm-ingress-url}/services/fibonacci/fibonacci/18
. Since neither of those requests have path exactly equal to /fibonacci/37
, neither will correspond to the fibonacci-route-37
route. The observable printed for both of those requests in the fibonacci logs should be preceded with:
Now, watch the logs and make a request to the fibonacci-route-37
route - https://{your-gm-ingress-url}/services/fibonacci/fibonacci/37
. The observable JSON string should this time be preceded with:
Notice the route based config
log, as well as the emitFullResponse = true
for this route only. If you inspect the JSON of the observable you will also see thar it contains a field "body"
, with value "24157817\n"
, the full body of the response.
If you are using a non-SPIFFE/SPIRE deployment, follow instead.
Now we will turn on the observables filter for the Fibonacci service. The configuration that we add to the fibonacci-listener
object will enabled observables on all of the routes from it's domain. Make sure that the is set up.
Per route filter configurations are configured by the field of the route object. The filter configuration we will make for this route specifically is to turn emitFullResponse
in the observables filter to true. This means that for any request to https://{your-gm-ingress-url}/services/fibonacci/fibonacci/37
, the full response body will be printed in the observable.