Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api gw 1.16 updates #18081

Merged
merged 9 commits into from
Jul 12, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Specify the following parameters to declare a `Gateway`:
| `fields` | Specifies the configurations for the Gateway. The fields are listed in the [configuration model](#configuration-model). Details for each field are described in the [specification](#specification). | Required |



## Configuration model

The following outline shows how to format the configurations in the `Gateway` object. Click on a property name to view details about the configuration.
Expand Down Expand Up @@ -196,7 +195,7 @@ The following example creates a `Gateway` named `example-gateway` in namespace `
name: example-gateway
namespace: gateway-namespace
spec:
gatewayClassName: consul-api-gateway
gatewayClassName: consul
listeners:
- protocol: HTTPS
port: 443
Expand Down
7 changes: 4 additions & 3 deletions website/content/docs/api-gateway/configuration/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ This topic provides an overview of the configuration items that enable Consul AP
- [GatewayClass](/consul/docs/api-gateway/configuration/gatewayclass) defines a class of gateway resources that you can use as a template for creating gateways.
- [GatewayClassConfig](/consul/docs/api-gateway/configuration/gatewayclassconfig) describes additional Consul API Gateway-related configuration parameters for the GatewayClass resource.
- [Routes](/consul/docs/api-gateway/configuration/routes) specifies the path from the gateway to the backend service(s) client to the listener.
- [Intentions](/consul/docs/api-gateway/configuration/intentions) specifies traffic communication rules between Consul API Gateway and services in the Consul service mesh.
eddie-rowe marked this conversation as resolved.
Show resolved Hide resolved

You can create a basic Gateway object using the default [`gatewayClassName`](/consul/docs/api-gateway/configuration/gateway#gatewayclassname) (`consul-api-gateway`). If you want to create custom Gateways suitable for your environment, complete the following steps:
You can create a basic Gateway object using the default [`gatewayClassName`](/consul/docs/api-gateway/configuration/gateway#gatewayclassname) (`consul`). If you want to create custom Gateways suitable for your environment, complete the following steps:

1. Define a [GatewayClassConfig](/consul/docs/api-gateway/configuration/gatewayclassconfig) that contains your custom configurations.
1. Define a [GatewayClass](/consul/docs/api-gateway/configuration/gatewayclass) and configure the [`parametersRef.name`](/consul/docs/api-gateway/configuration/gatewayclass#parametersref-name) to reference the name of your [GatewayClassConfig](/consul/docs/api-gateway/configuration/gatewayclassconfig).
1. Define a [Gateway](/consul/docs/api-gateway/configuration/gateway) and configure the [`gatewayClassName`](/consul/docs/api-gateway/configuration/gateway#gatewayclassname) to reference the name of your [GatewayClass](/consul/docs/api-gateway/configuration/gatewayclass).
2. Define a [GatewayClass](/consul/docs/api-gateway/configuration/gatewayclass) and configure the [`parametersRef.name`](/consul/docs/api-gateway/configuration/gatewayclass#parametersref-name) to reference the name of your [GatewayClassConfig](/consul/docs/api-gateway/configuration/gatewayclassconfig).
3. Define a [Gateway](/consul/docs/api-gateway/configuration/gateway) and configure the [`gatewayClassName`](/consul/docs/api-gateway/configuration/gateway#gatewayclassname) to reference the name of your [GatewayClass](/consul/docs/api-gateway/configuration/gatewayclass).
eddie-rowe marked this conversation as resolved.
Show resolved Hide resolved

<!--TODO add diagram -->
31 changes: 31 additions & 0 deletions website/content/docs/api-gateway/configuration/intentions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
eddie-rowe marked this conversation as resolved.
Show resolved Hide resolved
layout: docs
page_title: Intention Configuration
description: >-
Intentions for Consul API Gateway control behavior for traffic into the service mesh according to rules. Learn about the required intentions and review an example configuration.
---
eddie-rowe marked this conversation as resolved.
Show resolved Hide resolved

# Route Resource Configuration
eddie-rowe marked this conversation as resolved.
Show resolved Hide resolved

This topic describes how to create and configure `Intention` resources for Consul API Gateway. Intentions are mechanisms that control traffic communication between services in the Consul service mesh.

## Create an intention

The following example creates an intention for the `echo` service that allows traffic from the `api-gateway` service:

<CodeBlockConfig filename="routes.yaml">

```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceIntentions
metadata:
name: api-gateway
spec:
destination:
name: echo
sources:
- name: api-gateway
action: allow
```

</CodeBlockConfig>
4 changes: 2 additions & 2 deletions website/content/docs/api-gateway/configuration/routes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following example creates a route named `example-route` associated with a li
<CodeBlockConfig filename="routes.yaml">

```yaml
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: example-route
Expand Down Expand Up @@ -132,7 +132,7 @@ The following example creates a route named `example-route` in namespace `gatewa
<CodeBlockConfig filename="route_with_referencegrant.yaml">

```yaml
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: example-route
Expand Down
2 changes: 2 additions & 0 deletions website/content/docs/api-gateway/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ The Consul API gateway ships with Consul and is automatically installed when you
name: consul
connectInject:
enabled: true
apiGateway:
manageExternalCRDs: true
```

</CodeBlockConfig>
Expand Down
17 changes: 6 additions & 11 deletions website/content/docs/api-gateway/usage/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,23 @@ This topic describes how to use Consul API Gateway.
Complete the following steps to use Consul API Gateway in your network.

1. Verify that the [requirements](/consul/docs/api-gateway/tech-specs) have been met.
1. Verify that the Consul API Gateway CRDs and controller have been installed and applied. Refer to [Installation](/consul/docs/api-gateway/install) for details.
2. Verify that the Consul API Gateway CRDs have been installed and applied. Refer to [Installation](/consul/docs/api-gateway/install) for details.
eddie-rowe marked this conversation as resolved.
Show resolved Hide resolved

## Configuration

Configure your [`Gateway`](/consul/docs/api-gateway/configuration/gateway) and [`Routes`](/consul/docs/api-gateway/configuration/routes) as described in [Consul API Gateway Configuration](/consul/docs/api-gateway/configuration).
Configure the following resources for your environment as described in [Consul API Gateway Configuration](/consul/docs/api-gateway/configuration).

<CodeBlockConfig hideClipboard filename="values.yaml">
1. [`Gateway`](/consul/docs/api-gateway/configuration/gateway)
2. [`Routes`](/consul/docs/api-gateway/configuration/routes)
3. [`Intentions`](/consul/docs/api-gateway/configuration/intentions)
eddie-rowe marked this conversation as resolved.
Show resolved Hide resolved

```yaml
apiGateway:
enabled: true
managedGatewayClass:
```

</CodeBlockConfig>

## Apply configurations

Issue the `kubectl apply` command to implement the configurations:

```shell-session
$ kubectl apply -f gateway.yaml routes.yaml
$ kubectl apply -f gateway.yaml route.yaml intentions.yaml
eddie-rowe marked this conversation as resolved.
Show resolved Hide resolved
```


Expand Down