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

doc: update document #25

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This project adds xDS support for Kitex and enables Kitex to perform in Proxyles
## Feature

* Service Discovery
* Traffic Route: only support `exact` match for `header` and `method`
* Traffic Route: supports `exact` `prefix` `regex` match for `header` and `method`
* [HTTP route configuration](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/http/http_routing#arch-overview-http-routing): configure via [VirtualService](https://istio.io/latest/docs/reference/config/networking/virtual-service/).
* Since Istio provides limited support for thrift protocol and most users are familiar with the config of VirtualService, we use a mapping from HTTP to Thrift in this configuration.
* [ThriftProxy](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/thrift_proxy/v3/thrift_proxy.proto): configure via patching [EnvoyFilter](https://istio.io/latest/docs/reference/config/networking/envoy-filter/).
Expand Down Expand Up @@ -66,6 +66,9 @@ client.WithXDSSuite(xds.ClientSuite{

```
<service-name>.<namespace>.svc.cluster.local:<service-port>
<service-name>.<namespace>.svc:<service-port>
<service-name>.<namespace>:<service-port>
<service-name>:<service-port> // access the <service-name> in same namespace.
```

#### Traffic route based on Tag Match
Expand All @@ -88,6 +91,41 @@ spec:
- headers:
stage:
exact: "canary"
# support prefix match
- headers:
stage:
prefix: "can"
# support regex match
- headers:
stage:
regex: "[canary|prod]"
route:
- destination:
host: kitex-server
subset: v1
weight: 100
timeout: 0.5s
```
The example of prefix and regex match like this:
```
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: kitex-server
spec:
hosts:
- kitex-server
http:
- name: "route-based-on-tags"
match:
# support prefix match
- headers:
stage:
prefix: "can"
# support regex match
- headers:
stage:
regex: "[canary|prod]"
route:
- destination:
host: kitex-server
Expand Down
32 changes: 31 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Kitex 通过外部扩展 [kitex-contrib/xds](https://github.com/kitex-contrib/xd
## 已支持的功能

* 服务发现
* 服务路由:当前仅支持 `header` 与 `method` 的精确匹配
* 服务路由:当前仅支持 `header` 与 `method` 的匹配策略有精确匹配、前缀匹配、正则匹配
* [HTTP route configuration](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/http/http_routing#arch-overview-http-routing): 通过 [VirtualService](https://istio.io/latest/docs/reference/config/networking/virtual-service/) 进行配置
* 由于 Istio 对 thrift 协议的支持有限,并且大多数用户都熟悉 VirtualService 的配置,所以我们在该配置建立 HTTP 到 Thrift 的映射,以定义路由策略。
* [ThriftProxy](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/thrift_proxy/v3/thrift_proxy.proto): 通过 [EnvoyFilter](https://istio.io/latest/docs/reference/config/networking/envoy-filter/) 进行配置。
Expand Down Expand Up @@ -66,6 +66,9 @@ client.WithXDSSuite(xds.ClientSuite{

```
<service-name>.<namespace>.svc.cluster.local:<service-port>
<service-name>.<namespace>.svc:<service-port>
<service-name>.<namespace>:<service-port>
<service-name>:<service-port> // 访问同命名空间的服务.
```

#### 基于 tag 匹配的路由匹配
Expand Down Expand Up @@ -95,6 +98,33 @@ spec:
weight: 100
timeout: 0.5s
```
前缀匹配和正则匹配例子如下:
```
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: kitex-server
spec:
hosts:
- kitex-server
http:
- name: "route-based-on-tags"
match:
# support prefix match
- headers:
stage:
prefix: "can"
# support regex match
- headers:
stage:
regex: "[canary|prod]"
route:
- destination:
host: kitex-server
subset: v1
weight: 100
timeout: 0.5s
```

为了匹配 VirtualService 中定义的规则,我们需要指定流量的标签,这些标签将用于匹配规则。

Expand Down