forked from kgateway-dev/kgateway
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gateway2/delegation: add unit test for multi-level multi-parent config (
- Loading branch information
1 parent
0f9dde2
commit dc5ca10
Showing
4 changed files
with
187 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
changelog: | ||
- type: NON_USER_FACING | ||
issueLink: https://github.com/k8sgateway/k8sgateway/issues/10379 | ||
resolvesIssue: false | ||
description: | | ||
Gateway: add unit test for multi-level and multi-parent delegation. | ||
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
127 changes: 127 additions & 0 deletions
127
projects/gateway2/translator/testutils/inputs/delegation/bug-10379.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,127 @@ | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: example-gateway | ||
namespace: infra | ||
spec: | ||
gatewayClassName: example-gateway-class | ||
listeners: | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: api-example-com | ||
namespace: infra | ||
labels: | ||
app: apis | ||
spec: | ||
parentRefs: | ||
- name: example-gateway | ||
hostnames: | ||
- "api.example.com" | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: /api1 | ||
backendRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: apiproduct-1 | ||
namespace: default | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: /api2 | ||
backendRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: apiproduct-2 | ||
namespace: default | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: apiproduct-1 | ||
namespace: default | ||
labels: | ||
app: apis | ||
annotations: | ||
delegation.gateway.solo.io/inherit-parent-matcher: "true" | ||
spec: | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
filters: | ||
- type: URLRewrite | ||
urlRewrite: | ||
path: | ||
type: ReplacePrefixMatch | ||
replacePrefixMatch: / | ||
backendRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: httpbin | ||
namespace: default | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: apiproduct-2 | ||
namespace: default | ||
labels: | ||
app: apis | ||
annotations: | ||
delegation.gateway.solo.io/inherit-parent-matcher: "true" | ||
spec: | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
filters: | ||
- type: URLRewrite | ||
urlRewrite: | ||
path: | ||
type: ReplacePrefixMatch | ||
replacePrefixMatch: / | ||
backendRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: httpbin | ||
namespace: default | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: httpbin | ||
namespace: default | ||
labels: | ||
app: apis | ||
annotations: | ||
delegation.gateway.solo.io/inherit-parent-matcher: "true" | ||
spec: | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
backendRefs: | ||
- name: httpbin | ||
namespace: default | ||
port: 8000 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: httpbin | ||
namespace: default | ||
spec: | ||
ports: | ||
- protocol: TCP | ||
port: 8000 |
51 changes: 51 additions & 0 deletions
51
projects/gateway2/translator/testutils/outputs/delegation/bug-10379.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,51 @@ | ||
--- | ||
listeners: | ||
- aggregateListener: | ||
httpFilterChains: | ||
- matcher: {} | ||
virtualHostRefs: | ||
- http~api_example_com | ||
httpResources: | ||
virtualHosts: | ||
http~api_example_com: | ||
domains: | ||
- api.example.com | ||
name: http~api_example_com | ||
routes: | ||
- matchers: | ||
- prefix: /api1 | ||
options: | ||
regexRewrite: | ||
pattern: | ||
regex: ^/api1\/* | ||
substitution: / | ||
routeAction: | ||
single: | ||
kube: | ||
port: 8000 | ||
ref: | ||
name: httpbin | ||
namespace: default | ||
- matchers: | ||
- prefix: /api2 | ||
options: | ||
regexRewrite: | ||
pattern: | ||
regex: ^/api2\/* | ||
substitution: / | ||
routeAction: | ||
single: | ||
kube: | ||
port: 8000 | ||
ref: | ||
name: httpbin | ||
namespace: default | ||
bindAddress: '::' | ||
bindPort: 8080 | ||
name: http | ||
metadata: | ||
labels: | ||
created_by: gloo-kube-gateway-api | ||
gateway_namespace: infra | ||
name: infra-example-gateway | ||
namespace: gloo-system |