From 09ba59ab76f3b48aac41c1d9a72daf977a4f6a85 Mon Sep 17 00:00:00 2001 From: Mattia Lavacca Date: Tue, 29 Oct 2024 09:56:02 +0100 Subject: [PATCH] feat: KGO konnectExtension docs Signed-off-by: Mattia Lavacca --- app/_includes/md/kgo/prerequisites.md | 14 +-- .../gateway-operator/install_with_helm.md | 22 +++- .../get-started/kic/install.md | 2 +- .../get-started/konnect/deploy-data-plane.md | 112 +++++++++++++++--- .../get-started/konnect/install.md | 10 +- .../gateway-operator/guides/ai-gateway.md | 4 +- .../guides/autoscaling-workloads/overview.md | 2 +- app/_src/gateway-operator/install.md | 2 +- 8 files changed, 131 insertions(+), 37 deletions(-) diff --git a/app/_includes/md/kgo/prerequisites.md b/app/_includes/md/kgo/prerequisites.md index 471d44f02912..476186a242b0 100644 --- a/app/_includes/md/kgo/prerequisites.md +++ b/app/_includes/md/kgo/prerequisites.md @@ -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 %} diff --git a/app/_includes/snippets/gateway-operator/install_with_helm.md b/app/_includes/snippets/gateway-operator/install_with_helm.md index db1866435096..18c85ae382dc 100644 --- a/app/_includes/snippets/gateway-operator/install_with_helm.md +++ b/app/_includes/snippets/gateway-operator/install_with_helm.md @@ -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 diff --git a/app/_src/gateway-operator/get-started/kic/install.md b/app/_src/gateway-operator/get-started/kic/install.md index 2fe317e9909b..bec4b2d5682d 100644 --- a/app/_src/gateway-operator/get-started/kic/install.md +++ b/app/_src/gateway-operator/get-started/kic/install.md @@ -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" %} diff --git a/app/_src/gateway-operator/get-started/konnect/deploy-data-plane.md b/app/_src/gateway-operator/get-started/konnect/deploy-data-plane.md index 6ea1dcf6b98b..12c5036779ea 100644 --- a/app/_src/gateway-operator/get-started/konnect/deploy-data-plane.md +++ b/app/_src/gateway-operator/get-started/konnect/deploy-data-plane.md @@ -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 ' @@ -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: + controlPlaneRegion: + serverHostname: + 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 %} diff --git a/app/_src/gateway-operator/get-started/konnect/install.md b/app/_src/gateway-operator/get-started/konnect/install.md index 83bd9db98662..0d9589b20908 100644 --- a/app/_src/gateway-operator/get-started/konnect/install.md +++ b/app/_src/gateway-operator/get-started/konnect/install.md @@ -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. diff --git a/app/_src/gateway-operator/guides/ai-gateway.md b/app/_src/gateway-operator/guides/ai-gateway.md index 627896856700..767409af6796 100644 --- a/app/_src/gateway-operator/guides/ai-gateway.md +++ b/app/_src/gateway-operator/guides/ai-gateway.md @@ -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 @@ -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). \ No newline at end of file +For more information about how to use the AI plugins, see the [plugin hub](/hub/kong-inc/ai-proxy/#input-formats). diff --git a/app/_src/gateway-operator/guides/autoscaling-workloads/overview.md b/app/_src/gateway-operator/guides/autoscaling-workloads/overview.md index 8d7d871f2d4c..86166d8fa838 100644 --- a/app/_src/gateway-operator/guides/autoscaling-workloads/overview.md +++ b/app/_src/gateway-operator/guides/autoscaling-workloads/overview.md @@ -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 diff --git a/app/_src/gateway-operator/install.md b/app/_src/gateway-operator/install.md index a4c8f33cb639..e2aecb81829f 100644 --- a/app/_src/gateway-operator/install.md +++ b/app/_src/gateway-operator/install.md @@ -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" %}