-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build rate limit service config (#893)
* Build rate limit service config * Translates Xds IR into ratelimit service config https://github.com/envoyproxy/ratelimit#configuration Relates to #670 Signed-off-by: Arko Dasgupta <arko@tetrate.io> * fix yamlint Signed-off-by: Arko Dasgupta <arko@tetrate.io> * lint Signed-off-by: Arko Dasgupta <arko@tetrate.io> Signed-off-by: Arko Dasgupta <arko@tetrate.io>
- Loading branch information
Showing
16 changed files
with
391 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
internal/xds/translator/testdata/in/ratelimit-config/distinct-match.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
routes: | ||
- name: "first-route" | ||
rateLimit: | ||
global: | ||
rules: | ||
- headerMatches: | ||
- name: "x-user-id" | ||
distinct: true | ||
limit: | ||
requests: 5 | ||
unit: second | ||
pathMatch: | ||
exact: "foo/bar" | ||
destinations: | ||
- host: "1.2.3.4" | ||
port: 50000 |
18 changes: 18 additions & 0 deletions
18
internal/xds/translator/testdata/in/ratelimit-config/empty-header-matches.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
routes: | ||
- name: "first-route" | ||
rateLimit: | ||
global: | ||
rules: | ||
- limit: | ||
requests: 5 | ||
unit: second | ||
pathMatch: | ||
exact: "foo/bar" | ||
destinations: | ||
- host: "1.2.3.4" | ||
port: 50000 |
23 changes: 23 additions & 0 deletions
23
internal/xds/translator/testdata/in/ratelimit-config/multiple-matches.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
routes: | ||
- name: "first-route" | ||
rateLimit: | ||
global: | ||
rules: | ||
- headerMatches: | ||
- name: "x-user-id" | ||
exact: "one" | ||
- name: "x-user-id" | ||
exact: "two" | ||
limit: | ||
requests: 5 | ||
unit: second | ||
pathMatch: | ||
exact: "foo/bar" | ||
destinations: | ||
- host: "1.2.3.4" | ||
port: 50000 |
33 changes: 33 additions & 0 deletions
33
internal/xds/translator/testdata/in/ratelimit-config/multiple-routes.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
routes: | ||
- name: "first-route" | ||
rateLimit: | ||
global: | ||
rules: | ||
- headerMatches: | ||
- name: "x-user-id" | ||
exact: "one" | ||
limit: | ||
requests: 5 | ||
unit: second | ||
pathMatch: | ||
exact: "foo/baz" | ||
- name: "second-route" | ||
rateLimit: | ||
global: | ||
rules: | ||
- headerMatches: | ||
- name: "x-user-id" | ||
exact: "two" | ||
limit: | ||
requests: 10 | ||
unit: second | ||
pathMatch: | ||
exact: "foo/bar" | ||
destinations: | ||
- host: "1.2.3.4" | ||
port: 50000 |
27 changes: 27 additions & 0 deletions
27
internal/xds/translator/testdata/in/ratelimit-config/multiple-rules.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
routes: | ||
- name: "first-route" | ||
rateLimit: | ||
global: | ||
rules: | ||
- headerMatches: | ||
- name: "x-user-id" | ||
exact: "one" | ||
limit: | ||
requests: 5 | ||
unit: second | ||
- headerMatches: | ||
- name: "x-user-id" | ||
exact: "two" | ||
limit: | ||
requests: 10 | ||
unit: second | ||
pathMatch: | ||
exact: "foo/bar" | ||
destinations: | ||
- host: "1.2.3.4" | ||
port: 50000 |
21 changes: 21 additions & 0 deletions
21
internal/xds/translator/testdata/in/ratelimit-config/value-match.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
routes: | ||
- name: "first-route" | ||
rateLimit: | ||
global: | ||
rules: | ||
- headerMatches: | ||
- name: "x-user-id" | ||
exact: "one" | ||
limit: | ||
requests: 5 | ||
unit: second | ||
pathMatch: | ||
exact: "foo/bar" | ||
destinations: | ||
- host: "1.2.3.4" | ||
port: 50000 |
12 changes: 12 additions & 0 deletions
12
internal/xds/translator/testdata/out/ratelimit-config/distinct-match.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route-key-rule-0-match-0 | ||
value: "" | ||
rate_limit: | ||
requests_per_unit: 5 | ||
unit: second | ||
unlimited: false | ||
name: "" | ||
replaces: [] | ||
descriptors: [] | ||
shadow_mode: false |
12 changes: 12 additions & 0 deletions
12
internal/xds/translator/testdata/out/ratelimit-config/empty-header-matches.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route-key-rule-0-match--1 | ||
value: first-route-value-rule-0-match--1 | ||
rate_limit: | ||
requests_per_unit: 5 | ||
unit: second | ||
unlimited: false | ||
name: "" | ||
replaces: [] | ||
descriptors: [] | ||
shadow_mode: false |
17 changes: 17 additions & 0 deletions
17
internal/xds/translator/testdata/out/ratelimit-config/multiple-matches.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route-key-rule-0-match-0 | ||
value: first-route-value-rule-0-match-0 | ||
rate_limit: null | ||
descriptors: | ||
- key: first-route-key-rule-0-match-1 | ||
value: first-route-value-rule-0-match-1 | ||
rate_limit: | ||
requests_per_unit: 5 | ||
unit: second | ||
unlimited: false | ||
name: "" | ||
replaces: [] | ||
descriptors: [] | ||
shadow_mode: false | ||
shadow_mode: false |
22 changes: 22 additions & 0 deletions
22
internal/xds/translator/testdata/out/ratelimit-config/multiple-routes.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route-key-rule-0-match-0 | ||
value: first-route-value-rule-0-match-0 | ||
rate_limit: | ||
requests_per_unit: 5 | ||
unit: second | ||
unlimited: false | ||
name: "" | ||
replaces: [] | ||
descriptors: [] | ||
shadow_mode: false | ||
- key: second-route-key-rule-0-match-0 | ||
value: second-route-value-rule-0-match-0 | ||
rate_limit: | ||
requests_per_unit: 10 | ||
unit: second | ||
unlimited: false | ||
name: "" | ||
replaces: [] | ||
descriptors: [] | ||
shadow_mode: false |
Oops, something went wrong.