forked from envoyproxy/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RateLimitFilter: Gateway API to Xds IR translaton
* Also rm'ed `ResetConditon` and instead set `Accepted=False` for negative cases for ExtensionFilter cases Relates to envoyproxy#670 Signed-off-by: Arko Dasgupta <arko@tetrate.io>
- Loading branch information
Showing
11 changed files
with
441 additions
and
54 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
60 changes: 60 additions & 0 deletions
60
internal/gatewayapi/testdata/httproute-with-invalid-ratelimitfilter.in.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,60 @@ | ||
gateways: | ||
- apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: Gateway | ||
metadata: | ||
namespace: envoy-gateway | ||
name: gateway-1 | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
hostname: "*.envoyproxy.io" | ||
allowedRoutes: | ||
namespaces: | ||
from: All | ||
httpRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
namespace: default | ||
name: httproute-1 | ||
spec: | ||
hostnames: | ||
- gateway.envoyproxy.io | ||
parentRefs: | ||
- namespace: envoy-gateway | ||
name: gateway-1 | ||
sectionName: http | ||
rules: | ||
- matches: | ||
- path: | ||
value: "/" | ||
backendRefs: | ||
- name: service-1 | ||
port: 8080 | ||
filters: | ||
- type: ExtensionRef | ||
extensionRef: | ||
group: gateway.envoyproxy.io | ||
kind: RateLimitFilter | ||
name: test | ||
rateLimitFilters: | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: RateLimitFilter | ||
metadata: | ||
name: test | ||
namespace: default | ||
spec: | ||
type: Global | ||
global: | ||
rules: | ||
- clientSelectors: | ||
- headers: | ||
- type: Distinct | ||
name: x-user-id | ||
value: one | ||
limit: | ||
requests: 10 | ||
unit: Hour |
106 changes: 106 additions & 0 deletions
106
internal/gatewayapi/testdata/httproute-with-invalid-ratelimitfilter.out.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,106 @@ | ||
gateways: | ||
- apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: Gateway | ||
metadata: | ||
namespace: envoy-gateway | ||
name: gateway-1 | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
hostname: "*.envoyproxy.io" | ||
allowedRoutes: | ||
namespaces: | ||
from: All | ||
status: | ||
listeners: | ||
- name: http | ||
supportedKinds: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
attachedRoutes: 1 | ||
conditions: | ||
- type: Programmed | ||
status: "True" | ||
reason: Programmed | ||
message: Listener is ready | ||
httpRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
namespace: default | ||
name: httproute-1 | ||
spec: | ||
hostnames: | ||
- gateway.envoyproxy.io | ||
parentRefs: | ||
- namespace: envoy-gateway | ||
name: gateway-1 | ||
sectionName: http | ||
rules: | ||
- matches: | ||
- path: | ||
value: "/" | ||
backendRefs: | ||
- name: service-1 | ||
port: 8080 | ||
filters: | ||
- type: ExtensionRef | ||
extensionRef: | ||
group: gateway.envoyproxy.io | ||
kind: RateLimitFilter | ||
name: test | ||
status: | ||
parents: | ||
- parentRef: | ||
namespace: envoy-gateway | ||
name: gateway-1 | ||
sectionName: http | ||
controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
conditions: | ||
- type: Accepted | ||
status: "False" | ||
reason: UnsupportedValue | ||
message: "Unable to translate RateLimitFilter: default/test" | ||
- type: ResolvedRefs | ||
status: "False" | ||
reason: BackendNotFound | ||
message: "Unable to translate RateLimitFilter: default/test" | ||
xdsIR: | ||
envoy-gateway-gateway-1: | ||
http: | ||
- name: envoy-gateway-gateway-1-http | ||
address: 0.0.0.0 | ||
port: 10080 | ||
hostnames: | ||
- "*.envoyproxy.io" | ||
routes: | ||
- name: default-httproute-1-rule-0-match-0-gateway.envoyproxy.io | ||
pathMatch: | ||
prefix: "/" | ||
headerMatches: | ||
- name: ":authority" | ||
exact: gateway.envoyproxy.io | ||
# I believe the correct way to handle an invalid filter should be to allow the HTTPRoute to function | ||
# normally but leave out the filter config and set the status, but this behaviour can be changed. | ||
directResponse: | ||
body: "Unable to translate RateLimitFilter: default/test" | ||
statusCode: 500 | ||
infraIR: | ||
envoy-gateway-gateway-1: | ||
proxy: | ||
metadata: | ||
labels: | ||
gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway | ||
gateway.envoyproxy.io/owning-gateway-name: gateway-1 | ||
name: envoy-gateway-gateway-1 | ||
image: envoyproxy/envoy:translator-tests | ||
listeners: | ||
- address: "" | ||
ports: | ||
- name: http | ||
protocol: "HTTP" | ||
containerPort: 10080 | ||
servicePort: 80 |
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 |
---|---|---|
|
@@ -39,5 +39,5 @@ httpRoutes: | |
extensionRef: | ||
group: gateway.envoyproxy.io | ||
kind: AuthenticationFilter | ||
name: test | ||
name: non-exist | ||
|
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
Oops, something went wrong.