Polish docs and samples of Envoy RLS token server module for RLS v3 API

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
Eric Zhao 2022-01-04 10:54:38 +08:00
parent 02cfe40f8a
commit 356111f745
5 changed files with 17 additions and 20 deletions

View File

@ -3,6 +3,8 @@
This module provides the [Envoy rate limiting gRPC service](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/other_features/global_rate_limiting#arch-overview-rate-limit) implementation This module provides the [Envoy rate limiting gRPC service](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/other_features/global_rate_limiting#arch-overview-rate-limit) implementation
with Sentinel token server. with Sentinel token server.
The token server has supported both Envoy RLS v2 and v3 API. Since Envoy 1.18.0, v2 API support has been removed.
> Note: the gRPC stub classes for Envoy RLS service is generated via `protobuf-maven-plugin` during the `compile` goal. > Note: the gRPC stub classes for Envoy RLS service is generated via `protobuf-maven-plugin` during the `compile` goal.
> The generated classes is located in the directory: `target/generated-sources/protobuf`. > The generated classes is located in the directory: `target/generated-sources/protobuf`.
@ -19,7 +21,7 @@ mvn clean package -P prod
Sentinel RLS token server supports dynamic rule configuration via the yaml file. Sentinel RLS token server supports dynamic rule configuration via the yaml file.
The file may provide rules for one *domain* (defined in Envoy's conf file). The file may provide rules for one *domain* (defined in Envoy's conf file).
In Envoy, one rate limit request might carry multiple *rate limit descriptors* In Envoy, one rate limit request might carry multiple *rate limit descriptors*
(which will be generated from [Envoy rate limit actions](https://www.envoyproxy.io/docs/envoy/v1.12.1/api-v2/api/v2/route/route.proto#envoy-api-msg-route-ratelimit)). (which will be generated from [Envoy rate limit actions](https://www.envoyproxy.io/docs/envoy/v1.20.1/api-v3/config/route/v3/route_components.proto#envoy-v3-api-msg-config-route-v3-ratelimit)).
One rate limit descriptor may have multiple entries (key-value pair). One rate limit descriptor may have multiple entries (key-value pair).
We may set different threshold for each rate limit descriptors. We may set different threshold for each rate limit descriptors.

View File

@ -87,12 +87,6 @@ Then we could set rate limit rules for each target clusters.
After preparing the yaml template, you may deploy the Envoy instance: After preparing the yaml template, you may deploy the Envoy instance:
```bash
kubectl apply -f sample/k8s/envoy.yml
```
for v3 api
```bash ```bash
kubectl apply -f sample/k8s/envoy-v3-api.yml kubectl apply -f sample/k8s/envoy-v3-api.yml
``` ```

View File

@ -1,3 +1,4 @@
# NOTE: legacy V2 API sample, which has been deprecated
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
@ -82,7 +83,7 @@ data:
address: sentinel-rls-service address: sentinel-rls-service
port_value: 10245 port_value: 10245
--- ---
apiVersion: apps/v1beta2 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: envoy-deployment-basic name: envoy-deployment-basic

View File

@ -1,7 +1,7 @@
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: envoy-cm-17 name: envoy-cm
data: data:
envoy-yml: |- envoy-yml: |-
admin: admin:
@ -94,22 +94,22 @@ data:
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: envoy-deployment-basic-17 name: envoy-deployment-basic
labels: labels:
app: envoy-17 app: envoy
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: envoy-17 app: envoy
template: template:
metadata: metadata:
labels: labels:
app: envoy-17 app: envoy
spec: spec:
containers: containers:
- name: envoy - name: envoy
image: envoyproxy/envoy:v1.17.3 image: envoyproxy/envoy:v1.20.1
ports: ports:
- containerPort: 10000 - containerPort: 10000
command: ["envoy"] command: ["envoy"]
@ -120,7 +120,7 @@ spec:
volumes: volumes:
- name: envoy-config - name: envoy-config
configMap: configMap:
name: envoy-cm-17 name: envoy-cm
items: items:
- key: envoy-yml - key: envoy-yml
path: envoy.yaml path: envoy.yaml
@ -128,14 +128,14 @@ spec:
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: envoy-service-17 name: envoy-service
labels: labels:
name: envoy-service-17 name: envoy-service
spec: spec:
type: NodePort type: ClusterIP
ports: ports:
- port: 10000 - port: 10000
targetPort: 10000 targetPort: 10000
protocol: TCP protocol: TCP
selector: selector:
app: envoy-17 app: envoy

View File

@ -11,7 +11,7 @@ data:
value: "service_httpbin" value: "service_httpbin"
count: 1 count: 1
--- ---
apiVersion: apps/v1beta2 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: sentinel-rls-server name: sentinel-rls-server