Skip to content

Commit

Permalink
site: update Gateway API guide for v1alpha2
Browse files Browse the repository at this point in the history
Closes projectcontour#4091.

Signed-off-by: Steve Kriss <krisss@vmware.com>
  • Loading branch information
skriss committed Oct 19, 2021
1 parent 1442771 commit 1c701c1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 41 deletions.
14 changes: 7 additions & 7 deletions examples/gateway/kuard/kuard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ spec:
type: ClusterIP
---
kind: HTTPRoute
apiVersion: networking.x-k8s.io/v1alpha1
apiVersion: gateway.networking.k8s.io/v1alpha2
metadata:
name: kuard
namespace: projectcontour
labels:
app: kuard
spec:
parentRefs:
- name: contour
hostnames:
- "local.projectcontour.io"
- local.projectcontour.io
rules:
- matches:
- path:
type: Prefix
type: PathPrefix
value: /
forwardTo:
- serviceName: kuard
backendRefs:
- name: kuard
port: 80
44 changes: 10 additions & 34 deletions site/content/guides/gateway-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ The following prerequisites must be met before using Gateway API with Contour:
- A working [Kubernetes][2] cluster. Refer to the [compatibility matrix][3] for cluster version requirements.
- The [kubectl][4] command-line tool, installed and configured to access your cluster.

## Deploying Contour with Gateway API

### Option #1: Gateway API with Contour

Refer to the [contour][6] design for additional background on the Gateway API implementation.
Expand All @@ -51,32 +53,8 @@ This command creates:
- Contour RBAC resources
- Contour Deployment / Service
- Envoy Daemonset / Service
- Properly configured Configuration file for Gateway API
- GatewayAPI Gateway
- GatewayAPI Gateway Class

Create the Gateway API HTTPRoute to define how traffic should be routed:

```yaml
kind: HTTPRoute
apiVersion: networking.x-k8s.io/v1alpha1
metadata:
name: root
namespace: projectcontour
spec:
gateways:
allow: All
hostnames:
- local.projectcontour.io
rules:
- matches:
- path:
type: Prefix
value: /
forwardTo:
- serviceName: kuard
port: 80
```
- Contour ConfigMap enabling Gateway API support
- Gateway API GatewayClass and Gateway

See the last section (Testing the Gateway API) on how to test it all out!

Expand Down Expand Up @@ -111,15 +89,13 @@ $ kubectl apply -f {{< param base_url >}}/quickstart/gateway-nodeport.yaml
Either of the above options create:

- Namespace `projectcontour` to run the Gateway and child resources, i.e. Envoy DaemonSet.
- A Contour custom resource named `contour-gateway-sample` in the operator's namespace. This resource exposes
infrastructure-specific configuration and is referenced by the GatewayClass.
- A Contour custom resource named `contour-gateway-sample` in the operator's namespace. This resource exposes infrastructure-specific configuration and is referenced by the GatewayClass.
- A GatewayClass named `sample-gatewayclass` that abstracts the infrastructure-specific configuration from Gateways.
- A Gateway named `contour` in namespace `projectcontour`. This gateway will serve the test application through routing
rules deployed in the next step.
- A Gateway named `contour` in namespace `projectcontour`. This gateway will serve the test application through routing rules deployed in the next step.

See the next section (Testing the Gateway API) on how to test it all out!

### Testing the Gateway API
## Testing the Gateway API

Run the test application:
```shell
Expand All @@ -129,7 +105,7 @@ This command creates:

- A Deployment named `kuard` in namespace `projectcontour` to run kuard as the test application.
- A Service named `kuard` in namespace `projectcontour` to expose the kuard application on TCP port 80.
- An HTTPRoute named `kuard` in namespace `projectcontour` to route requests for "*.projectcontour.io" to the kuard
- An HTTPRoute named `kuard` in namespace `projectcontour` to route requests for `local.projectcontour.io` to the kuard
service.

Verify the kuard resources are available:
Expand All @@ -143,8 +119,8 @@ pod/kuard-798585497b-zw42m 1/1 Running 0 21s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kuard ClusterIP 172.30.168.168 <none> 80/TCP 21s

NAME HOSTNAMES
httproute.networking.x-k8s.io/kuard ["local.projectcontour.io"]
NAME HOSTNAMES
httproute.gateway.networking.k8s.io/kuard ["local.projectcontour.io"]
```

Test access to the kuard application:
Expand Down

0 comments on commit 1c701c1

Please sign in to comment.