Skip to content

Commit 01666be

Browse files
authored
docs: v1alpha2 updates for httproute guide (kubernetes-sigs#786)
1 parent db18d56 commit 01666be

File tree

5 files changed

+86
-28
lines changed

5 files changed

+86
-28
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
kind: HTTPRoute
2+
apiVersion: gateway.networking.k8s.io/v1alpha2
3+
metadata:
4+
name: bar-route
5+
spec:
6+
parentRefs:
7+
- name: example-gateway
8+
hostnames:
9+
- "bar.example.com"
10+
rules:
11+
- matches:
12+
- headers:
13+
- type: Exact
14+
name: env
15+
value: canary
16+
backendRefs:
17+
- name: bar-svc-canary
18+
port: 8080
19+
- name: bar-svc
20+
port: 8080
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: HTTPRoute
2+
apiVersion: gateway.networking.k8s.io/v1alpha2
3+
metadata:
4+
name: foo-route
5+
spec:
6+
parentRefs:
7+
- name: example-gateway
8+
hostnames:
9+
- "foo.example.com"
10+
rules:
11+
- matches:
12+
- path:
13+
type: Prefix
14+
value: /login
15+
backendRefs:
16+
- name: foo-svc
17+
port: 8080
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
kind: Gateway
2+
apiVersion: gateway.networking.k8s.io/v1alpha2
3+
metadata:
4+
name: example-gateway
5+
spec:
6+
gatewayClassName: example-gateway-class
7+
listeners:
8+
- name: http
9+
protocol: HTTP
10+
port: 80
11+
---
12+
kind: HTTPRoute
13+
apiVersion: gateway.networking.k8s.io/v1alpha2
14+
metadata:
15+
name: example-route
16+
spec:
17+
parentRefs:
18+
- name: example-gateway
19+
hostnames:
20+
- "example.com"
21+
rules:
22+
- backendRefs:
23+
- name: example-svc
24+
port: 80

site-src/v1alpha2/guides/getting-started.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Getting started with Gateway APIs
22

33
!!! danger
4-
This page has not been updated for v1alpha2 yet.
4+
This page and some of its sub-pages are not fully updated for v1alpha2 yet.
55

66
**1.** **[Install a Gateway controller](#installing-a-gateway-controller)**
7-
_OR_ **[install the Gateway API CRDs manually](#installing-gateway-api-crds-manually)**
7+
_OR_ **[install the Gateway API CRDs manually](#installing-gateway-api-crds-manually)**
88

99
_THEN_
1010

@@ -19,32 +19,32 @@ _THEN_
1919

2020
## Installing a Gateway controller
2121

22-
There are [multiple projects](/v1alpha2/references/implementations) that support the Gateway
23-
API. By installing a Gateway controller in your Kubernetes cluster, you can
24-
try out the guides above. This will demonstrate that the desired routing
22+
There are [multiple projects](/references/implementations) that support the
23+
Gateway API. By installing a Gateway controller in your Kubernetes cluster,
24+
you can try out the guides above. This will demonstrate that the desired routing
2525
configuration is actually being implemented by your Gateway resources (and the
26-
network infrastructure that your Gateway resources represent). Note that many
27-
of the Gateway controller setups will install and remove the Gateway API CRDs
26+
network infrastructure that your Gateway resources represent). Note that many
27+
of the Gateway controller setups will install and remove the Gateway API CRDs
2828
for you.
2929

3030
## Installing Gateway API CRDs manually
3131

3232
The following command will install the Gateway API CRDs. This includes the
33-
GatewayClass, Gateway, HTTPRoute, TCPRoute, and more. Note that a running
34-
Gateway controller in your Kubernetes cluster is required to actually act on
35-
these resources. Installing the CRDs will just allow you to see and apply the
33+
GatewayClass, Gateway, HTTPRoute, TCPRoute, and more. Note that a running
34+
Gateway controller in your Kubernetes cluster is required to actually act on
35+
these resources. Installing the CRDs will just allow you to see and apply the
3636
resources, though they won't do anything.
3737

3838
```
3939
kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v0.3.0" \
4040
| kubectl apply -f -
4141
```
4242

43-
After you're done, you can clean up after yourself by uninstalling the
44-
Gateway API CRDs. The following command will remove all GatewayClass, Gateway,
43+
After you're done, you can clean up after yourself by uninstalling the
44+
Gateway API CRDs. The following command will remove all GatewayClass, Gateway,
4545
and associated resources in your cluster. If these resources are in-use or
46-
if they were installed by a Gateway controller, then do not uninstall them.
47-
This will uninstall the Gateway API CRDs for the entire cluster. Do not do
46+
if they were installed by a Gateway controller, then do not uninstall them.
47+
This will uninstall the Gateway API CRDs for the entire cluster. Do not do
4848
this if they might be in-use by someone else as this will break anything using
4949
these resources.
5050

site-src/v1alpha2/guides/http-routing.md

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# HTTP routing
22

3-
!!! danger
4-
This page has not been updated for v1alpha2 yet.
5-
6-
73
The [HTTPRoute resource](/v1alpha2/api-types/httproute) allows you to match on HTTP traffic and
84
direct it to Kubernetes backends. This guide shows how the HTTPRoute matches
95
traffic on host, header, and path fields and forwards it to different
@@ -26,18 +22,16 @@ Gateway which allows Routes to merge on a Gateway as long as they don't
2622
conflict. For more information on Route merging, refer to the [HTTPRoute
2723
documentation](/v1alpha2/api-types/httproute#merging).
2824

29-
The following `prod-web` Gateway is defined from the `acme-lb` GatewayClass.
30-
`prod-web` listens for HTTP traffic on port 80 and will bind to all Routes in
31-
the same Namespace that have the matching `gateway: prod-web-gw` label.
32-
Route labels and Gateway label selectors allow Routes and Gateways to be
33-
bound to each other by their respective owners.
25+
In order to receive traffic from a [Gateway][gateway] an `HTTPRoute` resource
26+
must be configured with `ParentRefs` which reference the parent gateway(s) that it
27+
should be attached to. The following example shows how the combination
28+
of `Gateway` and `HTTPRoute` would be configured to serve HTTP traffic:
3429

3530
```yaml
36-
{% include 'v1alpha1/http-routing/gateway.yaml' %}
31+
{% include 'v1alpha2/http-routing/gateway.yaml' %}
3732
```
3833

39-
An HTTPRoute can match against a [single set of
40-
hostnames](https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRouteSpec).
34+
An HTTPRoute can match against a [single set of hostnames][spec].
4135
These hostnames are matched before any other matching within the HTTPRoute takes
4236
place. Since `foo.example.com` and `bar.example.com` are separate hosts with
4337
different routing requirements, each is deployed as its own HTTPRoute -
@@ -50,7 +44,7 @@ forwarded. Traffic to any other paths that do not begin with `/login` will not
5044
be matched by this Route.
5145

5246
```yaml
53-
{% include 'v1alpha1/http-routing/foo-httproute.yaml' %}
47+
{% include 'v1alpha2/http-routing/foo-httproute.yaml' %}
5448
```
5549

5650
Similarly, the `bar-route` HTTPRoute matches traffic for `bar.example.com`. All
@@ -60,6 +54,9 @@ canary` header will be forwarded to `bar-svc-canary` and if the header is
6054
missing or not `canary` then it'll be forwarded to `bar-svc`.
6155

6256
```yaml
63-
{% include 'v1alpha1/http-routing/bar-httproute.yaml' %}
57+
{% include 'v1alpha2/http-routing/bar-httproute.yaml' %}
6458
```
6559

60+
[gateway]:https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRouteSpec
61+
[spec]:https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRouteSpec
62+
[svc]:https://kubernetes.io/docs/concepts/services-networking/service/

0 commit comments

Comments
 (0)