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

WIP: Add vale #159

Merged
merged 27 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4bfbb7a
Add vale.ini + styles from the docs site
fabianrbz Nov 19, 2024
a23c942
Update vale to ignore entity_examples? blocks
fabianrbz Nov 19, 2024
82c8d72
Add make vale
fabianrbz Nov 19, 2024
d88f584
Refactor vale's config file
fabianrbz Nov 19, 2024
7d992f5
Liquify text in structured_text
fabianrbz Nov 19, 2024
cdfc9df
Add more words to auto-ignore and dictionary
fabianrbz Nov 19, 2024
c4bf06a
Update components to handle liquid interpolations
fabianrbz Nov 20, 2024
06892df
Add missing product names
fabianrbz Nov 20, 2024
90b7f6b
Fix Vale errors
fabianrbz Nov 20, 2024
1dc4e2b
Fix code block
fabianrbz Nov 20, 2024
e128c9d
Update Vale Styles
fabianrbz Nov 20, 2024
b0ac62a
Update vale's styles and content after rebase
fabianrbz Nov 20, 2024
5b927af
Add github action
fabianrbz Nov 20, 2024
e723509
Fix frontmatter
fabianrbz Nov 20, 2024
c9d3f71
Fix Auto-ignore file name in Vale' styles
fabianrbz Nov 20, 2024
f255af2
Use a Vale filter to escape words that start with an underscore
fabianrbz Nov 20, 2024
b83cc18
Rename Vale's landing_pgaes/Auto-ignore.txt to Dictionary.txt
fabianrbz Nov 20, 2024
175314c
Sort vale's landing_pages Dictionary.txt
fabianrbz Nov 20, 2024
81d48c6
Combine Vale's config files (Auto-ignore and Dictionary) into one Dic…
fabianrbz Nov 20, 2024
082e595
Fix vale errors in markdown files
fabianrbz Nov 20, 2024
48125b3
Add words to Dictionary
fabianrbz Nov 20, 2024
e6f7055
Refactor Vale
fabianrbz Nov 21, 2024
71ff620
Add a tool that allows us to run Vale on Frontmatters
fabianrbz Nov 21, 2024
792f4e1
Update Dictionary
fabianrbz Nov 21, 2024
06c3ae3
Fix Vale errors in frontmatters
fabianrbz Nov 21, 2024
2fb0cb7
Run Vale on Frontmatters in the linting action
fabianrbz Nov 21, 2024
e0de139
fix vale issues
lmilan Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
778 changes: 778 additions & 0 deletions .github/styles/base/Dictionary.txt

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions .github/styles/base/Kongterms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
extends: substitution
message: Use '%s' instead of '%s'.
level: error
ignorecase: false
scope: text
swap:

# Developer Portal: Dev Portal
Kong Gateway Enterprise: "{{site.ee_product_name}}"
Kong Gateway: "{{site.base_gateway}}"
Kong Konnect: "{{site.konnect_product_name}}"
Kong Ingress Controller: "{{site.kic_product_name}}"
Kong Mesh: "{{site.mesh_product_name}}"
Kong Enterprise: "{{site.ee_product_name}}"
Kong Gateway Operator: "{{site.kgo_product_name}}"
ServiceHub: Service Hub
Runtime Manager: Gateway Manager
dbless: DB-less
7 changes: 7 additions & 0 deletions .github/styles/base/Relativeurls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: existence
message: "Use relative URLs for docs URLs. For example, use [Get Started](/gateway/latest/get-started/) instead of [Get Started](https://developer.konghq.com/gateway/3.3.x/get-started/). If a direct URL is necessary, use {{ site.links.web }} instead of `https://developer.konghq.com`."
nonword: true
level: error
scope: raw
tokens:
- '\[[^\]]*\]\(https?:\/\/developer\.konghq\.com[^\)]*\)'
6 changes: 6 additions & 0 deletions .github/styles/base/Repetition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: repetition
message: "'%s' is repeated!"
level: error
alpha: true
tokens:
- '[^\s]+'
20 changes: 20 additions & 0 deletions .github/styles/base/Terms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends: substitution
message: Use '%s' instead of '%s'.
level: error
ignorecase: true
scope: text
swap:

datacenter: data center
codeblock': code block
blacklist: denylist
codeblock: code block
file name: filename
# '(?:kubernetes|k8s)': Kubernetes
multizone: multi-zone
pg: PostgreSQL
'postgres$': PostgreSQL
'redhat$': Red Hat
timezone: time zone
utilize: use
whitelist: allowlist
14 changes: 14 additions & 0 deletions .github/styles/docs/Frontmatter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
api_specs
auto_generated
content_type
faqs
icon_url
include_content
insomnia_link
min_version
next_steps
prereqs
related_resources
tier
tldr
works_on
8 changes: 8 additions & 0 deletions .github/styles/docs/Spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: spelling
message: "Did you really mean '%s'?"
level: error
filters:
- '\W'
ignore:
- .github/styles/base/Dictionary.txt
- .github/styles/landing_pages/Components.txt
18 changes: 18 additions & 0 deletions .github/styles/landing_pages/Components.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
allow_empty
alt_text
concept_list
content_type
cta
entity_card
faqs
feature_table
how_to_list
include_content
landing_page
reference_list
related_resources
structured_text
sub_text
unordered_list
view_more
x_with_y
76 changes: 76 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Linting
on:
pull_request:
types: [synchronize, ready_for_review, opened]
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if manual review has been performed
uses: actions/github-script@v7
id: labels
with:
result-encoding: string
script: |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
...context.repo,
issue_number: context.issue.number
});
return labels.map(l => l.name).includes('ci:manual-approve:linting')
outputs:
result: ${{ steps.labels.outputs.result }}
vale:
needs: check
if: needs.check.outputs.result == 'false'
name: Vale
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
sha: ${{ github.sha }}
files: |
app/**/*.md
app/_landing_pages/**/*.yaml
files_ignore: |
app/assets/**
json: true
quotepath: false
escape_json: false
- uses: mheap/vale-action@reviewdog
if: steps.changed-files.outputs.any_changed == 'true'
with:
fail_on_error: true
files: '${{ steps.changed-files.outputs.all_changed_files }}'
filter_mode: file
reporter: github-pr-annotations
reviewdog_url: https://github.com/mheap/reviewdog/releases/download/v10.0.0/reviewdog_10.0.0_Linux_x86_64.tar.gz
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Prepare Frontmatters for Vale
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
cd tools/vale-frontmatter
npm ci
node index.js $CHANGED_FILES
- uses: mheap/vale-action@reviewdog
if: steps.changed-files.outputs.any_changed == 'true'
with:
fail_on_error: true
files: '${{ steps.changed-files.outputs.all_changed_files }}'
filter_mode: file
reporter: github-pr-annotations
reviewdog_url: https://github.com/mheap/reviewdog/releases/download/v10.0.0/reviewdog_10.0.0_Linux_x86_64.tar.gz
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
34 changes: 34 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
StylesPath = .github/styles

# The minimum alert level to display (suggestion, warning, or error).
#
# CI builds will only fail on error-level alerts.
MinAlertLevel = suggestion

[formats]
mdx = md
yaml = md

# Specifies what Vale considers to be a boundary between words.
WordTemplate = \s(?:%s)\s


[*.md]
BasedOnStyles = base,docs
BlockIgnores = (\((http.*://|\.\/|\/).*?\)), \
{\:.*?}, \
(?s){% kgo_.*?%}.*?{% endkgo_.*?%}, \
(?s) *{%\s*entity_examples?\s*%}.*?{%\s*endentity_examples?\s*%}, \
(?:)(\s*type\: github\n), \
(?:)(\s*key\: oss\n), \
(?:)(\s*include_content\: .*\n)

TokenIgnores = {%.*?%}, \
{{.*?}}, \
(?:)(/[(A-Za-z0-9)(\055/)(_)]*/), \
({\#.*})

[README.md]
BasedOnStyles = base,docs
base.Relativeurls = NO
base.We = NO
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ clean:
kill-ports:
@JEKYLL_PROCESS=$$(lsof -ti:4000) && kill -9 $$JEKYLL_PROCESS || true
@VITE_PROCESS=$$(lsof -ti:3036) && kill -9 $$VITE_PROCESS || true

vale:
-git diff --name-only --diff-filter=d HEAD | grep '\.md$$' | xargs vale
4 changes: 2 additions & 2 deletions app/_gateway_entities/consumer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ content_type: reference
entities:
- consumer # we could use this to pull the schema too

description: A consumer typically refers to an entity that consumes or uses the APIs managed by Kong Gateway.
description: A consumer typically refers to an entity that consumes or uses the APIs managed by {{site.base_gateway}}.

related_resources:
- text: Authentication reference
Expand All @@ -24,7 +24,7 @@ faqs:

- q: What is the difference between consumers and applications?
a: |
Applications provide developers the ability to get access to APIs managed by Kong Gateway or Konnect
Applications provide developers the ability to get access to APIs managed by {{site.base_gateway}} or Konnect
with no interaction from the Kong admin team to generate credentials required.
<br><br>
With consumers, the Kong team creates consumers, generates credentials and needs to share them with the developers that need access to the APIs.
Expand Down
8 changes: 4 additions & 4 deletions app/_gateway_entities/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ content_type: reference
entities:
- plugin

description: Plugins are modules that extend the functionality of Kong Gateway.
description: Plugins are modules that extend the functionality of {{site.base_gateway}}.

related_resources:
- text: Plugin Hub
Expand All @@ -15,7 +15,7 @@ related_resources:
url: 'https://docs.konghq.com/hub/plugins/compatibility/'
- text: Supported protocols for each plugin
url: 'https://docs.konghq.com/hub/plugins/compatibility/#protocols'
- text: Self-managed Kong Gateway license tiers
- text: Self-managed {{site.base_gateway}} license tiers
url: 'https://docs.konghq.com/hub/plugins/license-tiers/'
- text: Konnect pricing tiers
url: 'https://docs.konghq.com/konnect/compatibility/#plugin-compatibility'
Expand All @@ -35,9 +35,9 @@ schema:

## What is a plugin?

Kong Gateway is a Lua application designed to load and execute modules. These modules, called plugins, allow you to add more features to your implementation.
{{site.base_gateway}} is a Lua application designed to load and execute modules. These modules, called plugins, allow you to add more features to your implementation.

Kong provides a set of standard Lua plugins that get bundled with {{site.base_gateway}} and {{site.konnect_short_name}}.
Kong provides a set of standard Lua plugins that get bundled with {{site.base_gateway}} and {{site.konnect_short_name}}.
The set of plugins you have access to depends on your license tier.

You can also develop custom plugins, adding your own custom functionality to {{site.base_gateway}}.
Expand Down
10 changes: 5 additions & 5 deletions app/_gateway_entities/route.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: A route is a path to a resource within an upstream application.
related_resources:
- text: Services
url: /gateway/entities/service/
- text: Routing in Kong Gateway
- text: Routing in {{site.base_gateway}}
url: /gateway/routing/
- text: Expressions router
url: /gateway/routing/expressions/
Expand All @@ -29,7 +29,7 @@ schema:

## What is a route?

{{page.description}} Services can store collections of objects like plugin configurations, and policies, and they can be associated with routes. In {{site.base_gateway}}, routes typically map to endpoints that are exposed through the Kong Gateway application. Routes can also define rules that match requests to associated services. Because of this, one route can reference multiple endpoints. A basic route should have a name, path or paths, and reference an existing service.
{{page.description}} Services can store collections of objects like plugin configurations, and policies, and they can be associated with routes. In {{site.base_gateway}}, routes typically map to endpoints that are exposed through the {{site.base_gateway}} application. Routes can also define rules that match requests to associated services. Because of this, one route can reference multiple endpoints. A basic route should have a name, path or paths, and reference an existing service.

You can also configure routes with:

Expand All @@ -42,11 +42,11 @@ You can also configure routes with:

## Route and service interaction

Routes, in conjunction with [services](/gateway/entities/service/), let you expose your services to applications with Kong Gateway. Kong Gateway abstracts the service from the applications by using routes. Since the application always uses the route to make a request, changes to the services, like versioning, don’t impact how applications make the request. Routes also allow the same service to be used by multiple applications and apply different policies based on the route used.
Routes, in conjunction with [services](/gateway/entities/service/), let you expose your services to applications with {{site.base_gateway}}. {{site.base_gateway}} abstracts the service from the applications by using routes. Since the application always uses the route to make a request, changes to the services, like versioning, don’t impact how applications make the request. Routes also allow the same service to be used by multiple applications and apply different policies based on the route used.

For example, if you have an external application and an internal application that need to access the example_service service, but the external application should be limited in how often it can query the service to assure no denial of service. If a rate limit policy is configured for the service when the internal application calls the service, the internal application is limited as well. Routes can solve this problem.
For example, if you have an external application and an internal application that need to access the `example_service` service, but the external application should be limited in how often it can query the service to assure no denial of service. If a rate limit policy is configured for the service when the internal application calls the service, the internal application is limited as well. Routes can solve this problem.

In the example above, two routes can be created, say /external and /internal, and both routes can point to example_service. A policy can be configured to limit how often the /external route is used and the route can be communicated to the external client for use. When the external client tries to access the service via Kong Gateway using /external, they are rate limited. But when the internal client accesses the service using Kong Gateway using /internal, the internal client will not be limited.
In the example above, two routes can be created, say /external and /internal, and both routes can point to `example_service`. A policy can be configured to limit how often the /external route is used and the route can be communicated to the external client for use. When the external client tries to access the service via {{site.base_gateway}} using /external, they are rate limited. But when the internal client accesses the service using {{site.base_gateway}} using /internal, the internal client will not be limited.

## Dynamically rewrite request URLs with routes

Expand Down
4 changes: 2 additions & 2 deletions app/_gateway_entities/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ content_type: reference
entities:
- service

description: In Kong Gateway, a service is an abstraction of an upstream application that services requests.
description: In {{site.base_gateway}}, a service is an abstraction of an upstream application that services requests.

related_resources:
- text: Routes entity
url: /gateway/entities/route/
- text: Enable rate limiting on a service with Kong Gateway
- text: Enable rate limiting on a service with {{site.base_gateway}}
url: /how-to/add-rate-limiting-to-a-service-with-kong-gateway/

tools:
Expand Down
2 changes: 1 addition & 1 deletion app/_gateway_entities/upstream.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tools:
- deck
- terraform

description: An upstream refers to the service applications sitting behind Kong Gateway, to which client requests are forwarded.
description: An upstream refers to the service applications sitting behind {{site.base_gateway}}, to which client requests are forwarded.

schema:
api: gateway/admin-ee
Expand Down
2 changes: 1 addition & 1 deletion app/_gateway_entities/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ content_type: reference
entities:
- workspace

description: Workspaces provide a way to segment Kong Gateway entities. Entities in a workspace are isolated from those in other workspaces.
description: Workspaces provide a way to segment {{site.base_gateway}} entities. Entities in a workspace are isolated from those in other workspaces.

tools:
- admin-api
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
title: Enable rate limiting for a consumer with Kong Gateway
title: Enable rate limiting for a consumer with {{site.base_gateway}}
content_type: how_to

related_resources:
- text: How to create rate limiting tiers with Kong Gateway
- text: How to create rate limiting tiers with {{site.base_gateway}}
url: /how-to/add-rate-limiting-tiers-with-kong-gateway/
- text: Rate Limiting plugin
url: /plugins/rate-limiting/
Expand Down Expand Up @@ -33,7 +32,7 @@ tags:
- rate-limiting

tldr:
q: How do I rate limit a consumer with Kong Gateway?
q: How do I rate limit a consumer with {{site.base_gateway}}?
a: Enable an authentication plugin and create a consumer with credentials, then enable the <a href="/plugins/rate-limiting/reference">Rate Limiting plugin</a> on the new consumer.

tools:
Expand All @@ -51,15 +50,15 @@ cleanup:
- title: Clean up Konnect environment
include_content: cleanup/platform/konnect
icon_url: /assets/icons/gateway.svg
- title: Destroy the Kong Gateway container
- title: Destroy the {{site.base_gateway}} container
include_content: cleanup/products/gateway
icon_url: /assets/icons/gateway.svg
---

## 1. Create a consumer

Consumers let you identify the client that's interacting with Kong Gateway.
We're going to use key [authentication](/authentication/) in this tutorial, so the consumer needs an API key to access any Kong Gateway services.
Consumers let you identify the client that's interacting with {{site.base_gateway}}.
We're going to use key [authentication](/authentication/) in this tutorial, so the consumer needs an API key to access any {{site.base_gateway}} services.

Add the following content to `kong.yaml` to create a consumer:

Expand All @@ -76,7 +75,7 @@ entities:
Authentication lets you identify a consumer so that you can apply rate limiting.
This example uses the [Key Authentication](/plugins/key-auth) plugin, but you can use any authentication plugin that you prefer.

Enable the plugin globally, which means it applies to all Kong Gateway services and routes:
Enable the plugin globally, which means it applies to all {{site.base_gateway}} services and routes:

{% entity_examples %}
entities:
Expand Down
Loading