Skip to content

Commit

Permalink
Merge branch 'main' into QA
Browse files Browse the repository at this point in the history
  • Loading branch information
Guaris authored Dec 19, 2024
2 parents 0e529c2 + 968896b commit b4da8c5
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 22 deletions.
22 changes: 13 additions & 9 deletions app/_assets/javascripts/toc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
function toggleTocLinkClasses(link, isActive) {
const activeClasses = ["tab-button__vertical--active"];

function toggleTocLinkClasses(link, isActive, activeClass) {
if (isActive) {
link.classList.add(...activeClasses);
link.classList.add(activeClass);
} else {
link.classList.remove(...activeClasses);
link.classList.remove(activeClass);
}
}

window.addEventListener("scroll", () => {
const activeClass = "tab-button__vertical--active";
const anchors = document.querySelectorAll("a.header-link");
const scrollToLinks = document.querySelectorAll("a.scroll-to");
const navHeight = document.getElementById("header-nav").offsetHeight;
Expand All @@ -17,9 +16,9 @@ window.addEventListener("scroll", () => {
return;
}

let activeSet = false;

scrollToLinks.forEach((link) => toggleTocLinkClasses(link, false));
let activeSet = document.querySelectorAll(
`a.scroll-to.${activeClass}`
).length;

// Convert NodeList to Array and reverse it
const anchorsArray = Array.from(anchors).reverse();
Expand All @@ -33,7 +32,12 @@ window.addEventListener("scroll", () => {
`a.scroll-to[href$="${element.getAttribute("href")}"]`
);
if (matchingLink) {
toggleTocLinkClasses(matchingLink, true);
toggleTocLinkClasses(matchingLink, true, activeClass);
scrollToLinks.forEach(
(link) =>
link !== matchingLink &&
toggleTocLinkClasses(link, false, activeClass)
);
activeSet = true;
}
break;
Expand Down
16 changes: 11 additions & 5 deletions app/_gateway_entities/target.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Targets
content_type: reference
description: A Target is an IP address/hostname with a port that identifies an instance of a backend service.

entities:
- target

Expand All @@ -11,21 +13,25 @@ tools:
- deck
- terraform

description: A target identifies a specific instance of an upstream service.
related_resources:
- text: Upstream entity
url: /gateway/entities/upstream/
- text: Route entity
url: /gateway/entities/route/

schema:
api: gateway/admin-ee
path: /schemas/Target

---

## What is a target?
## What is a Target?

{{page.description}}
{{page.description}} Each [Upstream](/gateway/entities/upstream/) can have many Targets. Targets are used by Upstreams for [load balancing](https://docs.konghq.com/gateway/latest/how-kong-works/load-balancing/). For example, if you have an `example_upstream` Upstream, you can point it to two different Targets: `httpbin.konghq.com` and `httpbun.com`. This is so that if one of the servers (like `httpbin.konghq.com`) is unavailable, it automatically detects the problem and routes all traffic to the working server (`httpbun.com`).

## Use cases for targets
The following diagram illustrates how Targets are used by Upstreams for load balancing:

The following are examples of common use cases for targets:
{% include entities/upstreams-targets-diagram.md %}

## Schema

Expand Down
6 changes: 3 additions & 3 deletions app/_how-tos/get-started-with-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ In this example, you configured a limit of 5 requests per minute for all Routes,

We'll validate that this worked in the next step, but first let's set up caching.

## 4. Enable caching
## 5. Enable caching

One of the ways Kong delivers performance is through caching.
The [Proxy Cache plugin](/plugins/proxy-cache/) accelerates performance by caching
Expand Down Expand Up @@ -217,7 +217,7 @@ HTTP/1.1 429 Too Many Requests
```
{:.no-copy-code}

## 5. Enable authentication
## 6. Enable authentication

Authentication is the process of verifying that the requester has permissions to access a resource.
As its name implies, API gateway authentication authenticates the flow of data to and from your upstream services.
Expand Down Expand Up @@ -290,7 +290,7 @@ curl -i http://localhost:8000/mock/anything \

You will receive a `200 OK` response.

## 6. Enable load balancing
## 7. Enable load balancing

Load balancing is a method of distributing API request traffic across
multiple upstream services. Load balancing improves overall system responsiveness
Expand Down
13 changes: 13 additions & 0 deletions app/_includes/components/entity_example/format/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ The following creates a new service called **{{ include.presenter.data['name'] }
4. Configure your plugin. The configuration options will depend on which plugin you picked.
5. Click **Save**.
{% when 'target' %}
The following creates a new Upstream and a Target with basic configuration:

The following creates a new Upstream with basic configuration:

1. In Kong Manager or Gateway Manager, Navigate to **Workspaces** > **Upstreams**.
1. Click **New Upstream**.
1. Enter a unique name for the Upstream. For example: `{{ include.presenter.data['name'] }}`.
1. Click **Save**.
1. From your Upstream, select the **Targets** tab.
1. Click **New Target**.
1. Enter an IP address/hostname and port in the **Target Address** field, for example: `{{ include.presenter.data['target'] }}`
1. Update the weight for example: `{{ include.presenter.data['weight'] }}`.
1. Click **Save**.
{% when 'upstream' %}
The following creates a new Upstream with basic configuration:

Expand Down
9 changes: 5 additions & 4 deletions app/_landing_pages/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ rows:
- blocks:
- type: card
config:
title: Try out the Gateway with Docker
description: Learn how to use Kong Gateway on Konnect or on-prem
title: Try the Getting Started guide
description: description: Learn how to use Kong Gateway on Konnect or on-prem
icon: /assets/icons/graduation.svg
cta:
text:
Expand Down Expand Up @@ -221,7 +221,7 @@ rows:
icon: /assets/icons/data-object.svg
cta:
text: Kong API reference
url: /gateway/entities/
url: /api/gateway/admin-ee/
align: end
- header:
type: h2
Expand All @@ -233,4 +233,5 @@ rows:
products:
- gateway
quantity: 5
view_more: /how-to/ ##"https://docs.devsite.com/search/{topic}+{other stuff}" ## Takes you to search with terms that match this.
view_more: /how-to/ ##"https://docs.devsite.com/search/{topic}+{other stuff}" ## Takes you to search with terms that match this.

2 changes: 1 addition & 1 deletion app/_plugins/generators/plugins/pages/reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def data
super
.except('faqs')
.merge(metadata)
.merge('reference?' => true)
.merge('reference?' => true, 'toc' => false)
end

def metadata
Expand Down

0 comments on commit b4da8c5

Please sign in to comment.