@ -7,6 +7,7 @@ English | [简体中文](./README-zh.md)
< img src = "./imgs/structs.png" alt = "multi-feature environment structure" / >
< img src = "./imgs/structs.png" alt = "multi-feature environment structure" / >
As shown in the figure above, there are three environments.
As shown in the figure above, there are three environments.
1. `baseline` environment, including `FrontService` , `MiddleService` , `BackendService`
1. `baseline` environment, including `FrontService` , `MiddleService` , `BackendService`
2. `feature1` environment, including `MiddleService` , `BackendService`
2. `feature1` environment, including `MiddleService` , `BackendService`
3. `feature2` environment, including `FrontService` , `BackendService`
3. `feature2` environment, including `FrontService` , `BackendService`
@ -14,16 +15,21 @@ As shown in the figure above, there are three environments.
And at the entrance, deploy the `gateway` service.
And at the entrance, deploy the `gateway` service.
Three request links.
Three request links.
1. `baseline` environment link, `Gateway` -> `FrontService` (baseline) -> `MiddleService` (baseline) -> `BackendService` (baseline)
2. `feature1` environment link, `Gateway` -> `FrontService` (baseline) -> `MiddleService` (feature1) -> `BackendService` (feature1)
3. `feature2` environment link, `Gateway` -> `FrontService` (feature2) -> `MiddleService` (baseline) -> `BackendService` (feature2)
1. `baseline` environment link, `Gateway` -> `FrontService` (baseline) -> `MiddleService` (baseline) -> `BackendService` (
baseline)
2. `feature1` environment link, `Gateway` -> `FrontService` (baseline) -> `MiddleService` (feature1) -> `BackendService` (
feature1)
3. `feature2` environment link, `Gateway` -> `FrontService` (feature2) -> `MiddleService` (baseline) -> `BackendService` (
feature2)
## II. Running
## II. Running
Without any code changes, just start all the applications under `base` , `feature1` , `feature2` , `featureenv-gateway` directly.
Without any code changes, just start all the applications under `base` , `feature1` , `feature2` , `featureenv-gateway`
directly.
By default, the applications point to the official Polaris experience environment, and you can directly view the service registration data at the experience site after a successful launch.
By default, the applications point to the official Polaris experience environment, and you can directly view the service
registration data at the experience site after a successful launch.
- Console address: http://14.116.241.63:8080/
- Console address: http://14.116.241.63:8080/
- Account: polaris
- Account: polaris
@ -34,10 +40,13 @@ By default, the applications point to the official Polaris experience environmen
### Mode 1: Client Request With `featureenv` Label
### Mode 1: Client Request With `featureenv` Label
#### `baseline` environment link
#### `baseline` environment link
````
````
curl http://127.0.0.1:9999/featureenv-front-example/router/rest
curl http://127.0.0.1:9999/featureenv-front-example/router/rest
````
````
Response results (base indicates baseline environment)
Response results (base indicates baseline environment)
````
````
featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-backend-example[base]
featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-backend-example[base]
````
````
@ -49,7 +58,9 @@ Specify the feature environment via the `X-Polaris-Metadata-Transitive-featureen
````
````
curl -H'X-Polaris-Metadata-Transitive-featureenv:feature1' http://127.0.0.1:9999/featureenv-front-example/router/rest
curl -H'X-Polaris-Metadata-Transitive-featureenv:feature1' http://127.0.0.1:9999/featureenv-front-example/router/rest
````
````
Response results
Response results
````
````
featureenv-front-example[base] -> featureenv-middle-example[feature1] -> featureenv-backend-example[feature1]
featureenv-front-example[base] -> featureenv-middle-example[feature1] -> featureenv-backend-example[feature1]
````
````
@ -61,7 +72,9 @@ Specify the feature environment via the `X-Polaris-Metadata-Transitive-featureen
````
````
curl -H'X-Polaris-Metadata-Transitive-featureenv:feature2' http://127.0.0.1:9999/featureenv-front-example/router/rest
curl -H'X-Polaris-Metadata-Transitive-featureenv:feature2' http://127.0.0.1:9999/featureenv-front-example/router/rest
````
````
Response results
Response results
````
````
featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
````
````
@ -69,6 +82,7 @@ featureenv-front-example[feature2] -> featureenv-middle-example[base] -> feature
### Mode 2: Gateway traffic staining
### Mode 2: Gateway traffic staining
Simulate a real-world scenario, assuming that the client request has a uid request parameter and expects:
Simulate a real-world scenario, assuming that the client request has a uid request parameter and expects:
1. `uid=1000` requests hit the `feature1` environment
1. `uid=1000` requests hit the `feature1` environment
2. `uid=2000` requests hit the `feature2` environment
2. `uid=2000` requests hit the `feature2` environment
3. requests with other uid hit the `baseline` environment
3. requests with other uid hit the `baseline` environment
@ -86,8 +100,10 @@ Modify the `rule/staining.json` configuration file and fill in the following rul
"conditions": [
"conditions": [
{
{
"key": "${http.query.uid}",
"key": "${http.query.uid}",
"values":["1000"],
"values": [
"operation":"EQUAL"
"1000"
],
"operation": "EQUALS"
}
}
],
],
"labels": [
"labels": [
@ -101,8 +117,10 @@ Modify the `rule/staining.json` configuration file and fill in the following rul
"conditions": [
"conditions": [
{
{
"key": "${http.query.uid}",
"key": "${http.query.uid}",
"values":["2000"],
"values": [
"operation":"EQUAL"
"2000"
],
"operation": "EQUALS"
}
}
],
],
"labels": [
"labels": [
@ -119,10 +137,13 @@ Modify the `rule/staining.json` configuration file and fill in the following rul
Just fill out and publish the configuration.
Just fill out and publish the configuration.
#### `baseline` Environment Link
#### `baseline` Environment Link
````
````
curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=3000
curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=3000
````
````
Response results (base indicates baseline environment)
Response results (base indicates baseline environment)
````
````
featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-backend-example[base]
featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-backend-example[base]
````
````
@ -134,7 +155,9 @@ Specify the feature environment via the `X-Polaris-Metadata-Transitive-featureen
````
````
curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=1000
curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=1000
````
````
Response results
Response results
````
````
featureenv-front-example[base] -> featureenv-middle-example[feature1] -> featureenv-backend-example[feature1]
featureenv-front-example[base] -> featureenv-middle-example[feature1] -> featureenv-backend-example[feature1]
````
````
@ -146,7 +169,9 @@ Specify the feature environment via the `X-Polaris-Metadata-Transitive-featureen
````
````
curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=2000
curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=2000
````
````
Response results
Response results
````
````
featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
````
````