Skip to content

Commit cbbd4c3

Browse files
ci(chainsaw): HTTPRoute method matching (#3003)
Signed-off-by: Jintao Zhang <[email protected]>
1 parent d8206fe commit cbbd4c3

18 files changed

+1334
-6
lines changed

test/e2e/chainsaw/hybridgateway/basic-httproute/chainsaw-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
- name: konnect_api_auth_name
1717
value: konnect-api-auth-dev-1
1818
- name: gateway_class_name
19-
value: (join('-', ['kong', (env('GITHUB_RUN_ID') || env('TEST_ID') || 'local')]))
19+
value: (join('-', ['kong', 'basic-httproute', (env('GITHUB_RUN_ID') || env('TEST_ID') || 'local')]))
2020
- name: gateway_configuration_name
2121
value: ($gateway_class_name)
2222
- name: gateway_name

test/e2e/chainsaw/hybridgateway/httproute-filters/chainsaw-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
- name: kong_namespace
1515
value: (join('-', ['kong', 'httproute-filters', (env('GITHUB_RUN_ID') || env('TEST_ID') || 'local')]))
1616
- name: gateway_class_name
17-
value: (join('-', ['kong', (env('GITHUB_RUN_ID') || env('TEST_ID') || 'local')]))
17+
value: (join('-', ['kong', 'httproute-filters', (env('GITHUB_RUN_ID') || env('TEST_ID') || 'local')]))
1818
- name: gateway_name
1919
value: ($gateway_class_name)
2020
- name: gateway_configuration_name

test/e2e/chainsaw/hybridgateway/httproute-header-match/chainsaw-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
- name: konnect_api_auth_name
2222
value: konnect-api-auth-dev-1
2323
- name: gateway_class_name
24-
value: (join('-', ['kong', (env('GITHUB_RUN_ID') || env('TEST_ID') || 'local')]))
24+
value: (join('-', ['kong', 'httproute-header-match', (env('GITHUB_RUN_ID') || env('TEST_ID') || 'local')]))
2525
- name: gateway_configuration_name
2626
value: ($gateway_class_name)
2727
- name: gateway_name
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: httpbin
6+
namespace: ($kong_namespace)
7+
---
8+
apiVersion: apps/v1
9+
kind: Deployment
10+
metadata:
11+
name: httpbin
12+
namespace: ($kong_namespace)
13+
status:
14+
(conditions[?type == 'Available']):
15+
- status: 'True'
16+
readyReplicas: 1
17+
replicas: 1
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: httpbin
6+
namespace: ($kong_namespace)
7+
labels:
8+
app: httpbin
9+
spec:
10+
replicas: 1
11+
selector:
12+
matchLabels:
13+
app: httpbin
14+
template:
15+
metadata:
16+
labels:
17+
app: httpbin
18+
spec:
19+
containers:
20+
- name: httpbin
21+
image: ghcr.io/mccutchen/go-httpbin:2.19
22+
ports:
23+
- name: http
24+
containerPort: 8080
25+
protocol: TCP
26+
livenessProbe:
27+
httpGet:
28+
path: /status/200
29+
port: http
30+
readinessProbe:
31+
httpGet:
32+
path: /status/200
33+
port: http
34+
resources:
35+
requests:
36+
cpu: 50m
37+
memory: 64Mi
38+
limits:
39+
cpu: 100m
40+
memory: 128Mi
41+
securityContext:
42+
runAsNonRoot: true
43+
---
44+
apiVersion: v1
45+
kind: Service
46+
metadata:
47+
name: httpbin
48+
namespace: ($kong_namespace)
49+
labels:
50+
app: httpbin
51+
spec:
52+
selector:
53+
app: httpbin
54+
ports:
55+
- port: 80
56+
targetPort: http
57+
protocol: TCP
58+
name: http
59+
appProtocol: http
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: ($kong_namespace)
6+
---
7+
apiVersion: gateway.networking.k8s.io/v1
8+
kind: GatewayClass
9+
metadata:
10+
name: ($gateway_class_name)
11+
status:
12+
(conditions[?type == 'Accepted']):
13+
- status: 'True'
14+
reason: Accepted
15+
---
16+
apiVersion: gateway.networking.k8s.io/v1
17+
kind: Gateway
18+
metadata:
19+
name: ($gateway_name)
20+
namespace: ($kong_namespace)
21+
status:
22+
(conditions[?type == 'Accepted']):
23+
- status: 'True'
24+
reason: Accepted
25+
(conditions[?type == 'Programmed']):
26+
- status: 'True'
27+
reason: Programmed
28+
(conditions[?type == 'DataPlaneReady']):
29+
- status: 'True'
30+
reason: Ready
31+
(conditions[?type == 'KonnectGatewayControlPlaneProgrammed']):
32+
- status: 'True'
33+
reason: Programmed
34+
(conditions[?type == 'KonnectExtensionReady']):
35+
- status: 'True'
36+
reason: Ready
37+
(conditions[?type == 'GatewayService']):
38+
- status: 'True'
39+
reason: Ready
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: ($kong_namespace)
6+
---
7+
apiVersion: v1
8+
kind: Namespace
9+
metadata:
10+
name: default
11+
---
12+
kind: KonnectAPIAuthConfiguration
13+
apiVersion: konnect.konghq.com/v1alpha1
14+
metadata:
15+
name: ($konnect_api_auth_name)
16+
namespace: ($kong_namespace)
17+
spec:
18+
type: token
19+
token: (env('KONNECT_TOKEN'))
20+
serverURL: (env('KONNECT_SERVER_URL') || 'eu.api.konghq.tech')
21+
---
22+
kind: GatewayConfiguration
23+
apiVersion: gateway-operator.konghq.com/v2beta1
24+
metadata:
25+
name: ($gateway_configuration_name)
26+
namespace: ($kong_namespace)
27+
spec:
28+
konnect:
29+
authRef:
30+
name: ($konnect_api_auth_name)
31+
dataPlaneOptions:
32+
deployment:
33+
podTemplateSpec:
34+
spec:
35+
containers:
36+
- name: proxy
37+
image: kong/kong-gateway:3.12
38+
---
39+
kind: GatewayClass
40+
apiVersion: gateway.networking.k8s.io/v1
41+
metadata:
42+
name: ($gateway_class_name)
43+
spec:
44+
controllerName: konghq.com/gateway-operator
45+
parametersRef:
46+
group: gateway-operator.konghq.com
47+
kind: GatewayConfiguration
48+
name: ($gateway_configuration_name)
49+
namespace: ($kong_namespace)
50+
---
51+
kind: Gateway
52+
apiVersion: gateway.networking.k8s.io/v1
53+
metadata:
54+
name: ($gateway_name)
55+
namespace: ($kong_namespace)
56+
spec:
57+
gatewayClassName: ($gateway_class_name)
58+
listeners:
59+
- name: http
60+
protocol: HTTP
61+
port: 80
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
apiVersion: gateway.networking.k8s.io/v1
3+
kind: HTTPRoute
4+
metadata:
5+
name: ($httproute_name)
6+
namespace: ($kong_namespace)
7+
status:
8+
parents:
9+
- parentRef:
10+
name: ($gateway_name)
11+
group: gateway.networking.k8s.io
12+
kind: Gateway
13+
controllerName: konghq.com/gateway-operator
14+
(conditions[?type == 'Accepted']):
15+
- status: "True"
16+
reason: Accepted
17+
(conditions[?type == 'ResolvedRefs']):
18+
- status: "True"
19+
reason: ResolvedRefs
20+
(conditions[?type == 'KongRouteProgrammed']):
21+
- status: "True"
22+
reason: KongRouteProgrammed
23+
(conditions[?type == 'KongServiceProgrammed']):
24+
- status: "True"
25+
reason: KongServiceProgrammed
26+
(conditions[?type == 'KongUpstreamProgrammed']):
27+
- status: "True"
28+
reason: KongUpstreamProgrammed
29+
(conditions[?type == 'KongTargetProgrammed']):
30+
- status: "True"
31+
reason: KongTargetProgrammed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
kind: HTTPRoute
3+
apiVersion: gateway.networking.k8s.io/v1
4+
metadata:
5+
name: ($httproute_name)
6+
namespace: ($kong_namespace)
7+
annotations:
8+
konghq.com/strip-path: "false"
9+
spec:
10+
parentRefs:
11+
- group: gateway.networking.k8s.io
12+
kind: Gateway
13+
name: ($gateway_name)
14+
rules:
15+
- matches:
16+
- method: GET
17+
path:
18+
type: Exact
19+
value: /get
20+
backendRefs:
21+
- name: httpbin
22+
port: 80
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
kind: HTTPRoute
3+
apiVersion: gateway.networking.k8s.io/v1
4+
metadata:
5+
name: ($httproute_name)
6+
namespace: ($kong_namespace)
7+
annotations:
8+
konghq.com/strip-path: "false"
9+
spec:
10+
parentRefs:
11+
- group: gateway.networking.k8s.io
12+
kind: Gateway
13+
name: ($gateway_name)
14+
rules:
15+
- matches:
16+
- method: POST
17+
path:
18+
type: Exact
19+
value: /post
20+
backendRefs:
21+
- name: httpbin
22+
port: 80

0 commit comments

Comments
 (0)