Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Weighted Routing in PAS
Prerequisites
1. Check the "Enable Service Mesh" checkbox on the PAS 2.5 tile
2. Operators will have to configure the firewall, DNS and Load balancer settings to resolve the *.service-mesh.<app domain> to the IP of the
edge envoy.
3. Push a test app (app_v1) and map a route to it, this demo is using [Dora](https://github.com/cloudfoundry/cf-acceptance-tests/tree/master/assets/dora).
Preferably the test app can print out a version or an instance id. Dora has an endpoint that returns an instance id.
4. Push the test app as app_v2 with no route mapped to it initially
Steps for demo
1. curl the route mapped to the app_v1 with the `/id` or the version endpoint on your app to test which version of the app is being curled
2. Change the weight for v1 to 9 such that when you map a route to v2 with a weight of 1,. 90% of the traffic goes to v1. The CAPI v3 endpoints are [here](http://v3-apidocs.cloudfoundry.org/version/3.68.0/index.html#route-mappings)
cf curl /v3/route_mappings/$(echo "$(cf curl /v3/apps/$(cf app app-v1 --guid)/route_mappings | jq .resources[0].guid)" | tr -d '"') \
-X PATCH \
-d '{
"weight": 9
}'
3. Map route to v2
cf map-route app-v2 mesh.apps.sanpablo.cf-app.com --hostname dora
4. Increase weigth for v2 to send 75% of the traffic
cf curl /v3/route_mappings/$(echo "$(cf curl /v3/apps/$(cf app app-v2 --guid)/route_mappings | jq .resources[0].guid)" | tr -d '"') \
-X PATCH \
-d '{
"weight": 27
}'
5. Unmap v1 send 100% of the traffic to v2
cf unmap-route dora-v1 mesh.apps.sanpablo.cf-app.com --hostname dora
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.