-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: rate limit doesn't work with two(and more) listeners (#3085)
* fix: rate limit doesn't work with two listeners Signed-off-by: huabing zhao <[email protected]> * add e2e test for rate limit on multiple listeners Signed-off-by: huabing zhao <[email protected]> * address comments Signed-off-by: huabing zhao <[email protected]> --------- Signed-off-by: huabing zhao <[email protected]> Co-authored-by: Xunzhuo <[email protected]>
- Loading branch information
1 parent
43b7dab
commit a5bedbc
Showing
12 changed files
with
139 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
1 change: 1 addition & 0 deletions
1
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
1 change: 1 addition & 0 deletions
1
internal/xds/translator/testdata/out/ratelimit-config/distinct-remote-address-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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
1 change: 1 addition & 0 deletions
1
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
1 change: 1 addition & 0 deletions
1
internal/xds/translator/testdata/out/ratelimit-config/masked-remote-address-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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
1 change: 1 addition & 0 deletions
1
...or/testdata/out/ratelimit-config/multiple-masked-remote-address-match-with-same-cidr.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
1 change: 1 addition & 0 deletions
1
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
1 change: 1 addition & 0 deletions
1
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
1 change: 1 addition & 0 deletions
1
internal/xds/translator/testdata/out/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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
1 change: 1 addition & 0 deletions
1
internal/xds/translator/testdata/out/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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
name: first-listener | ||
domain: first-listener | ||
descriptors: | ||
- key: first-route | ||
|
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,54 @@ | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: eg-rate-limit | ||
namespace: gateway-conformance-infra | ||
spec: | ||
gatewayClassName: "{GATEWAY_CLASS_NAME}" | ||
listeners: | ||
- name: http-80 | ||
protocol: HTTP | ||
port: 80 | ||
- name: http-8080 | ||
protocol: HTTP | ||
port: 8080 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: cidr-ratelimit | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: eg-rate-limit | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
backendRefs: | ||
- name: infra-backend-v1 | ||
port: 8080 | ||
--- | ||
apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: BackendTrafficPolicy | ||
metadata: | ||
name: ratelimit-all-ips | ||
namespace: gateway-conformance-infra | ||
spec: | ||
targetRef: | ||
group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: cidr-ratelimit | ||
namespace: gateway-conformance-infra | ||
rateLimit: | ||
type: Global | ||
global: | ||
rules: | ||
- clientSelectors: | ||
- sourceCIDR: | ||
value: 0.0.0.0/0 | ||
type: distinct | ||
limit: | ||
requests: 3 | ||
unit: Hour |
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