diff --git a/.github/styles/base/Dictionary.txt b/.github/styles/base/Dictionary.txt index 53a5d4c69..b4d3bd6ad 100644 --- a/.github/styles/base/Dictionary.txt +++ b/.github/styles/base/Dictionary.txt @@ -378,6 +378,8 @@ enum env etag etcd +event_hook +eventhooks eventTime failover favicon @@ -507,6 +509,7 @@ loggly lookup lookups loopback +llm lua max_args max_headers @@ -775,4 +778,4 @@ yaml yml yq zipkin -zsh \ No newline at end of file +zsh diff --git a/.github/styles/docs/Frontmatter.txt b/.github/styles/docs/Frontmatter.txt index c43b59ce0..315d5b700 100644 --- a/.github/styles/docs/Frontmatter.txt +++ b/.github/styles/docs/Frontmatter.txt @@ -11,4 +11,6 @@ prereqs related_resources tier tldr -works_on \ No newline at end of file +works_on +konnect_product_id +no_version \ No newline at end of file diff --git a/app/_data/entity_examples/upstream/example-upstream.yml b/app/_data/entity_examples/upstream/example-upstream.yml new file mode 100644 index 000000000..793eddea1 --- /dev/null +++ b/app/_data/entity_examples/upstream/example-upstream.yml @@ -0,0 +1,5 @@ +name: my-upstream +paths: + - /upstreams +service: + name: example-upstreams \ No newline at end of file diff --git a/app/_data/schemas/frontmatter/how_to.json b/app/_data/schemas/frontmatter/how_to.json index 6f1c693ed..2d60c944a 100644 --- a/app/_data/schemas/frontmatter/how_to.json +++ b/app/_data/schemas/frontmatter/how_to.json @@ -39,5 +39,5 @@ "works_on" ] }, - "required": ["tldr", "content_type", "title"] + "required": ["tldr", "content_type", "title", "products"] } diff --git a/app/_gateway_entities/event-hook.md b/app/_gateway_entities/event-hook.md new file mode 100644 index 000000000..babd0f39c --- /dev/null +++ b/app/_gateway_entities/event-hook.md @@ -0,0 +1,166 @@ +--- +title: Event Hooks +content_type: reference +entities: + - event-hook +tier: enterprise +description: Event Hooks allow {{site.base_gateway}} monitor to communicate with target services or resources, notifying the target resource that an event was triggered. +related_resources: + - text: Gateway Services + url: /gateway/entities/service/ + - text: Routing in {{site.base_gateway}} + url: /gateway/routing/ +products: + - gateway +tools: + - admin-api +schema: + api: gateway/admin-ee + path: /schemas/Event-Hooks + + +--- + +## What is an Event Hook + +An Event Hook is a {{site.base_gateway}} entity that can be configured to listen for specific events from Kong entities. An Event Hook can be configured to send information to logs, or web hooks as well as third-party applications. + +## How do Event Hooks work? + +{{site.base_gateway}} Event Hooks work by configuring the following three elements: + +* Sources: The actions or operation that trigger the Event Hook. +* Events: The Kong entity that the Event Hook monitors for actions. +* Handlers: The mechanism that defines what action is performed when an event is triggered, like sending a webhook, logging, or executing custom code. + + +{% mermaid %} +flowchart LR + subgraph events [Kong Gateway Events] + A(Gateway Service
Create
Delete
Modify) + B(Admins
Create
Delete
Modify) + end + + subgraph handlers [Handlers] + C(Webhook) + D(logs
) + E(webhook-custom) + F(Lambda) + end + + subgraph output [Output] + W( POST to third party application) + X( Log to /usr/local/kong/logs/error.log) + Y( POST to third party application
Fully customizable) + Z( Custom Code Lua code ) + end + + A --> handlers + B --> handlers + + C --> W + D --> X + E --> Y + F --> Z +{% endmermaid %} + + +### Handlers + +There are four types of handlers that can be used with Event Hooks: + +* **`webhook`**: Issues a `POST` request to a provided URL with the event data as a payload. +* **`log`**: Logs the event and the content of the payload as a {{site.base_gateway}} log. +* **`webhook-custom`**: Fully configurable request. Supports templating, configurable body, payload, and headers. +* **`lambda`**: This handler runs Lua code after an event is triggered. + +By default, the `lambda` handler is "Sandboxed". Sandboxing means that {{site.base_gateway}} restricts the types of Lua functions that can be loaded as well as the level of access to {{site.base_gateway}} that is available for these custom functions. For example, in `sandbox` mode, a `lambda` Event Hook will not have access to global values such as `kong.configuration.pg_password`, or OS level functions like `os.execute(rm -rf /*)`, but can still run Lua code like `local foo = 1 + 1`. Removing `sandbox` requires editing the `kong.conf` value `untrusted_lua`, for more information see the [kong.conf documentation](https://docs.konghq.com/gateway/3.9.x/reference/configuration/#untrusted_lua). + +### Sources + +{{site.base_gateway}} offers the [`/event-hooks/sources`](/api/gateway/admin-ee/#/Event-hooks/get-event-hooks-sources) endpoint where you can see all available sources, events and fields that are available for creating Event Hook templates. Sources are the actions that trigger the Event Hook. + +The response body from the endpoint describes a source that can be interpreted in the following pattern: + +1. **Level 1**: The source, the action that triggers the Event Hook. +2. **Level 2**: The event, this is the {{site.base_gateway}} entity that the Event Hook listens to for events. +3. **Level 3**: The available template parameters for constructing `webhook-custom` payloads. + +This is an example response body: + + +```json +{ + "data": { + "balancer": { + "health": { + "fields": [ + "upstream_id", + "ip", + "port", + "hostname", + "health" + ] + } + } + } +} +``` + +You can apply the pattern to the response body and extract the following information: + +* **source**: `balancer` +* **event**: `health` +* **handler**: `webhook-custom` + +The values in the `fields` array represent the available template parameters you can use when constructing a payload. + +* `upstream_id` +* `ip` +* `port` +* `hostname` +* `health` + +These parameters can be used to issue notifications any time an upstream in your application is not reachable. + + +### Available sources + +- `dao:crud`: Handles `dao:crud` clustering events. +- `balancer`: Information from the load balancer like: `upstream_id`, `ip`, `port`, `hostname`, `health` +- `ai-rate-limiting-advanced`: Run an event when a rate limit has been exceeded. +- `service-protection`: Run an event when a rate limit has been exceeded. +- `rate-limiting-advanced`: Run an event when a rate limit has been exceeded. +- `crud`: Create, read, and update events from {{site.base_gateway}} entities such as Consumers. +- `oas-validation`: Runs an event when [OAS validation Plugin](/plugins/oas-validation/) fails. + +For information about specific events related to a source issue a `GET` request to the `/event-hooks/sources/{source}` endpoint. Doing so will return a list of all of the events associated to a source like: `balancer: health`. + +## Schema + +{% entity_schema %} + +## Set up an Event Hook + +{% entity_example %} +type: event_hook +data: + source: "crud" + event: "consumers" + handler: "webhook" + on_change: true + config: + "url": "$WEBHOOK_URL" +{% endentity_example %} + + +## Configure an Event Hook + + +For step-by-step guides on configuring Event Hooks see the following docs: + +* [Create a Web Hook with {{site.base_gateway}}](/how-to/create-a-webhook-with-kong-gateway/) +* [Push Event Hook information to Slack with {{site.base_gateway}}](/how-to/create-a-custom-webhook-slack-with-kong-gateway/) +* [How to create a log Event Hook with {{site.base_gateway}}](/how-to/create-a-log-event-hook-with-kong-gateway/) +* [Configure an Event Hook to log events with {{site.base_gateway}}](/how-to/create-a-lambda-event-hook-with-kong-gateway/) + diff --git a/app/_how-tos/create-a-custom-webhook-slack-with-kong-gateway.md b/app/_how-tos/create-a-custom-webhook-slack-with-kong-gateway.md new file mode 100644 index 000000000..2c7f3c33d --- /dev/null +++ b/app/_how-tos/create-a-custom-webhook-slack-with-kong-gateway.md @@ -0,0 +1,88 @@ +--- +title: Push Event Hook information to Slack with {{site.base_gateway}} +content_type: how_to +works_on: + - on-prem +products: + - gateway +entities: + - event-hook +tier: enterprise +tags: + - eventhooks + - webhook + - notifications + +tldr: + q: How can I create a custom webhook to push information to Slack using Event Hooks. + a: With an application URL from Slack, you can configure an Event Hook using the `webhook-custom` handler that can `POST` event information to Slack. +prereqs: + inline: + - title: A Slack webhook application + include_content: prereqs/event-hook/slack + - title: cURL + include_content: prereqs/tools/curl + - title: Reload {{site.base_gateway}} + include_content: prereqs/event-hook/restart-kong-gateway +cleanup: + inline: + - title: Destroy the {{site.base_gateway}} container + include_content: cleanup/products/gateway + icon_url: /assets/icons/gateway.svg +related_resources: + - text: Create a webhook with {{site.base_gateway}} + url: /how-to/create-a-webhook-with-kong-gateway/ + - text: Configure an Event Hook to log events with {{site.base_gateway}} + url: /how-to/create-a-log-event-hook-with-kong-gateway/ + - text: Create an Event Hook that can run custom code with {{site.base_gateway}} + url: /how-to/create-a-lambda-event-hook-with-kong-gateway/ + +--- + + +## 1. Configure an Event Hook using the `webhook-custom` handler + +Using the `webhook-custom` handler, you can configure an Event Hook that listens for events on a source. The `webhook-custom` handler offers a template that you can configure to create a custom webhook. In this tutorial, we will configure an Event Hook that issues a `POST` request when a `crud` event happens on the Consumer entity. That `POST` request will be made to a Slack webhook application containing a custom message describing the event. + + curl -X POST http://localhost:8001/event-hooks \ + -H "Content-Type: application/json" \ + -d '{ + "source": "crud", + "event": "consumers", + "handler": "webhook-custom", + "on_change": true, + "config": { + "method": "POST", + "url": "$SLACK_WEBHOOK_URL", + "headers": { + "Content-type": "application/json" + }, + "payload": { + "text": "new consumer added" + } + } + }' + +Posting this will result in a `200` response. The `config` body in the Event Hook contains information about the webhook that was created: + +* **`"method": "POST"`**: The method we are using in the webhook. +* **`"url": "$SLACK_WEBHOOK_URL"`**: The URL of the webhook, in this case we are using the Slack URl that we created and set as an environment variable. +* **`"payload"`**: What this webhook will `POST`. + + +## 2. Validate the webhook + + +{:.warning} +> **Important**: Before you can use Event Hooks for the first time, {{site.base_gateway}} needs to be [reloaded](/how-to/restart-kong-gateway-container). + + +Using the Admin API to create a new Consumer: + +```sh +curl -i -X POST http://localhost:8001/consumers \ + -d username="my-consumer" +``` + + +Slack will post a message to the channel informing you that a Consumer was added. diff --git a/app/_how-tos/create-a-lambda-event-hook-with-kong-gateway.md b/app/_how-tos/create-a-lambda-event-hook-with-kong-gateway.md new file mode 100644 index 000000000..d88f58a2d --- /dev/null +++ b/app/_how-tos/create-a-lambda-event-hook-with-kong-gateway.md @@ -0,0 +1,92 @@ +--- +title: Create an Event Hook that can run custom code with {{site.base_gateway}} +content_type: how_to + +entities: + - event-hook +works_on: + - on-prem +products: + - gateway +tier: enterprise + +tags: + - eventhooks + - webhook + - notifications +tldr: + q: Can you write code to pass into an Event Hook? + a: The `lambda` Event Hook handler can be used to pass custom Lua code. You can then configure the Event Hook to execute that code on an event. + +prereqs: + inline: + - title: cURL + include_content: prereqs/tools/curl + - title: Reload {{site.base_gateway}} + include_content: prereqs/event-hook/restart-kong-gateway +cleanup: + inline: + - title: Destroy the {{site.base_gateway}} container + include_content: cleanup/products/gateway + icon_url: /assets/icons/gateway.svg +related_resources: + - text: Create a webhook with {{site.base_gateway}} + url: /how-to/create-a-webhook-with-kong-gateway/ + - text: Configure an Event Hook to log events with {{site.base_gateway}} + url: /how-to/create-a-log-event-hook-with-kong-gateway/ + - text: Push Event Hook information to Slack with {{site.base_gateway}} + url: /how-to/create-a-custom-webhook-slack-with-kong-gateway/ + +--- + +## 1. Create a lambda Event Hook + +A `lambda` Event Hook is an Event Hook that utilizes the `lambda` handler to pass custom code to an Event Hook. Depending on the source and individual event, that code can execute during various stages of the lifecycle of an event. In this guide, you will create an `lambda` Event Hook with custom code that logs an error with a specific message every time you create a Consumer. + +Create a lua script to load into the lambda Event Hook. + +```lua +return function (data, event, source, pid) +local user = data.entity.username +error("Event Hook on consumer " .. user .. "") +end +``` + +Create a lambda Event Hook on the `consumers` event, with the `crud` source by creating a `POST` request to the Admin API and passing the code in the request body as an array of strings. + +```sh +curl -i -X POST http://localhost:8001/event-hooks \ +-H "Content-Type: application/json" \ +-d '{ + "source": "crud", + "event": "consumers", + "handler": "lambda", + "config": { + "functions": [ + "return function (data, event, source, pid) local user = data.entity.username error(\"Event Hook on consumer \" .. user .. \"\") end" + ] + } +}' +``` + + + +## 2. Validate the webhook + +{:.warning} +> **Important**: Before you can use event hooks for the first time, {{site.base_gateway}} needs to be reloaded. + +Using the Admin API create a new Consumer: + +```sh +curl -i -X POST http://localhost:8001/consumers \ + -d username="my-consumer" +``` + +Review the logs at `/usr/local/kong/logs/error.log` for an update about the creation of this Consumer. The log will look similar to this: + +```sh +2024/12/16 21:52:54 [error] 114#0: *153047 [kong] event_hooks.lua:190 [string "return function (data, event, source, pid)..."]:3: Event Hook on consumer my-consumer, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +``` + +In the error logs, you will see the Event Hook, and the error log that resulted from `error("Event Hook on consumer " .. user .. "")`. \ No newline at end of file diff --git a/app/_how-tos/create-a-log-event-hook-with-kong-gateway.md b/app/_how-tos/create-a-log-event-hook-with-kong-gateway.md new file mode 100644 index 000000000..848bf775b --- /dev/null +++ b/app/_how-tos/create-a-log-event-hook-with-kong-gateway.md @@ -0,0 +1,87 @@ +--- +title: Configure an Event Hook to log events with {{site.base_gateway}} +content_type: how_to + +entities: + - event-hook +works_on: + - on-prem +products: + - gateway +tier: enterprise + +tags: + - eventhooks + - webhook + - notifications +tldr: + q: How do I create an Event Hook that logs events on the Consumer entity. + a: The `log` Event Hook handler can write log events. You can configure an Event Hook using the `log` handler to write to the log file every time a CRUD event happens on the Consumer entity by issuing a `POST` request to the `/event-hooks` endpoint. + +prereqs: + inline: + - title: cURL + include_content: prereqs/tools/curl + - title: Reload {{site.base_gateway}} + include_content: prereqs/event-hook/restart-kong-gateway +cleanup: + inline: + - title: Destroy the {{site.base_gateway}} container + include_content: cleanup/products/gateway + icon_url: /assets/icons/gateway.svg +related_resources: + - text: Push Event Hook information to Slack with {{site.base_gateway}} + url: /how-to/create-a-custom-webhook-slack-with-kong-gateway/ + - text: Create a webhook with {{site.base_gateway}} + url: /how-to/create-a-webhook-with-kong-gateway/ + - text: Create an Event Hook that can run custom code with {{site.base_gateway}} + url: /how-to/create-a-lambda-event-hook-with-kong-gateway/ +--- + + +## 1. Create the Event Hook + +`log` Event Hook configuration specifies an event and a source. In this guide you will create an Event Hook that listens for CRUD events on the Consumers entity. This Event Hook will create a log entry when a CRUD event occurs. + +Create a long Event Hook on the `consumers` event using the `crud` source: + +```sh +curl -i -X POST http://localhost:8001/event-hooks \ +-H "Content-Type: application/json" \ +-d '{ + "source": "crud", + "event": "consumers", + "handler": "log" +}' +``` + + +## 2. Validate the webhook + +{:.warning} +> **Important**: Before you can use Event Hooks for the first time, {{site.base_gateway}} needs to be reloaded. + +Use the Admin API to create a new Consumer: + +```sh +curl -i -X POST http://localhost:8001/consumers \ + -d username="my-consumer" +``` + +Review the logs at `/usr/local/kong/logs/error.log` for an update about the creation of this Consumer. The log will look similar to this: + +```sh +172.19.0.1 - - [16/Dec/2024:15:57:15 +0000] "POST /consumers HTTP/1.1" 409 147 "-" "HTTPie/2.4.0" +2024/12/16 15:57:26 [notice] 68854#0: *819021 +--------------------------------------------------+, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 |[kong] event_hooks.lua:?:452 "log callback: " { "consumers", "crud", {|, context: ngx.timer, client: 172.19.0server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | entity = { |, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | created_at = 1702735046, |, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | id = "4757bd6b-8d54-4b08-bf24-01e346a9323e",|, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | type = 0, |, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | username = "my-consumer" |, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | }, |, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | operation = "create", |, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | schema = "consumers" |, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 | }, 68854 } |, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +2024/12/16 15:57:26 [notice] 68854#0: *819021 +--------------------------------------------------+, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 +``` \ No newline at end of file diff --git a/app/_how-tos/create-a-webhook-with-kong-gateway.md b/app/_how-tos/create-a-webhook-with-kong-gateway.md new file mode 100644 index 000000000..8d9aea6cd --- /dev/null +++ b/app/_how-tos/create-a-webhook-with-kong-gateway.md @@ -0,0 +1,103 @@ +--- +title: Create a Web Hook with {{site.base_gateway}} +content_type: how_to + +products: + - gateway +entities: + - event-hook +tier: enterprise +works_on: + - on-prem +tags: + - event_hook + - webhook + - notifications +tldr: + q: How do I create a webhook using Event Hooks + a: The `webhook` handler can be configured with a URL. When configured the Event Hook will listen on for the event and push information to the configured URL. + +prereqs: + inline: + - title: A webhook URL + content: | + * You can generate a URL by navigating to [https://webhook.site](https://webhook.site) and copying the free URL. + * Set that URL as an environment variable `export WEBHOOK_URL=YOUR_URL`. + - title: cURL + include_content: prereqs/tools/curl + - title: Reload {{site.base_gateway}} + include_content: prereqs/event-hook/restart-kong-gateway +cleanup: + inline: + - title: Destroy the {{site.base_gateway}} container + include_content: cleanup/products/gateway + icon_url: /assets/icons/gateway.svg + + +related_resources: + - text: Push Event Hook information to Slack with {{site.base_gateway}} + url: /how-to/create-a-custom-webhook-slack-with-kong-gateway/ + - text: Configure an Event Hook to log events with {{site.base_gateway}} + url: /how-to/create-a-log-event-hook-with-kong-gateway/ + - text: Create an Event Hook that can run custom code with {{site.base_gateway}} + url: /how-to/create-a-lambda-event-hook-with-kong-gateway/ + + +--- + +## 1. Create a webhook + +The `webhook` handler is used to configure webhooks that make a `POST` request to the URL provided during configuration. The Event Hook will push information to this URL with the event data. In this guide you will configure an Event Hook that will issue a `POST` request every time an event type `consumers` has a CRUD event. + +Using the Admin API, create an Event Hook on the Consumers event by issuing a `POST` request to the `/event-hooks` endpoint. + +```sh +curl -i -X POST http://localhost:8001/event-hooks \ +-H "Content-Type: application/json" \ +-d '{ + "source": "crud", + "event": "consumers", + "handler": "webhook", + "on_change": true, + "config": { + "url": "$WEBHOOK_URL" + } + }' +``` + +Issuing this `POST` request will send a request of type `ping` to the webhook URL verifying that the webhook is configured correctly. + + + +## 2. Validate the webhook + +{:.warning} +> **Important**: Before you can use Event Hooks for the first time, {{site.base_gateway}} needs to be reloaded. + +Using the Admin API create a new Consumer: + +```sh +curl -i -X POST http://localhost:8001/consumers \ + -d username="my-consumer" +``` + +Verify on [`https://webhook.site`](https://webhook.site) that you received a `POST` request. It will look like this: + +```json +{ + "entity": { + "username_lower": "my-consumer", + "id": "ea87c99f-36f1-41c9-8543-7b13ee2b5dfe", + "updated_at": 1734547295, + "type": 0, + "username": "my-consumer", + "created_at": 1734547295 + }, + "schema": "consumers", + "source": "crud", + "event": "consumers", + "operation": "create" +} +``` + +This response body contains the `operation`, the `source`, and the `event`, confirming that a new Consumer was created. diff --git a/app/_how-tos/konnect-oidc.md b/app/_how-tos/konnect-oidc.md index c34681862..4f0d5059d 100644 --- a/app/_how-tos/konnect-oidc.md +++ b/app/_how-tos/konnect-oidc.md @@ -6,6 +6,9 @@ related_resources: - text: Authentication url: /authentication +products: + - gateway + works_on: - konnect diff --git a/app/_how-tos/restart-kong-gateway-container.md b/app/_how-tos/restart-kong-gateway-container.md new file mode 100644 index 000000000..2d6ec2231 --- /dev/null +++ b/app/_how-tos/restart-kong-gateway-container.md @@ -0,0 +1,28 @@ +--- +title: How to restart {{site.base_gateway}} in a Docker Container +content_type: how_to + +works_on: + - on-prem +products: + - gateway +tags: + - gateway + - container + +tldr: + q: How do I restart {{site.base_gateway}} when it is running inside of a container + a: You can use `kong reload`. + +faqs: + - q: What happens when I run `kong restart`? + a: | + Kong restart kills the `pid` which will kill the container. + +--- + + + +## Restart a {{site.base_gateway}} Docker container + +To restart a {{site.base_gateway}} container without killing the container run `kong reload` from within the container. \ No newline at end of file diff --git a/app/_includes/components/entity_example/format/admin-api.md b/app/_includes/components/entity_example/format/admin-api.md index d94df3fee..d119dc47b 100644 --- a/app/_includes/components/entity_example/format/admin-api.md +++ b/app/_includes/components/entity_example/format/admin-api.md @@ -12,8 +12,10 @@ To create a Target, call the [Admin API’s /targets endpoint](/api/gateway/admin-ee/#/operations/create-target-with-upstream). {% when 'upstream' %} To create a Upstream, call the [Admin API’s /upstreams endpoint](/api/gateway/admin-ee/#/operations/create-upstream). -{% when workspace %} +{% when 'workspace' %} To create a Workspace, call the [Admin API’s /workspaces endpoint](/api/gateway/admin-ee/#/operations/create-workspace). +{% when 'event_hook' %} + To create an Event Hook, call the [Admin API’s /event-hooks endpoint](/api/gateway/admin-ee/#/operations/post-event-hooks). {% when 'plugin' %} Make the following request: {% else %} diff --git a/app/_includes/prereqs/event-hook/restart-kong-gateway.md b/app/_includes/prereqs/event-hook/restart-kong-gateway.md new file mode 100644 index 000000000..57e4c37c0 --- /dev/null +++ b/app/_includes/prereqs/event-hook/restart-kong-gateway.md @@ -0,0 +1,2 @@ +Before you can Event Hooks for the first time, {{site.base_gateway}} needs to be reloaded. To do this, run `kong-reload`. +You can verify your ability to use Event Hooks by issuing a `GET` request to the [`/event-hooks/`](/api/gateway/admin-ee/#/operations/get-event-hooks) endpoint. \ No newline at end of file diff --git a/app/_includes/prereqs/event-hook/slack.md b/app/_includes/prereqs/event-hook/slack.md new file mode 100644 index 000000000..3c5e39c7f --- /dev/null +++ b/app/_includes/prereqs/event-hook/slack.md @@ -0,0 +1,8 @@ +To create an event hook that pushes information to Slack you will need to configure some options in Slack. + +1. Create an application in [Slack](https://api.slack.com/apps?new_app=1) +2. From the application select **Incoming Webhooks** and activate incoming webhooks. +3. Copy the **Webhook URL** from the Slack application dashboard and set it as an environment variable: + `export SLACK_WEBHOOK_URL=` +4. In Slack, add your application to a channel. + diff --git a/app/_includes/prereqs/tools/curl.md b/app/_includes/prereqs/tools/curl.md new file mode 100644 index 000000000..0d1c8e831 --- /dev/null +++ b/app/_includes/prereqs/tools/curl.md @@ -0,0 +1,2 @@ +[cURL](https://curl.se/) is used to send requests to {{site.base_gateway}}. +`curl` is pre-installed on most systems. \ No newline at end of file diff --git a/app/_includes/uses.html b/app/_includes/uses.html index 37070b56d..465305b27 100644 --- a/app/_includes/uses.html +++ b/app/_includes/uses.html @@ -21,7 +21,10 @@ {% endif %} {% if include.products and include.tools %} - + {% assign tool = include.tools | find_exp: "tool", "site.data.tools[tool]" %} + {% if tool %} + + {% endif %} {% endif %} {% if include.tools %} diff --git a/app/_landing_pages/gateway/entities.yaml b/app/_landing_pages/gateway/entities.yaml index b21db23a0..5bacbb4eb 100644 --- a/app/_landing_pages/gateway/entities.yaml +++ b/app/_landing_pages/gateway/entities.yaml @@ -31,11 +31,11 @@ rows: - type: entity_card config: entity: consumer + - columns: - blocks: - type: entity_card config: entity: consumer-group - - columns: - blocks: - type: entity_card config: @@ -44,6 +44,7 @@ rows: - type: entity_card config: entity: target + - columns: - blocks: - type: entity_card config: @@ -52,3 +53,7 @@ rows: - type: entity_card config: entity: workspace + - blocks: + - type: entity_card + config: + entity: event-hook diff --git a/app/_plugins/blocks/entity_example.rb b/app/_plugins/blocks/entity_example.rb index bce80abc8..80c58fb26 100644 --- a/app/_plugins/blocks/entity_example.rb +++ b/app/_plugins/blocks/entity_example.rb @@ -39,6 +39,7 @@ def render(context) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize def formats(page) return page['tools'] unless page['layout'] == 'gateway_entity' + return page['tools'] unless page['slug'] != 'event-hook' page['tools'].dup << 'ui' end diff --git a/jekyll.yml b/jekyll.yml index a3a470f50..1e2a0ea9b 100644 --- a/jekyll.yml +++ b/jekyll.yml @@ -58,6 +58,7 @@ insomnia_run: https://insomnia.rest/run/ # product name vars base_gateway: Kong Gateway +ee_product_name: Kong Gateway Enterprise konnect_short_name: Konnect mesh_product_name: Kong Mesh kic_product_name: Kong Ingress Controller diff --git a/tools/track-docs-changes/config/sources.yml b/tools/track-docs-changes/config/sources.yml index 6685645e8..d856cd68b 100644 --- a/tools/track-docs-changes/config/sources.yml +++ b/tools/track-docs-changes/config/sources.yml @@ -51,6 +51,8 @@ app/_gateway_entities/upstream.md: app/_gateway_entities/workspace.md: - app/_src/gateway/kong-manager/workspaces.md - app/_src/gateway/kong-enterprise/workspaces.md +app/_gateway_entities/event_hooks.md: + - app/_src/gateway/latest/kong-enterprise/event-hooks.md # how-tos app/_how-tos/add-rate-limiting-tiers-with-kong-gateway.md: @@ -66,6 +68,10 @@ app/_how-tos/get-started-with-gateway.md: - app/_src/gateway/get-started/proxy-caching.md - app/_src/gateway/get-started/key-authentication.md - app/_src/gateway/get-started/load-balancing.md +app/_how-tos/set-up-ai-proxy-advanced-with-anthropic.md: + - app/_hub/kong-inc/ai-proxy-advanced/how-to/llm-provider-integration-guides/_anthropic.md +app/_how-tos/set-up-ai-proxy-with-anthropic.md: + - app/_hub/kong-inc/ai-proxy/how-to/llm-provider-integration-guides/_anthropic.md # plugins app/_kong_plugins/ai-rate-limiting-advanced/index.md: @@ -82,6 +88,14 @@ app/_kong_plugins/rate-limiting/index.md: - app/_hub/kong-inc/rate-limiting/overview/_index.md app/_kong_plugins/rate-limiting-advanced/index.md: - app/_hub/kong-inc/rate-limiting-advanced/overview/_index.md +app/_kong_plugins/ai-proxy-advanced/index.md: + - app/_hub/kong-inc/ai-proxy-advanced/overview/_index.md +app/_kong_plugins/ai-proxy/index.md: + - app/_hub/kong-inc/ai-proxy/overview/_index.md +app/_kong_plugins/cors/index.md: + - app/_hub/kong-inc/cors/overview/_index.md +app/_kong_plugins/mocking/index.md: + - /app/_hub/kong-inc/mocking/overview/_index.md # landing pages app/_landing_pages/gateway/enterprise-vs-oss.yaml: @@ -122,29 +136,6 @@ app/plugins/protocols.md: - app/hub/plugins/compatibility/index.md app/plugins/scopes.md: - app/hub/plugins/compatibility/index.md - - -# Plugins - -app/_kong_plugins/cors/index.md: - - app/_hub/kong-inc/cors/overview/_index.md -app/_kong_plugins/mocking/index.md: - - /app/_hub/kong-inc/mocking/overview/_index.md - - -# References - app/gateway/networking/dns-config-reference.md: - app/_src/gateway/production/networking/dns-considerations.md -app/_how-tos/set-up-ai-proxy-advanced-with-anthropic.md: - - app/_hub/kong-inc/ai-proxy-advanced/how-to/llm-provider-integration-guides/_anthropic.md -app/_how-tos/set-up-ai-proxy-with-anthropic.md: - - app/_hub/kong-inc/ai-proxy/how-to/llm-provider-integration-guides/_anthropic.md - -#plugins -app/_kong_plugins/ai-proxy-advanced/index.md: - - app/_hub/kong-inc/ai-proxy-advanced/overview/_index.md -app/_kong_plugins/ai-proxy/index.md: - - app/_hub/kong-inc/ai-proxy/overview/_index.md -