release:release 1.7.0-Hoxton.SR12. (#472)

pull/477/head 1.7.0-Hoxton.SR12
Haotian Zhang 2 years ago committed by GitHub
parent 7699ed16f5
commit e2679d13e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -88,7 +88,7 @@
<properties> <properties>
<!-- Project revision --> <!-- Project revision -->
<revision>1.7.0-Hoxton.SR12-SNAPSHOT</revision> <revision>1.7.0-Hoxton.SR12</revision>
<!-- Spring Cloud --> <!-- Spring Cloud -->
<spring.cloud.version>Hoxton.SR12</spring.cloud.version> <spring.cloud.version>Hoxton.SR12</spring.cloud.version>

@ -70,8 +70,8 @@
</developers> </developers>
<properties> <properties>
<revision>1.7.0-Hoxton.SR12-SNAPSHOT</revision> <revision>1.7.0-Hoxton.SR12</revision>
<polaris.version>1.7.2-SNAPSHOT</polaris.version> <polaris.version>1.7.2</polaris.version>
<logback.version>1.2.11</logback.version> <logback.version>1.2.11</logback.version>
<mocktio.version>4.5.1</mocktio.version> <mocktio.version>4.5.1</mocktio.version>
<byte-buddy.version>1.12.10</byte-buddy.version> <byte-buddy.version>1.12.10</byte-buddy.version>

@ -7,6 +7,7 @@
<img src="./imgs/structs.png"/> <img src="./imgs/structs.png"/>
如上图所示,一共有三个环境: 如上图所示,一共有三个环境:
1. 基线环境,包含 FrontService、MiddleService、BackendService 1. 基线环境,包含 FrontService、MiddleService、BackendService
2. feature1 环境,包含 MiddleService、BackendService 2. feature1 环境,包含 MiddleService、BackendService
3. feature2 环境,包含 FrontService、BackendService 3. feature2 环境,包含 FrontService、BackendService
@ -14,11 +15,11 @@
并且在入口处,部署网关服务。 并且在入口处,部署网关服务。
三条请求链路: 三条请求链路:
1. 基线环境链路Gateway -> FrontService(基线) -> MiddleService(基线) -> BackendService(基线) 1. 基线环境链路Gateway -> FrontService(基线) -> MiddleService(基线) -> BackendService(基线)
2. feature1 环境链路Gateway -> FrontService(基线) -> MiddleService(feature1) -> BackendService(feature1) 2. feature1 环境链路Gateway -> FrontService(基线) -> MiddleService(feature1) -> BackendService(feature1)
3. feature2 环境链路Gateway -> FrontService(feature2) -> MiddleService(基线) -> BackendService(feature2) 3. feature2 环境链路Gateway -> FrontService(feature2) -> MiddleService(基线) -> BackendService(feature2)
## 二、运行样例 ## 二、运行样例
无需任何代码变更,直接启动 base、feature1、feature2、featureenv-gateway 下所有应用即可。 无需任何代码变更,直接启动 base、feature1、feature2、featureenv-gateway 下所有应用即可。
@ -34,10 +35,13 @@
### 方式一:客户端打标 ### 方式一:客户端打标
#### 基线环境链路 #### 基线环境链路
```` ````
curl http://127.0.0.1:9999/featureenv-front-example/router/rest curl http://127.0.0.1:9999/featureenv-front-example/router/rest
```` ````
响应结果base 表示基线环境) 响应结果base 表示基线环境)
```` ````
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 +53,9 @@ featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-
```` ````
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
```` ````
响应结果 响应结果
```` ````
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 +67,9 @@ featureenv-front-example[base] -> featureenv-middle-example[feature1] -> feature
```` ````
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
```` ````
响应结果 响应结果
```` ````
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,10 +77,11 @@ featureenv-front-example[feature2] -> featureenv-middle-example[base] -> feature
### 方式二:网关流量染色 ### 方式二:网关流量染色
模拟一种实际的场景,假设客户端请求有一个 uid 请求参数,期望: 模拟一种实际的场景,假设客户端请求有一个 uid 请求参数,期望:
1. uid=1000 的请求打到 feature1 环境 1. uid=1000 的请求打到 feature1 环境
2. uid=2000 的请求打到 feature2 环境 2. uid=2000 的请求打到 feature2 环境
3. 其它 uid 的请求打到基线环境 3. 其它 uid 的请求打到基线环境
**配置染色规则** **配置染色规则**
配置地址http://14.116.241.63:8080/#/filegroup-detail?group=featureenv-gateway&namespace=default 配置地址http://14.116.241.63:8080/#/filegroup-detail?group=featureenv-gateway&namespace=default
@ -81,48 +90,55 @@ featureenv-front-example[feature2] -> featureenv-middle-example[base] -> feature
````json ````json
{ {
"rules":[ "rules": [
{
"conditions": [
{ {
"conditions":[ "key": "${http.query.uid}",
{ "values": [
"key":"${http.query.uid}", "1000"
"values":["1000"], ],
"operation":"EQUAL" "operation": "EQUALS"
} }
], ],
"labels":[ "labels": [
{ {
"key":"featureenv", "key": "featureenv",
"value":"feature1" "value": "feature1"
} }
] ]
}, },
{
"conditions": [
{ {
"conditions":[ "key": "${http.query.uid}",
{ "values": [
"key":"${http.query.uid}", "2000"
"values":["2000"], ],
"operation":"EQUAL" "operation": "EQUALS"
}
],
"labels":[
{
"key":"featureenv",
"value":"feature2"
}
]
} }
] ],
"labels": [
{
"key": "featureenv",
"value": "feature2"
}
]
}
]
} }
```` ````
填写完后发布配置即可。 填写完后发布配置即可。
#### 基线环境链路 #### 基线环境链路
```` ````
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
```` ````
响应结果base 表示基线环境) 响应结果base 表示基线环境)
```` ````
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 +150,9 @@ featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-
```` ````
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
```` ````
响应结果 响应结果
```` ````
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 +164,9 @@ featureenv-front-example[base] -> featureenv-middle-example[feature1] -> feature
```` ````
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
```` ````
响应结果 响应结果
```` ````
featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2] featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
```` ````

@ -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,30 +15,38 @@ 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/
- Accountpolaris - Accountpolaris
- Password: polaris - Password: polaris
## III. Testing ## III. Testing
### 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
@ -81,48 +95,55 @@ Modify the `rule/staining.json` configuration file and fill in the following rul
````json ````json
{ {
"rules":[ "rules": [
{
"conditions": [
{ {
"conditions":[ "key": "${http.query.uid}",
{ "values": [
"key":"${http.query.uid}", "1000"
"values":["1000"], ],
"operation":"EQUAL" "operation": "EQUALS"
} }
], ],
"labels":[ "labels": [
{
"key":"featureenv",
"value":"feature1"
}
]
},
{ {
"conditions":[ "key": "featureenv",
{ "value": "feature1"
"key":"${http.query.uid}",
"values":["2000"],
"operation":"EQUAL"
}
],
"labels":[
{
"key":"featureenv",
"value":"feature2"
}
]
} }
] ]
},
{
"conditions": [
{
"key": "${http.query.uid}",
"values": [
"2000"
],
"operation": "EQUALS"
}
],
"labels": [
{
"key": "featureenv",
"value": "feature2"
}
]
}
]
} }
```` ````
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]
```` ````

@ -37,12 +37,11 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class StainingRuleManagerTest { public class StainingRuleManagerTest {
@Mock
private ConfigFileService configFileService;
private final String testNamespace = "testNamespace"; private final String testNamespace = "testNamespace";
private final String testGroup = "testGroup"; private final String testGroup = "testGroup";
private final String testFileName = "rule.json"; private final String testFileName = "rule.json";
@Mock
private ConfigFileService configFileService;
@Test @Test
public void testNormalRule() { public void testNormalRule() {
@ -59,7 +58,7 @@ public class StainingRuleManagerTest {
+ " {\n" + " {\n"
+ " \"key\":\"${http.query.uid}\",\n" + " \"key\":\"${http.query.uid}\",\n"
+ " \"values\":[\"1000\"],\n" + " \"values\":[\"1000\"],\n"
+ " \"operation\":\"EQUAL\"\n" + " \"operation\":\"EQUALS\"\n"
+ " }\n" + " }\n"
+ " ],\n" + " ],\n"
+ " \"labels\":[\n" + " \"labels\":[\n"
@ -99,7 +98,7 @@ public class StainingRuleManagerTest {
+ " {\n" + " {\n"
+ " \"key\":\"${http.query.uid}\",\n" + " \"key\":\"${http.query.uid}\",\n"
+ " \"values\":[\"1000\"],\n" + " \"values\":[\"1000\"],\n"
+ " \"operation\":\"EQUAL\"\n" + " \"operation\":\"EQUALS\"\n"
+ " }\n" + " }\n"
+ " ],\n" + " ],\n"
+ " \"labels\":[\n" + " \"labels\":[\n"

Loading…
Cancel
Save