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

feat: KGO konnectExtension docs #8097

Merged
merged 9 commits into from
Oct 31, 2024
Merged
2 changes: 1 addition & 1 deletion app/_includes/md/kgo/konnect-entities-prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## Prerequisites
{% endunless %}

{% include md/kgo/prerequisites.md disable_accordian=true version=page.version release=page.release kconf-crds=true %}
{% include md/kgo/prerequisites.md disable_accordian=true version=page.version release=page.release mode="konnect" %}

### Create an access token in Konnect

Expand Down
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 kconf-crds=include.kconf-crds %}


{%- 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.kongplugininstallation %}

Expand Down
25 changes: 24 additions & 1 deletion app/_includes/snippets/gateway-operator/install_with_helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,33 @@ helm repo update kong

Install {{ site.kgo_product_name }} 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" \
pmalek marked this conversation as resolved.
Show resolved Hide resolved
--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 }} {{ if include.kconf-crds }}--set kubernetes-configuration-crds.enabled=true{{ endif }}
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" %}
114 changes: 96 additions & 18 deletions app/_src/gateway-operator/get-started/konnect/deploy-data-plane.md
mlavacca marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,30 @@ 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.
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/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.
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 gte:1.4.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`).

2. Now, create a [`KonnectExtension` resource](/gateway-operator/{{ page.release }}/reference/custom-resources#konnectextension). In the following manifest, replace the placeholders for `CP_ID`, `REGION`, and `HOSTNAME` with the values you just noted, 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
```

3. 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 gte:1.4.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" %}
Loading