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

Config revamp #110

Merged
merged 8 commits into from
Oct 22, 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
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@ A Proxy-Wasm module written in Rust, acting as a shim between Envoy and Limitado
Following is a sample configuration used by the shim.

```yaml
extensions:
auth-ext:
services:
auth-service:
type: auth
endpoint: auth-cluster
failureMode: deny
timeout: 10ms
ratelimit-ext:
ratelimit-service:
type: ratelimit
endpoint: ratelimit-cluster
failureMode: deny
policies:
actionSets:
- name: rlp-ns-A/rlp-name-A
hostnames: [ "*.toystore.com" ]
rules:
- conditions:
- allOf:
- selector: request.url_path
operator: startswith
value: /get
- selector: request.host
operator: eq
value: test.toystore.com
- selector: request.method
operator: eq
value: GET
actions:
- extension: ratelimit-ext
scope: rlp-ns-A/rlp-name-A
data:
- selector:
selector: request.headers.My-Custom-Header
- static:
key: admin
value: "1"
routeRuleConditions:
hostnames: [ "*.toystore.com" ]
matches:
- selector: request.url_path
operator: startswith
value: /get
- selector: request.host
operator: eq
value: test.toystore.com
- selector: request.method
operator: eq
value: GET
actions:
- service: ratelimit-service
scope: rlp-ns-A/rlp-name-A
conditions: []
data:
- selector:
selector: request.headers.My-Custom-Header
- static:
key: admin
value: "1"
```

## Features
Expand Down Expand Up @@ -163,7 +163,7 @@ To expose the envoy endpoint run the following:
kubectl port-forward --namespace default deployment/envoy 8000:8000
```

There is then a single auth policy defined for e2e testing:
There is then a single auth action set defined for e2e testing:

* `auth-a` which defines auth is required for requests to `/get` for the `AuthConfig` with `effective-route-1`

Expand All @@ -177,7 +177,7 @@ curl -H "Host: test.a.auth.com" -H "Authorization: APIKEY IAMALICE" http://127.0
# HTTP/1.1 200 OK
```

And some rate limit policies defined for e2e testing:
And some rate limit action sets defined for e2e testing:

* `rlp-a`: Only one data item. Data selector should not generate return any value. Thus, descriptor should be empty and
rate limiting service should **not** be called.
Expand Down
42 changes: 18 additions & 24 deletions e2e/remote-address/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,27 @@ The Wasm configuration defines a set of rules for `*.example.com`.
```yaml
{
"name": "ratelimit-source",
"hostnames": [
"*.example.com"
],
"rules": [
"routeRuleConditions": {
"hostnames": [
"*.example.com"
],
"matches": [
{
"selector": "source.remote_address",
"operator": "neq",
"value": "50.0.0.1"
}
]
},
"actions": [
{
"conditions": [
"service": "limitador",
"scope": "ratelimit-source",
"data": [
{
"allOf": [
{
"selector": "source.remote_address",
"operator": "neq",
"value": "50.0.0.1"
"selector": {
"selector": "source.remote_address"
}
]
}
],
"actions": [
{
"extension": "limitador",
"scope": "ratelimit-source",
"data": [
{
"selector": {
"selector": "source.remote_address"
}
}
]
}
]
}
Expand Down
48 changes: 21 additions & 27 deletions e2e/remote-address/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,43 +43,37 @@ static_resources:
"@type": "type.googleapis.com/google.protobuf.StringValue"
value: >
{
"extensions": {
"services": {
"limitador": {
"type": "ratelimit",
"endpoint": "limitador",
"failureMode": "deny"
}
},
"policies": [
"actionSets": [
{
"name": "ratelimit-source",
"hostnames": [
"*.example.com"
],
"rules": [
"routeRuleConditions": {
"hostnames": [
"*.example.com"
],
"matches": [
{
"selector": "source.remote_address",
"operator": "neq",
"value": "50.0.0.1"
}
]
},
"actions": [
{
"conditions": [
"service": "limitador",
"scope": "ratelimit-source",
"data": [
{
"allOf": [
{
"selector": "source.remote_address",
"operator": "neq",
"value": "50.0.0.1"
}
]
}
],
"actions": [
{
"extension": "limitador",
"scope": "ratelimit-source",
"data": [
{
"selector": {
"selector": "source.remote_address"
}
}
]
"selector": {
"selector": "source.remote_address"
}
}
]
}
Expand Down
Loading
Loading