Skip to content

Commit 6920a51

Browse files
mheapGuaris
andauthored
Feat(Platform): Replace httproute include with httproute block (#3721)
* Replace httproute include with httproute block * vale * vale --------- Co-authored-by: Angel <[email protected]>
1 parent 1c91ba6 commit 6920a51

File tree

17 files changed

+359
-119
lines changed

17 files changed

+359
-119
lines changed

app/_how-tos/kic-external-service.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,23 @@ spec:
5858
## Create an HTTPRoute
5959

6060
To route HTTP traffic, you need to create an `HTTPRoute` or an `Ingress` resource pointing at your Kubernetes `Service`.
61-
62-
{% include_cached /k8s/httproute.md path='/httpbin' name='proxy-from-k8s-to-httpbin' service='proxy-to-httpbin' port='80' skip_host=true %}
63-
61+
<!--vale off-->
62+
{% httproute %}
63+
name: proxy-from-k8s-to-httpbin
64+
matches:
65+
- path: /httpbin
66+
service: proxy-to-httpbin
67+
port: 80
68+
{% endhttproute %}
69+
<!--vale on-->
6470
## Validate your configuration
6571

6672
Once the resource has been reconciled, you'll be able to call the `/httpbin` endpoint and {{ site.base_gateway }} will route the request to the external `httpbin` service.
67-
73+
<!--vale off-->
6874
{% validation request-check %}
6975
url: /httpbin/anything
7076
status_code: 200
7177
on_prem_url: $PROXY_IP
7278
konnect_url: $PROXY_IP
7379
{% endvalidation %}
80+
<!--vale on-->

app/_how-tos/kic-get-started-services-routes.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,16 @@ kubectl apply -f {{ site.links.web }}/manifests/kic/echo-service.yaml -n kong
8585

8686
To route traffic to the `echo` service, create an `HTTPRoute` or `Ingress` resource:
8787

88-
{% include_cached /k8s/httproute.md path='/echo' name='echo' service='echo' port='1027' skip_host=true %}
88+
89+
<!--vale off-->
90+
{% httproute %}
91+
matches:
92+
- path: /echo
93+
service: echo
94+
port: 1027
95+
skip_host: true
96+
{% endhttproute %}
97+
<!--vale on-->
8998

9099
## Validate your configuration
91100

app/_how-tos/kic-observability-prometheus-grafana.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,22 @@ Deploy the Services and create routing resources:
9595
```bash
9696
kubectl apply -f {{ site.links.web }}/manifests/kic/multiple-services.yaml -n kong
9797
```
98-
99-
{% include_cached /k8s/httproute.md name='sample-routes' path='/billing,/comments,/invoice' service='billing,comments,invoice' port='80,80,80' skip_host=true %}
98+
<!--vale off-->
99+
{% httproute %}
100+
name: sample-routes
101+
matches:
102+
- path: /billing
103+
service: billing
104+
port: 80
105+
- path: /comments
106+
service: comments
107+
port: 80
108+
- path: /invoice
109+
service: invoice
110+
port: 80
111+
skip_host: true
112+
{% endhttproute %}
113+
<!--vale on-->
100114

101115
## Generate traffic
102116

app/_how-tos/kic-plugin-authentication.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,16 @@ data:
173173

174174
To route HTTP traffic, you need to create an `HTTPRoute` or an `Ingress` resource pointing at your Kubernetes `Service`.
175175

176-
{% include_cached /k8s/httproute.md path='/echo' name='echo' service='echo' port='1027' skip_host=true %}
176+
<!--vale off-->
177+
{% httproute %}
178+
name: echo
179+
matches:
180+
- path: /echo
181+
service: echo
182+
port: 1027
183+
skip_host: true
184+
{% endhttproute %}
185+
<!--vale on-->
177186

178187
## Validate your configuration
179188

app/_how-tos/kic-plugin-custom.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,17 @@ data:
150150

151151
1. Create a Route to the `echo` service to test your custom plugin:
152152

153-
{% include_cached /k8s/httproute.md path='/echo' name='echo' service='echo' port='1027' skip_host=true indent=4 %}
153+
<!--vale off-->
154+
{% httproute %}
155+
name: echo
156+
matches:
157+
- path: /echo
158+
service: echo
159+
port: 1027
160+
skip_host: true
161+
indent: 4
162+
{% endhttproute %}
163+
<!--vale on-->
154164

155165
## Validate your configuration
156166

app/_how-tos/kic-plugin-degraphql.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,16 @@ curl -X POST -H "Content-Type:application/json" -H "X-Hasura-Role:admin" http://
142142

143143
Our Hasura API will be exposed using the `/contacts` path. Create an `HTTPRoute` or `Ingress` resource pointing to the `hasura` Service that we can attach the `degraphql` plugin to:
144144

145-
{% include_cached /k8s/httproute.md path='/contacts' name='demo-graphql' service='hasura' port='80' namespace='kong' skip_host=true %}
146-
145+
<!--vale off-->
146+
{% httproute %}
147+
name: demo-graphql
148+
matches:
149+
- path: /contacts
150+
service: hasura
151+
port: 80
152+
skip_host: true
153+
{% endhttproute %}
154+
<!--vale on-->
147155
## Configure the DeGraphQL plugin
148156

149157
The `degraphql` plugin accepts a single configuration option, `graphql_server_path`. Create a `KongPlugin` resource and attach it to the `demo-graphql` route that you just created:

app/_how-tos/kic-proxy-http.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@ cleanup:
4848
## Create an HTTPRoute
4949

5050
To route HTTP traffic, you need to create an `HTTPRoute` or an `Ingress` resource pointing at your Kubernetes `Service`:
51-
52-
{% include_cached /k8s/httproute.md path='/echo' name='echo' service='echo' port='1027' skip_host=true %}
53-
51+
<!--vale off-->
52+
{% httproute %}
53+
name: echo
54+
matches:
55+
- path: /echo
56+
service: echo
57+
port: 1027
58+
skip_host: true
59+
{% endhttproute %}
60+
<!--vale on-->
5461
## Validate your configuration
5562

5663
Once the resource has been reconciled, you'll be able to call the `/echo` endpoint and {{ site.base_gateway }} will route the request to the `echo` service:

app/_how-tos/kic-proxy-https.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,18 @@ kubectl patch -n kong --type=json gateway kong -p='[
7676

7777
To route HTTP traffic, you need to create an `HTTPRoute` or an `Ingress` resource pointing at your Kubernetes `Service`.
7878

79-
{% include_cached /k8s/httproute.md path='/echo' name='echo' service='echo' port='1027' hostname='demo.example.com' section_name='https' %}
8079

80+
<!--vale off-->
81+
{% httproute %}
82+
name: echo
83+
matches:
84+
- path: /echo
85+
service: echo
86+
port: 1027
87+
hostname: demo.example.com
88+
section_name: https
89+
{% endhttproute %}
90+
<!--vale on-->
8191
## Validate your configuration
8292

8393
Once the resource has been reconciled, you'll be able to call the `/echo` endpoint and {{ site.base_gateway }} will route the request to the `echo` service.

app/_how-tos/kic-proxy-rewriting-paths.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,20 @@ The annotation can be used on `Ingress` and `HTTPRoute` resources, and configure
6161

6262
The following definition creates a Route that matches the path `/external-path/(\w+)` and rewrites it to `/anything/$1` before sending the request upstream:
6363

64-
{% include /k8s/httproute.md disable_gateway=true path='/external-path/(\w+)' name='httpbin' service='httpbin' port='80' skip_host=true route_type='RegularExpression' annotation_rewrite="/anything/$1" %}
64+
<!--vale off-->
65+
{% httproute %}
66+
name: httpbin
67+
matches:
68+
- path: /external-path/(\w+)
69+
service: httpbin
70+
port: 80
71+
route_type: RegularExpression
72+
annotation_rewrite: /anything/$1
73+
skip_host: true
74+
disable_gateway: true
75+
{% endhttproute %}
76+
<!--vale on-->
77+
6578

6679
Alternatively, you can define this in a plugin configuration:
6780

app/_how-tos/kic-redirect-to-https.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ cleanup:
5151

5252
To route HTTP traffic, you need to create an `HTTPRoute` or an `Ingress` resource pointing at your Kubernetes `Service`.
5353

54-
{% include /k8s/httproute.md path='/echo' name='echo' service='echo' port='1027' skip_host=true %}
54+
<!--vale off-->
55+
{% httproute %}
56+
matches:
57+
- path: /echo
58+
service: echo
59+
port: 1027
60+
skip_host: true
61+
{% endhttproute %}
62+
<!--vale on-->
5563

5664
## Add TLS configuration
5765

0 commit comments

Comments
 (0)