Skip to content

Commit c134251

Browse files
authored
chore: refactor httpbin example (#101)
1 parent fe7e2d3 commit c134251

File tree

6 files changed

+122
-6
lines changed

6 files changed

+122
-6
lines changed
File renamed without changes.

examples/httproute/route.yaml renamed to examples/httpbin/httproute.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1-
21
apiVersion: gateway.networking.k8s.io/v1
32
kind: GatewayClass
43
metadata:
54
name: api7
65
spec:
7-
controllerName: "gateway.api7.io/api7-ingress-controller"
6+
controllerName: "gateway.apisix.io/api7-ingress-controller"
7+
8+
---
9+
10+
apiVersion: gateway.apisix.io/v1alpha1
11+
kind: GatewayProxy
12+
metadata:
13+
name: api7-proxy-config
14+
spec:
15+
provider:
16+
type: ControlPlane
17+
controlPlane:
18+
endpoints:
19+
- ${ADMIN_ENDPOINT} # https://127.0.0.1:7443
20+
auth:
21+
type: AdminKey
22+
adminKey:
23+
value: "${ADMIN_KEY}"
824

925
---
1026

@@ -18,8 +34,13 @@ spec:
1834
- name: http
1935
protocol: HTTP
2036
port: 80
37+
infrastructure:
38+
parametersRef:
39+
group: gateway.apisix.io
40+
kind: GatewayProxy
41+
name: api7-proxy-config
2142

22-
---
43+
---
2344

2445
apiVersion: gateway.networking.k8s.io/v1
2546
kind: HTTPRoute

examples/httpbin/ingress.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
apiVersion: gateway.apisix.io/v1alpha1
2+
kind: GatewayProxy
3+
metadata:
4+
name: api7-proxy-config
5+
namespace: default
6+
spec:
7+
provider:
8+
type: ControlPlane
9+
controlPlane:
10+
endpoints:
11+
- ${ADMIN_ENDPOINT} # https://127.0.0.1:7443
12+
auth:
13+
type: AdminKey
14+
adminKey:
15+
value: "${ADMIN_KEY}"
16+
17+
---
18+
19+
apiVersion: networking.k8s.io/v1
20+
kind: IngressClass
21+
metadata:
22+
name: api7
23+
spec:
24+
controller: "gateway.apisix.io/api7-ingress-controller"
25+
parameters:
26+
apiGroup: "gateway.apisix.io"
27+
kind: "GatewayProxy"
28+
name: "api7-proxy-config"
29+
namespace: "default"
30+
scope: "Namespace"
31+
32+
---
33+
34+
apiVersion: networking.k8s.io/v1
35+
kind: Ingress
36+
metadata:
37+
name: api7-ingress-tls
38+
spec:
39+
ingressClassName: api7
40+
rules:
41+
- host: httpbin.example.com
42+
http:
43+
paths:
44+
- path: /
45+
pathType: Prefix
46+
backend:
47+
service:
48+
name: httpbin
49+
port:
50+
number: 80

examples/quickstart.yaml renamed to examples/httpbin/quickstart.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,24 @@ kind: GatewayClass
6161
metadata:
6262
name: api7
6363
spec:
64-
controllerName: "gateway.api7.io/api7-ingress-controller"
64+
controllerName: "gateway.apisix.io/api7-ingress-controller"
65+
66+
---
67+
68+
apiVersion: gateway.apisix.io/v1alpha1
69+
kind: GatewayProxy
70+
metadata:
71+
name: api7-proxy-config
72+
spec:
73+
provider:
74+
type: ControlPlane
75+
controlPlane:
76+
endpoints:
77+
- ${ADMIN_ENDPOINT} # https://127.0.0.1:7443
78+
auth:
79+
type: AdminKey
80+
adminKey:
81+
value: "${ADMIN_KEY}"
6582

6683
---
6784

@@ -75,8 +92,13 @@ spec:
7592
- name: http
7693
protocol: HTTP
7794
port: 80
95+
infrastructure:
96+
parametersRef:
97+
group: gateway.apisix.io
98+
kind: GatewayProxy
99+
name: api7-proxy-config
78100

79-
---
101+
---
80102

81103
apiVersion: gateway.networking.k8s.io/v1
82104
kind: HTTPRoute
@@ -95,4 +117,3 @@ spec:
95117
backendRefs:
96118
- name: httpbin
97119
port: 80
98-
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: gateway.apisix.io/v1alpha1
2+
kind: BackendTrafficPolicy
3+
metadata:
4+
name: httpbin
5+
spec:
6+
targetRefs:
7+
- name: httpbin
8+
kind: Service
9+
group: ""
10+
passHost: rewrite
11+
upstreamHost: httpbin.example.com
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: gateway.apisix.io/v1alpha1
2+
kind: BackendTrafficPolicy
3+
metadata:
4+
name: httpbin
5+
spec:
6+
targetRefs:
7+
- name: httpbin
8+
kind: Service
9+
group: ""
10+
timeout:
11+
send: 10s
12+
read: 10s
13+
connect: 10s

0 commit comments

Comments
 (0)