Skip to content

W-13780290 Flex gateway v1 5 #530

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

Merged
merged 56 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
776f793
Update create-instance-task-flex.adoc
glenn-rodgers-sf Jun 24, 2023
b818330
Images
glenn-rodgers-sf Jun 24, 2023
cc5a319
Add traffic management section
glenn-rodgers-sf Jun 24, 2023
be37e2f
Edits
glenn-rodgers-sf Jun 24, 2023
9466de5
Edits
glenn-rodgers-sf Jun 26, 2023
4a8b4c3
Instructions
glenn-rodgers-sf Jun 26, 2023
82175dd
reorder
glenn-rodgers-sf Jun 26, 2023
116406e
edit
glenn-rodgers-sf Jun 26, 2023
0da493e
Rules table
glenn-rodgers-sf Jun 26, 2023
0c69059
Edits
glenn-rodgers-sf Jun 26, 2023
2b7d3ec
Edits
glenn-rodgers-sf Jun 26, 2023
c87f2bc
Edit
glenn-rodgers-sf Jun 26, 2023
e44d0ee
Edits
glenn-rodgers-sf Jun 26, 2023
6803bf1
edits
glenn-rodgers-sf Jun 26, 2023
1b9a54b
Edits
glenn-rodgers-sf Jun 26, 2023
71b7435
Edits
glenn-rodgers-sf Jun 26, 2023
0fb429c
Edits
glenn-rodgers-sf Jun 26, 2023
84b62f4
Typo
glenn-rodgers-sf Jun 27, 2023
3e13df6
typo
glenn-rodgers-sf Jun 27, 2023
59521c1
Policy availibility
glenn-rodgers-sf Jun 27, 2023
65fbfc1
Services
glenn-rodgers-sf Jun 29, 2023
81de337
Update modules/ROOT/pages/create-instance-task-flex.adoc
glenn-rodgers-sf Jun 30, 2023
2efa4fc
Apply suggestions from code review
glenn-rodgers-sf Jun 30, 2023
8bbd51f
Diane edits
glenn-rodgers-sf Jun 30, 2023
485b17d
Route order
glenn-rodgers-sf Jun 30, 2023
c4ef69b
Edits
glenn-rodgers-sf Jun 30, 2023
4589488
Merge pull request #526 from mulesoft/W-13680230-add-jp-edits
glenn-rodgers-sf Jun 30, 2023
6d37726
Apply suggestions from code review
glenn-rodgers-sf Jun 30, 2023
24a21d0
Update modules/ROOT/pages/create-instance-task-flex.adoc
glenn-rodgers-sf Jun 30, 2023
be49cf1
Update modules/ROOT/pages/create-instance-task-flex.adoc
glenn-rodgers-sf Jun 30, 2023
f0f33fd
Update modules/ROOT/pages/create-instance-task-flex.adoc
glenn-rodgers-sf Jun 30, 2023
f9d838f
Update modules/ROOT/pages/create-instance-task-flex.adoc
glenn-rodgers-sf Jun 30, 2023
afef588
Update modules/ROOT/pages/create-instance-task-flex.adoc
glenn-rodgers-sf Jun 30, 2023
fed4001
Diane edit
glenn-rodgers-sf Jun 30, 2023
46bb924
Edits
glenn-rodgers-sf Jun 30, 2023
181ec19
Merge branch 'flex-gateway-v1-5' into W-13513395-CM-traffic-managemen…
glenn-rodgers-sf Jun 30, 2023
d46bf45
Merge pull request #524 from mulesoft/W-13513395-CM-traffic-managemen…
glenn-rodgers-sf Jun 30, 2023
5324e5b
small edits
glenn-rodgers-sf Jun 30, 2023
5157404
Merge pull request #527 from mulesoft/fix-typos-gr
glenn-rodgers-sf Jun 30, 2023
c21432f
404 code
glenn-rodgers-sf Jul 6, 2023
b81c84b
Edits
glenn-rodgers-sf Jul 7, 2023
0c2d23a
Options-flex
glenn-rodgers-sf Jul 7, 2023
2355944
Edits
glenn-rodgers-sf Jul 7, 2023
c3ea467
image change
glenn-rodgers-sf Jul 7, 2023
ede3a4f
Edits
glenn-rodgers-sf Jul 7, 2023
4b253ec
Update modules/ROOT/pages/_partials/task-add-api-instance.adoc
glenn-rodgers-sf Jul 7, 2023
72a0b55
Merge pull request #528 from mulesoft/W-13725586-clarify-upstream-dow…
glenn-rodgers-sf Jul 10, 2023
daca08c
Merge branch 'v2.x' into flex-gateway-v1-5
glenn-rodgers-sf Jul 18, 2023
0de6fc4
Edit
glenn-rodgers-sf Jul 18, 2023
0493544
Upstream services
glenn-rodgers-sf Jul 18, 2023
4a6e41c
Edits
glenn-rodgers-sf Jul 18, 2023
21cd9c6
Edits
glenn-rodgers-sf Jul 18, 2023
da0bf30
Edits
glenn-rodgers-sf Jul 18, 2023
1da44a4
Merge pull request #531 from mulesoft/W-12992498-traffic-management-c…
glenn-rodgers-sf Jul 18, 2023
3bf2f40
New upstream image
glenn-rodgers-sf Jul 18, 2023
9e6d07f
image update
glenn-rodgers-sf Jul 18, 2023
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/ROOT/assets/images/trash-can-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions modules/ROOT/pages/_partials/task-add-api-instance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ instance.

When you are promoting or importing an API instance, you do not have options to alter the configuration. However, when you add a new API instance, you need to the downstream and the upstream configuration settings.

The following diagram shows the relationship of the upstream and downstream configurations settings to your upstream service and the downstream consumer application. In this configuration, the downstream service is the service making API requests that are completed by the upstream service. These terms represent the direction of dependency, not the direction of information. A downstream service could make a `POST` request where it provides information to the upstream service. However, the downstream service is still dependent on the upstream service to complete the request.

image:api-upstream-downstream-config.png[The API instance is deployed on a gateway between the upstream and downstream configuration]

//end::intro2[]
11 changes: 11 additions & 0 deletions modules/ROOT/pages/_partials/task-configure-proxy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ NOTE: After adding the API on Anypoint Platform, you will need to bind it to a s
[arabic]
.. Enter a name for the new API asset.
//end::mid-steps[]
//tag::asset-type-options-flex[]
.. Select the **Asset type** from the following options:

** **REST API:** Select this option if you have a RAML or OAS API definition file you want to include for your asset.
+
Upload either a RAML or OAS file for your REST API. Versions 2.0.0 and later are the recommended versions for OAS or RAML specs, because these versions add native OAS support. If you upload an OAS API specification to an API proxy version 1.0 or earlier, your API specification is translated to RAML.
** **HTTP API:** Select this option if you do not have an API definition file you want to include for your asset.

.. Optionally, you can add an **AssetId** and customize the **Version** or **API Version** details by clicking **Advanced**.
. Click *Next*.
//end::asset-type--options-flex[]
//tag::asset-type-options[]
.. Select the **Asset type** from the following options:

Expand Down
127 changes: 125 additions & 2 deletions modules/ROOT/pages/create-instance-task-flex.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,143 @@ See xref:gateway::flex-install.adoc[Install Flex Gateway] and xref:gateway::flex

. Click *Next*.
+
include::partial$task-configure-proxy.adoc[tags=mid-steps;asset-type-options]
include::partial$task-configure-proxy.adoc[tags=mid-steps;asset-type-options-flex]

. Configure the downstream configuration settings:
+
include::partial$api-configuration-tables.adoc[tags=flex-downstream]
. Click *Next*.
. Configure the upstream configuration settings:
. Configure one of the following upstream configurations:
** *Single Upstream Service* +
For Flex Gateway versions 1.4.x or earlier or Flex Gateway version 1.5.x with a single upstream service, configure the following upstream configuration settings:
+
include::partial$api-configuration-tables.adoc[tags=flex-upstream]
** *Multiple Upstream Services* +
Flex Gateway version 1.5.x or later supports API instances that expose multiple upstream services through a single consumer endpoint. +
To configure multiple upstream services, see <<traffic-management>>.
. Click *Next*.
+
include::partial$task-configure-proxy.adoc[tags=last-steps]


[[traffic-management]]
== Multiple Upstream Services for Flex Gateway Running in Connected Mode

Flex Gateway version 1.5.x or later supports API instances that expose multiple upstream services through a single consumer endpoint.

Flex Gateway manages request traffic by using different routes that can each direct traffic to multiple upstream services. Flex Gateway directs traffic to the routes by using the route order and the individual route's rules. Additionally, you can add a weighted percentage to each upstream service within a route to manage the percentage of requests sent to the upstream service.

In the following diagram, different routes manage requests to flight information databases and to a customer service application. Route one has two upstream services defined, which direct 70% of requests to a stable database and 30% of requests to a beta database.

image:multiple-upstreams.png[Flex Gateway manages the traffic to multiple upstreams]

=== Routes

Each API instance supports up to 10 routes and each route can support up to 10 upstream services. Configure what requests a route can receive by defining route rules and a route order. At least one route per API instance is required.

Before adding additional routes, enter an optional *Route label* for clarity.

You can add additional routes by clicking *Add Route*, and you can delete routes by clicking the *Trash Can* icon (image:trash-can-icon.png[2%,2%]). If only one route is defined, you cannot delete that route.


==== Route Rules

You can direct requests to different routes by using route rules.

To view and edit route rules, click *Route Rules*.

All rules are optional. If a rule does not have a value, that rule is ignored. For example, not specifying a host means that the route can service any host if the request meets the other route rules. Not defining any rule means that the route can service every request.

Different routes can support the same upstream services. If you cannot capture all requests for a particular set of upstream services in a single route rule set, you can define multiple routes with different rules for full coverage.

Only requests that meet all of the rules defined in the ruleset are directed to that route. If a request does not meet the rules for any route, Flex Gateway returns a `404` error code.

Flex Gateway supports the following route rules:

Method::::
+
Defines the types of request methods that the route can service.
+
You can select multiple methods for each route. Only requests that are one of the defined methods are directed to this route.
+
To select the supported methods:
+
. Expand the *Method* drop down list.
. Select all supported methods.
. Collapse the drop down list.
+
Path::::
+
Defines the request path that the route can service.
+
You can define only one “URI Template Regex" path for a route. Only requests with the defined path are sent to this route.
+
To define the *Path* rule:
+
. Enter your path template in the *Path* configuration field.
+
Host::::
+
Defines the request host that the route can service.
+
You can define only one host URL for each route. Only requests made from the defined host are sent to this route.
+
To define the *Host* rule:
+
. Enter your host in the *Host* configuration field.
+
Header::::
+
Defines what headers and regular expression value must be present for this route to service the request.
+
For this rule, you define the header name and a regular expression value. Only requests that meet all of the specified header requirements are sent to this route. Additional headers present in the request that are not specifically defined in the rules are ignored.
+
You can define up to 10 headers.
+
To define the *Headers* rule:
+
. Click *Add header*, if this is not your first header.
. Enter the header name in the first box.
. Enter the header's regular expresion value in the second box.
+
NOTE: To delete a header, click the *Trash Can* icon (image:trash-can-icon.png[2%,2%]).

==== Route Order

In addition to using route rules, Flex Gateway directs requests to different routes by using the top to bottom order of how the routes appear on the page.

Flex Gateway directs requests to the first route if the request meets the route rules.

To define the route order, use the up and down arrows to arrange the routes.

Route ordering is very important when a request can meet the route rules of multiple routes. You should order the routes with more complex route rules first. If you do not define a route order, routes are ordered in the order they were created.

For example, in a configuration in which route one has the `GET` method defined as a rule and route two has no route rules defined, all `GET` requests are sent to route one and all other requests are sent to route two. If the route order was reversed and route one had no route rules, Flex Gateway would direct all requests to route one before any `GET` requests could reach route two.

=== Upstream Services

You can use multiple upstream services in a single route to direct requests to similar services. For example, to test the performance of a new beta upstream service without sending all traffic to the new service, you can direct half of the traffic to a stable upstream service and half to the new upstream service.

Each API instance route can support up to 10 upstream services, but at least one upstream service is required for each route.

What upstream service within the route each request is sent to is random and independent of any previous request. The upstream *Weight* defines the percentage chance of a request being sent to a particular upstream service.

Because any upstream service within a route can receive any request, all upstream services within the same route must adhere to the same API contract.

You can add an upstream service by clicking *Add Upstream*, and you can delete an upstream service by clicking the *Trash Can* icon (image:trash-can-icon.png[2%,2%]). If only one upstream service is defined, you cannot delete it.

Configure the following fields for each upstream service:

[%header%autowidth.spread,cols="15%,35%,15%,35%"]
|===
| Field Name | Description | Required | Notes
| *Upstream URL* | URL to access for the proxy or API. This must end with a `/`. | Yes | For example, you can use the URL of your API asset in Exchange.
| *Upstream Label* | Label for the upstream service | No | If you have multiple upstream service instances, add a label to each one to differentiate it from the others.
| *TLS* | TLS context used for the outbound traffic to the upstream service | No | xref:gateway::flex-conn-tls-config.adoc[Configure a TLS Context for Flex Gateway] before adding a TLS context to your API. Add a TLS context by clicking *Add TLS Context*.
| *Weight* | Percentage of requests to send to that upstream service | Yes | This value is configurable only if you have multiple upstream services. The sum of all upstream weights must equal `100%`.
|===



//promote-api
include::partial$task-promote-api.adoc[]
Expand Down