Skip to content
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

Merged
merged 24 commits into from
Feb 6, 2025
Merged
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7922fda
Per-route options via CF cli
Dariquest Jan 31, 2025
d8dba25
Update custom-per-route-options.html.md.erb
Dariquest Jan 31, 2025
026a39d
Update custom-per-route-options.html.md.erb
Dariquest Jan 31, 2025
31b0e73
Merge branch 'master' into patch-1
Dariquest Feb 3, 2025
b1f33a5
Rename least-connections
Dariquest Feb 4, 2025
7b24f44
Fix indents + wording consistency (with doc set)
anita-flegg Feb 4, 2025
11b90ca
Merge branch 'master' into patch-1
Dariquest Feb 4, 2025
ea118bc
Update custom-per-route-options.html.md.erb
Dariquest Feb 5, 2025
6abfc03
Update custom-per-route-options.html.md.erb
Dariquest Feb 5, 2025
bbfe478
Update custom-per-route-options.html.md.erb
Dariquest Feb 5, 2025
516dcdb
Update custom-per-route-options.html.md.erb
Dariquest Feb 5, 2025
41954bc
Update custom-per-route-options.html.md.erb
Dariquest Feb 5, 2025
a595971
Update custom-per-route-options.html.md.erb
Dariquest Feb 5, 2025
b593ca8
Change Note to use note class
anita-flegg Feb 5, 2025
32d49f1
Rename host MY-APP to MY-HOST
Dariquest Feb 5, 2025
e57290d
Correct the chapter vars
Dariquest Feb 5, 2025
4226c08
Unification
Dariquest Feb 5, 2025
9180f00
Remove repeating route check sections
Dariquest Feb 5, 2025
907f00a
Chapter adjustments
Dariquest Feb 5, 2025
f711736
Last review round
Dariquest Feb 6, 2025
985c202
Add api way to create a route with a per-route option
Dariquest Feb 6, 2025
8645686
Tags correction
Dariquest Feb 6, 2025
c823864
word-level improvement
Dariquest Feb 6, 2025
a654620
add cf routes command doc
Dariquest Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 74 additions & 9 deletions custom-per-route-options.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -49,7 +49,15 @@ To configure per-route load balancing for an application that has not yet been p
cf push -f manifest.yml
```

1. To confirm the setting, query the `routes` API endpoint for the app's route:
2. To verify the setting, you can query the route using the cli route command:
Dariquest marked this conversation as resolved.
Show resolved Hide resolved
```
cf route MY-APP.EXAMPLE.COM
Dariquest marked this conversation as resolved.
Show resolved Hide resolved
```
The response lists the chosen `loadbalancing` algorithm option:
```
options: { loadbalancing: least-connection }
Dariquest marked this conversation as resolved.
Show resolved Hide resolved
```
Alternatively, you can query the `routes` API endpoint for the app's route:

```
cf curl /v3/routes/?hosts=MY-APP
Dariquest marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -66,11 +74,26 @@ To configure per-route load balancing for an application that has not yet been p

### <a id="lb-update-curl"></a> Change Load Balancing of an Existing App
Dariquest marked this conversation as resolved.
Show resolved Hide resolved

To change the per-route `loadbalancing` setting of an app that has already been pushed, `cf curl` the `/v3/routes` API.
To change the per-route `loadbalancing` setting of an app that has already been pushed, you can use the cli command, `update-route`.
Dariquest marked this conversation as resolved.
Show resolved Hide resolved

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:
1. Run the update-route command:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Run the update-route command:
Run the `update-route` command:

```
cf update-route MY-APP.EXAMPLE.COM --option=loadbalancing=round-robin
```
2. To verify the setting, you can query the route using the cli route command:
```
cf route MY-APP.EXAMPLE.COM
```

The response lists the changed `loadbalancing` algorithm option:
```
options: { loadbalancing: round-robin }
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. To verify the setting, you can query the route using the cli route command:
```
cf route MY-APP.EXAMPLE.COM
```
The response lists the changed `loadbalancing` algorithm option:
```
options: { loadbalancing: round-robin }
```

This is already described above. It might make sense to move the verify part to a whole new section.


Alternatively, it is also possible to `cf curl` the `/v3/routes` API.
1. Run the `PATCH` request to the targeted API endpoint:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Run the `PATCH` request to the targeted API endpoint:


```
cf curl /v3/routes/GUID -X PATCH -H "Content-type: application/json" \
Expand All @@ -83,16 +106,58 @@ 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:
2. To confirm the setting, 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` setting:

```
"options": {
"loadbalancing": "round-robin"
}
```

Dariquest marked this conversation as resolved.
Show resolved Hide resolved
### <a id="lb-update-curl"></a> Creating a Route with a specified Load Balancing Algorithm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### <a id="lb-update-curl"></a> Creating a Route with a specified Load Balancing Algorithm
### <a id="lb-create-curl"></a> Creating a Route with a specified Load Balancing Algorithm

To create a route with the per-route `loadbalancing` option, you can use the cli command `create-route`.
For example:

1. Run the create-route command:
```
cf create-route MY-APP.EXAMPLE.COM --option=loadbalancing=round-robin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cf create-route MY-APP.EXAMPLE.COM --option=loadbalancing=round-robin
cf create-route EXAMPLE.COM --hostname MY-APP --option loadbalancing=round-robin

```
Dariquest marked this conversation as resolved.
Show resolved Hide resolved
2. To verify the setting, you can query the route using the cli route command:
```
cf route MY-APP.EXAMPLE.COM
```

Dariquest marked this conversation as resolved.
Show resolved Hide resolved
The response lists the changed `loadbalancing` algorithm option:
```
options: { loadbalancing: round-robin }
```

Dariquest marked this conversation as resolved.
Show resolved Hide resolved
### <a id="lb-update-curl"></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 map a new route with the per-route `loadbalancing` option, you can use the cli command `map-route`.
Dariquest marked this conversation as resolved.
Show resolved Hide resolved
If the route does not exist, it will be created with the specified load-balancing option.
If the route does exist, the cli command `update-route` should be used as described before.
Dariquest marked this conversation as resolved.
Show resolved Hide resolved

For example:

1. Run a map-route command:
```
cf map-route MY-APP MY-APP.EXAMPLE.COM --option=loadbalancing=round-robin
Dariquest marked this conversation as resolved.
Show resolved Hide resolved
```
2. To verify the setting, you can query the route using the cli route command:
```
cf route MY-APP.EXAMPLE.COM
```

The response lists the changed `loadbalancing` algorithm option:
```
"options": {
"loadbalancing": "round-robin"
}
options: { loadbalancing: round-robin }
```
Dariquest marked this conversation as resolved.
Show resolved Hide resolved