Skip to content

Commit

Permalink
feat: KGO konnectExtension docs
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
  • Loading branch information
mlavacca committed Oct 29, 2024
1 parent d3e886f commit 030996d
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 37 deletions.
14 changes: 1 addition & 13 deletions app/_includes/md/kgo/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,7 @@ kubectl apply -f {{site.links.web}}/assets/gateway-operator/ai-gateway-crd.yaml

### Install {{ site.kgo_product_name }}

{% include snippets/gateway-operator/install_with_helm.md version=include.version release=include.release %}


{%- if include.aiGateway %}

### Enable the AI Gateway controller

As this guide uses the experimental AI Gateway feature, we need to explicitly enable it.

```bash
kubectl set env -n kong-system deployments/kgo-gateway-operator-controller-manager -c manager GATEWAY_OPERATOR_ENABLE_CONTROLLER_AIGATEWAY="true"
```
{% endif %}
{% include snippets/gateway-operator/install_with_helm.md version=include.version release=include.release mode=include.mode %}

{% if include.enterprise %}

Expand Down
22 changes: 21 additions & 1 deletion app/_includes/snippets/gateway-operator/install_with_helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,32 @@ helm repo add kong https://charts.konghq.com
helm repo update kong
```

Install {{ site.kgo_product_name }} with Helm:
Install {{ site.kgo_product_name == "true"}} with Helm:

{% if include.mode == "konnect" %}

```bash
helm upgrade --install kgo kong/gateway-operator -n kong-system --create-namespace --set image.tag={{ kgo_version }} --set env.ENABLE_CONTROLLER_KONNECT="true --set kubernetes-configuration-crds.enabled=true"
```

{% endif %}

{% if include.mode == "aigateway" %}

```bash
helm upgrade --install kgo kong/gateway-operator -n kong-system --create-namespace --set image.tag={{ kgo_version }} --set env.ENABLE_CONTROLLER_AIGATEWAY="true"
```

{% endif %}

{% if include.mode == "default" %}

```bash
helm upgrade --install kgo kong/gateway-operator -n kong-system --create-namespace --set image.tag={{ kgo_version }}
```

{% endif %}

You can wait for the operator to be ready using `kubectl wait`:

```bash
Expand Down
2 changes: 1 addition & 1 deletion app/_src/gateway-operator/get-started/kic/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ You can configure your `GatewayClass` and `Gateway` objects in a vendor independ

This means that CRDs for both the Gateway API and {{ site.kic_product_name }} have to be installed.

{% include md/kgo/prerequisites.md disable_accordian=true version=page.version release=page.release %}
{% include md/kgo/prerequisites.md disable_accordian=true version=page.version release=page.release mode="default" %}
112 changes: 95 additions & 17 deletions app/_src/gateway-operator/get-started/konnect/deploy-data-plane.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,29 @@ chapter: 2
To attach a {{ site.kgo_product_name }} data plane to {{ site.konnect_short_name }} the data plane needs to know which endpoint to connect to, and how to authenticate the requests.

To get the endpoint and the authentication details of the data plane.
1. [Log in to {{ site.konnect_short_name }}](https://cloud.konghq.com/login).
1. Navigate to {% konnect_icon runtimes %} [**Gateway Manager**](https://cloud.konghq.com/us/gateway-manager), choose the control plane, and click **Create a New Data Plane Node**.
1. In the **Create a Data Plane Node** page select *Kubernetes* as the **Platform**.
1. Create a namespace named `kong` in the Kubernetes cluster
```bash
kubectl create namespace kong
```
1. Click **Generate Certificate** in step 3.

1. [Log in to {{ site.konnect_short_name }}](https://cloud.konghq.com/login).
1. Navigate to {% konnect_icon runtimes %} [**Gateway Manager**](https://cloud.konghq.com/us/gateway-manager), choose the control plane, and click **New DataPlane Node**.
1. In the **Create a Data Plane Node** page select *Kubernetes* as the **Platform** and choose assign it a name. Do not complete the steps therein defined, as we'll use a different procedure.
1. Create a namespace named `kong` in the Kubernetes cluster

```bash
kubectl create namespace kong
```

1. Click **Generate Certificate** in step 3.
1. Save the contents of **Cluster Certificate** in a file named `tls.crt`. Save the contents of **Cluster Key** in a file named `tls.key`.
1. Create a Kubernetes secret containing the cluster certificate:
1. Create a Kubernetes secret containing the cluster certificate:

```bash
kubectl create secret tls kong-cluster-cert -n kong --cert=/{PATH_TO_FILE}/tls.crt --key=/{PATH_TO_FILE}/tls.key
kubectl create secret tls konnect-client-tls -n kong --cert=/{PATH_TO_FILE}/tls.crt --key=/{PATH_TO_FILE}/tls.key
```
1. In the **Configuration parameters** step 4, find the value of `cluster_server_name`. The first segment of that value is the control plane ID for your cluster. For example, if the value of `cluster_server_name` is `36fc5d01be.us.cp0.konghq.com`, then the control plane ID of the cluster is `36fc5d01be`.
1. Replace `YOUR_CP_ID` with your control plane ID in the following manifest and deploy the data plane with `kubectl apply`:

{% if_version lte:1.3.x %}

1. In the **Configuration parameters** step 4, find the value of `cluster_server_name`. The first segment of that value is the control plane ID for your cluster. For example, if the value of `cluster_server_name` is `36fc5d01be.us.cp0.konghq.com`, then the control plane ID of the cluster is `36fc5d01be`.

1. Replace `YOUR_CP_ID` with your control plane ID in the following manifest and deploy the data plane with `kubectl apply`:

```yaml
echo '
Expand Down Expand Up @@ -67,19 +74,90 @@ To get the endpoint and the authentication details of the data plane.
volumeMounts:
- name: cluster-certificate
mountPath: /var/cluster-certificate
- name: kong-cluster-cert
mountPath: /etc/secrets/kong-cluster-cert/
- name: konnect-client-tls
mountPath: /etc/secrets/konnect-client-tls/
readOnly: true
volumes:
- name: cluster-certificate
- name: kong-cluster-cert
- name: konnect-client-tls
secret:
secretName: kong-cluster-cert
secretName: konnect-client-tls
defaultMode: 420
' | kubectl apply -f -
```
The results should look like this:

The result should look like this:

```text
dataplane.gateway-operator.konghq.com/dataplane-example configured
```

{% endif_version %}

{% if_version gt:1.3.x %}

1. Extract the following values from the **Configuration parameters** step 4:
1. `CP_ID`: find the value of `cluster_server_name`. The first segment of that value is the control plane ID for your cluster. For example, if the value of `cluster_server_name` is `36fc5d01be.us.cp0.konghq.com`, then the control plane ID of the cluster is `36fc5d01be`
1. `REGION`: find the value in the bottom left corner of the screen.
1. `HOSTNAME`: the server you are connected to (e.g. `konghq.tech`, `konghq.com`).

1. Replace the values above in the following manifest and deploy it with `kubectl apply`

```yaml
echo '
kind: KonnectExtension
apiVersion: gateway-operator.konghq.com/v1alpha1
metadata:
name: example-konnect-config
namespace: kong
spec:
controlPlaneRef:
type: konnectID
konnectID: <CP_ID>
controlPlaneRegion: <REGION>
serverHostname: <HOSTNAME>
konnectControlPlaneAPIAuthConfiguration:
clusterCertificateSecretRef:
name: konnect-client-tls
' | kubectl apply -f -
```

The result should look like this:

```text
konnectextension.gateway-operator.konghq.com/example-konnect-config created
```

1. Deploy your data plane that references such a `KonnectExtension` with `kubectl apply`:

```yaml
echo '
apiVersion: gateway-operator.konghq.com/v1beta1
kind: DataPlane
metadata:
name: dataplane-example
namespace: kong
spec:
extensions:
- kind: KonnectExtension
name: example-konnect-config
group: gateway-operator.konghq.com
deployment:
podTemplateSpec:
spec:
containers:
- name: proxy
image: kong/kong-gateway:{{ site.data.kong_latest_gateway.ee-version }}
env:
- name: KONG_LOG_LEVEL
value: debug
' | kubectl apply -f -
```

The result should look like this:

```text
dataplane.gateway-operator.konghq.com/dataplane-example created
```

{% endif_version %}
10 changes: 9 additions & 1 deletion app/_src/gateway-operator/get-started/konnect/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ chapter: 1
{{ site.kgo_product_name }} can deploy and manage data planes attached to a {{ site.konnect_short_name }} control plane.
All the services, routes, and plugins are configured in {{ site.konnect_short_name }} and sent to the data planes automatically.

{% include md/kgo/prerequisites.md disable_accordian=true version=page.version release=page.release %}
{% if_version gt:1.3.x %}
{% assign mode = "konnect" %}
{% endif_version %}

{% if_version lte:1.3.x %}
{% assign mode = "default" %}
{% endif_version %}

{% include md/kgo/prerequisites.md disable_accordian=true version=page.version release=page.release mode=mode %}

Once the `gateway-operator-controller-manager` deployment is ready, you can deploy a `DataPlane` resource that is attached to a {{ site.konnect_short_name }} control plane.
4 changes: 2 additions & 2 deletions app/_src/gateway-operator/guides/ai-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The `AIGateway` CRD is an opinionated CRD to simplify getting started with [Kong

`AIGateway` allows you to configure `largeLanguageModels` and will translate the configuration in to `Gateway`, `HTTPRoute` and `KongPlugin` resources automatically.

{% include md/kgo/prerequisites.md version=page.version release=page.release aiGateway=true %}
{% include md/kgo/prerequisites.md version=page.version release=page.release mode="aigateway" %}

## Get Started

Expand Down Expand Up @@ -107,4 +107,4 @@ curl $PROXY_IP/devteam-chatgpt -H 'Content-Type: application/json' -X POST -d '{
}'
```

For more information about how to use the AI plugins, see the [plugin hub](/hub/kong-inc/ai-proxy/#input-formats).
For more information about how to use the AI plugins, see the [plugin hub](/hub/kong-inc/ai-proxy/#input-formats).
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ badge: enterprise

{{ site.kgo_product_name }} can scrape {{ site.base_gateway }} and enrich it with Kubernetes metadata so that it can be used by users to autoscale their workloads.

{% include md/kgo/prerequisites.md version=page.version release=page.release enterprise=true %}
{% include md/kgo/prerequisites.md version=page.version release=page.release enterprise=true mode="default" %}

## Overview

Expand Down
2 changes: 1 addition & 1 deletion app/_src/gateway-operator/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ title: Install

[kgochart]: https://github.com/Kong/charts/tree/main/charts/gateway-operator

{% include md/kgo/prerequisites.md disable_accordian=true version=page.version release=page.release %}
{% include md/kgo/prerequisites.md disable_accordian=true version=page.version release=page.release mode="default" %}

0 comments on commit 030996d

Please sign in to comment.