-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per-route options via CF cli #543
Changes from 19 commits
7922fda
d8dba25
026a39d
31b0e73
b1f33a5
7b24f44
11b90ca
ea118bc
6abfc03
bbfe478
516dcdb
41954bc
a595971
b593ca8
32d49f1
e57290d
4226c08
9180f00
907f00a
f711736
985c202
8645686
c823864
a654620
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,7 +3,7 @@ title: Configuring per-route options | |||||
owner: CF for VMs Networking | ||||||
--- | ||||||
|
||||||
By default, communication between Gorouter and backends is configured via general settings at the platform level. | ||||||
By default, communication between Gorouter and backends is configured through the general settings at the platform level. | ||||||
|
||||||
This topic describes how to specify per-route Gorouter options scoped at the application level. | ||||||
This greater granularity lets developers tailor optimal routing behavior for applications' unique load profiles or other requirements. | ||||||
|
@@ -36,41 +36,32 @@ To configure per-route load balancing for an application that has not yet been p | |||||
applications: | ||||||
- name: MY-APP | ||||||
routes: | ||||||
- route: MY-APP.EXAMPLE.COM | ||||||
- route: MY-HOST.EXAMPLE.COM | ||||||
options: | ||||||
loadbalancing: least-connection | ||||||
``` | ||||||
|
||||||
Where `MY-APP` is the name of your app and `MY-APP.EXAMPLE.COM` is the route you want to map to your app. | ||||||
Where `MY-APP` is the name of your app and `MY-HOST.EXAMPLE.COM` is the route you want to map to your app. | ||||||
|
||||||
1. Push the app with the manifest: | ||||||
|
||||||
``` | ||||||
cf push -f manifest.yml | ||||||
``` | ||||||
|
||||||
1. To confirm the setting, query the `routes` API endpoint for the app's route: | ||||||
### <a id="lb-update-curl"></a> Change Load Balancing of an Existing Route | ||||||
|
||||||
``` | ||||||
cf curl /v3/routes/?hosts=MY-APP | ||||||
``` | ||||||
|
||||||
Where `MY-APP` is the host attribute of the route. The response lists the chosen `loadbalancing` algorithm setting: | ||||||
To change the per-route `loadbalancing` option of an existing route, you can use the cli command, `update-route`. | ||||||
|
||||||
For example, to change an app route's algorithm from `least-connection` to `round-robin`, you can run the `update-route` command: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer to leave the explicit change description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But the command is not referring to |
||||||
|
||||||
``` | ||||||
"options": { | ||||||
"loadbalancing": "least-connection" | ||||||
} | ||||||
cf update-route EXAMPLE.COM --host MY-HOST --option loadbalancing=round-robin | ||||||
``` | ||||||
|
||||||
### <a id="lb-update-curl"></a> Change Load Balancing of an Existing App | ||||||
|
||||||
To change the per-route `loadbalancing` setting of an app that has already been pushed, `cf curl` the `/v3/routes` API. | ||||||
For example, to change an app route's algorithm from `least-connection` to `round-robin`: | ||||||
|
||||||
1. Execute a `PATCH` request to the targeted API endpoint: | ||||||
Alternatively, it is also possible to `cf curl` the `/v3/routes` API. | ||||||
Dariquest marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
1. Run the `PATCH` request to the targeted API endpoint: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
``` | ||||||
cf curl /v3/routes/GUID -X PATCH -H "Content-type: application/json" \ | ||||||
|
@@ -83,16 +74,67 @@ For example, to change an app route's algorithm from `least-connection` to `roun | |||||
|
||||||
Where `GUID` is the unique identifier for the route. | ||||||
|
||||||
1. To confirm the setting, query the `routes` API endpoint for the route: | ||||||
1. To confirm the option, query the `routes` API endpoint for the route: | ||||||
|
||||||
``` | ||||||
cf curl /v3/routes/GUID | ||||||
``` | ||||||
|
||||||
Where `GUID` is the unique identifier for the route. The response lists the new `round-robin` setting: | ||||||
Where `GUID` is the unique identifier for the route. | ||||||
|
||||||
The response lists the new `round-robin` option: | ||||||
|
||||||
``` | ||||||
"options": { | ||||||
"loadbalancing": "round-robin" | ||||||
} | ||||||
``` | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the doc for "confirm" from the update section. |
||||||
### <a id="lb-create-route"></a> Creating a Route with a specified Load Balancing Algorithm | ||||||
Dariquest marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
To create a route with a per-route `loadbalancing` option, you can use the cli command `create-route`. | ||||||
For example: | ||||||
|
||||||
``` | ||||||
cf create-route EXAMPLE.COM --host MY-HOST --option loadbalancing=round-robin | ||||||
``` | ||||||
Dariquest marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
### <a id="lb-map-route"></a> Mapping a New Route to an Existing App with a specified Load Balancing Algorithm | ||||||
Dariquest marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
To create and map a new route to an existing application with the per-route `loadbalancing` option, you can use the cli command `map-route`. | ||||||
|
||||||
For example: | ||||||
|
||||||
``` | ||||||
cf map-route MY-APP EXAMPLE.COM --hostname MY-HOST --option loadbalancing=round-robin | ||||||
``` | ||||||
|
||||||
Dariquest marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
<p class="note"> | ||||||
The command <code>map-route</code> supports the <code>--option</code> flag only for new routes. | ||||||
To update an existing route, the command <code>update-route</code> must be used as described before.</p> | ||||||
|
||||||
### <a id="lb-retrieve-route-options"></a> Retrieve Route Options | ||||||
|
||||||
To verify route options, you can query the route using the `route` command: | ||||||
Dariquest marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
``` | ||||||
cf route EXAMPLE.COM --hostname MY-HOST | ||||||
``` | ||||||
|
||||||
The response lists the chosen `loadbalancing` algorithm option, e.g. `least-connection`: | ||||||
|
||||||
``` | ||||||
options: {loadbalancing=least-connection} | ||||||
``` | ||||||
|
||||||
Alternatively, you can query the `routes` API endpoint for a route: | ||||||
|
||||||
``` | ||||||
cf curl /v3/routes/?hosts=MY-HOST | ||||||
``` | ||||||
|
||||||
Where `MY-HOST` is the host attribute of the route. The response lists the chosen `loadbalancing` algorithm option as well: | ||||||
|
||||||
``` | ||||||
"options": { | ||||||
"loadbalancing": "round-robin" | ||||||
} | ||||||
"options": {"loadbalancing": "least-connection"} | ||||||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency: