Cloud Foundry realizes a service mesh

Crossroads

Using the Service Mesh

Once the Cloud Foundry service mesh has been installed successfully, the admin can create weighted routes. As mentioned before, the cf command-line tool does not yet support all commands, so admins have to run the commands directly against the Cloud Controller API with the help of the widely used Curl [3].

To begin, you need to create a route, which names a URL and thus makes it known to the main component in Cloud Foundry routing: the CFAR Gorouter:

# cf create-route development mesh.apps.anynines.com -n testapp

Note that the route is connected to a space at this point in time, but not to an application as yet. Associating a route with an application – route mapping – involves a separate step. First, however, you must take care of some preparatory work because integration is not complete. To begin, you must determine the route's GUID, which can be found in the resources[metadata] field (Listing 1, line 10).

Listing 1

Determining the Route GUID

01 $ cf curl /v2/routes?q=host:testapp
02 {
03   "total_results": 2,
04   "total_pages": 1,
05   "prev_url": null,
06   "next_url": null,
07   "resources": [
08     {
09       "metadata": {
10         "guid": "83d60b98-5864-45c6-94ad-4d02f5f4216a",
11         "url": "/v2/routes/83d60b98-5864-45c6-94ad-4d02f5f4216a",
12         "created_at": "2019-11-09T10:40:04Z",
13         "updated_at": "2019-11-09T10:40:04Z"
14       },
15       "entity": {
16         "host": "tired-duck-brash-civet",
17         "path": "",
18         "domain_guid": "fb6bd89f-2ed9-49d4-9ad1-97951a573135",
19         "space_guid": "d6cddaa6-0886-44b3-9590-16717d5cd3c2",
20         "service_instance_guid": null,
21         "port": null,
22         "domain_url": "/v2/shared_domains/fb6bd89f-2ed9-49d4-9ad1-97951a573135",
23         "space_url": "/v2/spaces/d6cddaa6-0886-44b3-9590-16717d5cd3c2",
24         "apps_url": "/v2/routes/83d60b98-5864-45c6-94ad-4d02f5f4216a/apps",
25         "route_mappings_url": "/v2/routes/83d60b98-5864-45c6-94ad-4d02f5f4216a/route_mappings"
26       }
27     }
28   ]
29 }

Creating a weighted route in the form of a route mapping also requires you to specify an application, which you reference through its GUID. The app GUID is easy to determine:

$ cf app testapp --guid a4238936-3f25-463b-4061-d3436e277be3

Now you can create the route mapping, which also includes weighting for the associated application (Listing 2). The weighting factor in this example is 2 , which means that this route weighting is twice that of a route with the default value 1 . The statistical distribution of the requests to the individual route mappings is calculated by simple averaging. The individual weighting factors of all mappings are divided by their sum, giving the relative distribution ratios. In the case of two routes with weightings of 1 and 2, the result is 1/3 to 2/3; 33 percent of the requests go to the first application and 66 percent to the second (Figure 2).

Listing 2

Route Mapping

$ curl /v3/route_mappings -X POST -d '{
  "relationships": {
    "app": {
      "guid": "a4238936-3f25-463b-4061-d3436e277be3"
    },
    "route": {
      "guid": "83d60b98-5864-45c6-94ad-4d02f5f4216a"
    }
  },
  "weight": 2
}'
Figure 2: Weighting governs the distribution of the load across application instances.

To complete the above example, you therefore need to create another application and route mapping with the steps presented here. More detailed information on creating and modifying weighted routes can be found in the Cloud Foundry documentation [4].

Conclusions

The introduction of the service mesh can be seen as the Cloud Foundry developers' response to increasing demand. Developers of microservice-based applications need tools such as weighted routes to meet modern product and software development requirements. Comparing the use cases that service mesh technologies such as Istio and Envoy enable in the context of Kubernetes, it is reasonable to assume that these will also follow in Cloud Foundry.

Weighted routing could be followed by support for the Circuit Breaker pattern, rate limiting, and outlier detection. When and how this will happen remains to be seen; CFAR may be adapted step by step. Alternatively, incubation projects from the Cloud Foundry Foundation such as Eirini [5] could facilitate adaptation if the existing CFAR container subsystem is replaced by a Kubernetes back end.

The Author

Julian Fischer is the CEO of Anynines, an established IT consulting company with a focus on platform solutions. As an expert in digital transformation, he has attended hundreds of IT conferences and given numerous keynote presentations. For more than 15 years, he has specialized in the planning and implementation of application platforms, with a special focus on database automation. His current focus is Cloud Foundry, BOSH, and Kubernetes.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs



Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>
	</a>

<hr>		    
			</div>
		    		</div>

		<div class=