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

docs: design updates for Generated API Docs #308

Merged
merged 44 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ef36bb0
test: removes apischema coverage exception (#255)
mathetake Jan 31, 2025
5cb2bb5
ci: upgrades Envoy Gateway to v1.3.0 (#259)
mathetake Jan 31, 2025
bc44655
updates for better headers and a back to top button
ericmariasis Feb 2, 2025
91336ea
fixing whitespace in config.yaml
ericmariasis Feb 2, 2025
4ed8aff
ran precommit
ericmariasis Feb 2, 2025
357f28a
updating for more user friendly bulleted list approach
ericmariasis Feb 7, 2025
5439428
docs: removal of deprecated kubectl command in installation.md (#264)
ericmariasis Feb 1, 2025
23cab14
chore: fixes PR style check (#266)
mathetake Feb 1, 2025
3ed81cd
ci: cleanup PR Style Check GHA (#268)
mathetake Feb 1, 2025
41e4271
ci: relaxes PR title length check (#269)
mathetake Feb 1, 2025
bcd2d13
docs: add note for Windows users in basic usage (#265)
ericmariasis Feb 1, 2025
2bbf52d
chore: more clarify what to do on Style check failure (#272)
mathetake Feb 2, 2025
89de59a
Fix description render issue
ericmariasis Feb 7, 2025
e98802b
ci: skip style checks for dependabot PRs (#282)
leseb Feb 3, 2025
008a7e3
build(deps): bump github.com/envoyproxy/go-control-plane/envoy from 1…
dependabot[bot] Feb 3, 2025
707d761
build(deps): bump github.com/openai/openai-go from 0.1.0-alpha.50 to …
dependabot[bot] Feb 3, 2025
69085d2
build(deps): bump github.com/aws/aws-sdk-go-v2 from 1.35.0 to 1.36.0 …
dependabot[bot] Feb 3, 2025
757f275
build(deps): bump github.com/google/cel-go from 0.23.1 to 0.23.2 (#279)
dependabot[bot] Feb 3, 2025
6d1fc67
test: resolve warnings in envoy.yaml (#283)
leseb Feb 3, 2025
6f0470f
build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.29.3 to …
dependabot[bot] Feb 3, 2025
ef2e428
ci: add issue title check (#273)
soma00333 Feb 3, 2025
78ec796
ci: adjust issue/pr style checks (#284)
mathetake Feb 3, 2025
d4df342
ci: stricter permissions on style/tests workflows (#288)
mathetake Feb 4, 2025
63865c7
controller: mark all volume mounts ReadOnly=true (#252)
daixiang0 Feb 4, 2025
219ffce
examples: adds token rate limit (#289)
mathetake Feb 4, 2025
ff82f6f
test: clean up real provider extproc test (#291)
mathetake Feb 4, 2025
3aefe8c
examples: simplifies token_ratelimit.yaml (#292)
mathetake Feb 5, 2025
32c49d1
controller: eliminates context.Background (#295)
mathetake Feb 6, 2025
e44314b
extproc: eliminates context.Background (#296)
mathetake Feb 6, 2025
44470e6
extproc: eliminates context.Background in config loader (#297)
mathetake Feb 6, 2025
061a659
chore: stricter golangci-lint (#298)
mathetake Feb 6, 2025
9c7279a
docs: more comment about generated resources in API (#294)
mathetake Feb 6, 2025
03885ea
docs: adds architecture overview (#293)
mathetake Feb 6, 2025
3a12cf4
e2e: support AWS Session Token in real provider test (#299)
yuzisun Feb 6, 2025
214934a
chore: fixes CEL validation test target name (#300)
mathetake Feb 6, 2025
d328bc8
chore: updates tools (#301)
mathetake Feb 6, 2025
923cf40
Merge branch 'main' into issue_241_new
ericmariasis Feb 7, 2025
a899e98
Merge branch 'main' into issue_241_new
ericmariasis Feb 7, 2025
67de480
API Docs Styling
missBerg Feb 9, 2025
013aa2e
Merge branch 'envoyproxy:main' into api-docs-erica-suggestion
missBerg Feb 9, 2025
728d328
Fix minor style issues in the new CSS
missBerg Feb 9, 2025
c6d0689
Merge branch 'api-docs-erica-suggestion' of https://github.com/missBe…
missBerg Feb 9, 2025
295aa80
Fix CSS for index landing page
missBerg Feb 9, 2025
fa6d2f7
Remove a whitespace in css file
missBerg Feb 9, 2025
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
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ apigen: controller-gen
.PHONY: apidoc
apidoc: crd-ref-docs
@$(CRD_REF_DOCS) \
--source-path=api/v1alpha1 \
--config=site/crd-ref-docs/config.yaml \
--templates-dir=site/crd-ref-docs/templates \
--output-path=API.md \
--max-depth 20 \
--output-path site/docs/api.md \
--renderer=markdown
--source-path=api/v1alpha1 \
--config=site/crd-ref-docs/config-core.yaml \
--templates-dir=site/crd-ref-docs/templates \
--max-depth 20 \
--output-path site/docs/api/api.mdx \
--renderer=markdown

# This runs all necessary steps to prepare for a commit.
.PHONY: precommit
Expand Down
7 changes: 4 additions & 3 deletions api/v1alpha1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,21 @@ type AIGatewayRouteSpec struct {
// metadata per HTTP request. The namespaced key is "io.envoy.ai_gateway",
//
// For example, let's say we have the following LLMRequestCosts configuration:
//
// ```yaml
// llmRequestCosts:
// - metadataKey: llm_input_token
// type: InputToken
// - metadataKey: llm_output_token
// type: OutputToken
// - metadataKey: llm_total_token
// type: TotalToken
//
// ```
// Then, with the following BackendTrafficPolicy of Envoy Gateway, you can have three
// rate limit buckets for each unique x-user-id header value. One bucket is for the input token,
// the other is for the output token, and the last one is for the total token.
// Each bucket will be reduced by the corresponding token usage captured by the AI Gateway filter.
//
// ```yaml
// apiVersion: gateway.envoyproxy.io/v1alpha1
// kind: BackendTrafficPolicy
// metadata:
Expand Down Expand Up @@ -182,7 +183,7 @@ type AIGatewayRouteSpec struct {
// metadata:
// namespace: io.envoy.ai_gateway
// key: llm_total_token
//
// ```
// +optional
// +kubebuilder:validation:MaxItems=36
LLMRequestCosts []LLMRequestCost `json:"llmRequestCosts,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ spec:
the LLM-related request, notably the token usage.\nThe AI Gateway
filter will capture each specified number and store it in the Envoy's
dynamic\nmetadata per HTTP request. The namespaced key is \"io.envoy.ai_gateway\",\n\nFor
example, let's say we have the following LLMRequestCosts configuration:\n\n\tllmRequestCosts:\n\t-
example, let's say we have the following LLMRequestCosts configuration:\n```yaml\n\tllmRequestCosts:\n\t-
metadataKey: llm_input_token\n\t type: InputToken\n\t- metadataKey:
llm_output_token\n\t type: OutputToken\n\t- metadataKey: llm_total_token\n\t
\ type: TotalToken\n\nThen, with the following BackendTrafficPolicy
\ type: TotalToken\n```\nThen, with the following BackendTrafficPolicy
of Envoy Gateway, you can have three\nrate limit buckets for each
unique x-user-id header value. One bucket is for the input token,\nthe
other is for the output token, and the last one is for the total
token.\nEach bucket will be reduced by the corresponding token usage
captured by the AI Gateway filter.\n\n\tapiVersion: gateway.envoyproxy.io/v1alpha1\n\tkind:
captured by the AI Gateway filter.\n\n```yaml\n\tapiVersion: gateway.envoyproxy.io/v1alpha1\n\tkind:
BackendTrafficPolicy\n\tmetadata:\n\t name: some-example-token-rate-limit\n\t
\ namespace: default\n\tspec:\n\t targetRefs:\n\t - group: gateway.networking.k8s.io\n\t
\ kind: HTTPRoute\n\t name: usage-rate-limit\n\t rateLimit:\n\t
Expand Down Expand Up @@ -204,7 +204,7 @@ spec:
\ unit: Hour\n\t cost:\n\t request:\n\t
\ from: Number\n\t number: 0\n\t response:\n\t
\ from: Metadata\n\t metadata:\n\t namespace:
io.envoy.ai_gateway\n\t key: llm_total_token"
io.envoy.ai_gateway\n\t key: llm_total_token\n```"
items:
description: LLMRequestCost configures each request cost.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@ render:
- name: ExtProc
package: github.com/envoyproxy/gateway/api/v1alpha1
link: https://gateway.envoyproxy.io/docs/api/extension_types/#extproc
- name: OIDC
package: github.com/envoyproxy/gateway/api/v1alpha1
link: https://gateway.envoyproxy.io/docs/api/extension_types/#oidc

navigation:
includeTOC: true
includeBackToTopLinks: true
46 changes: 41 additions & 5 deletions site/crd-ref-docs/templates/gv_details.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,51 @@

{{ $gv.Doc }}

{{- if $gv.Kinds }}
### Resource Types
{{- if $gv.Kinds }}
## Resource Kinds

### Available Kinds
{{- range $gv.SortedKinds }}
- {{ $gv.TypeForKind . | markdownRenderTypeLink }}
{{- end }}
{{ end }}

{{ range $gv.SortedTypes }}
### Kind Definitions
{{- range $gv.SortedKinds }}
{{- $type := $gv.TypeForKind . }}
{{ template "type" $type }}
{{- end }}
{{- end }}

{{- if $gv.Types }}
## Supporting Types

### Available Types
{{- range $gv.SortedTypes }}
{{- $type := . }}
{{- $isKind := false }}
{{- range $gv.Kinds }}
{{- if eq . $type.Name }}
{{- $isKind = true }}
{{- end }}
{{- end }}
{{- if not $isKind }}
- {{ markdownRenderTypeLink . }}
{{- end }}
{{- end }}

### Type Definitions
{{- range $gv.SortedTypes }}
{{- $type := . }}
{{- $isKind := false }}
{{- range $gv.Kinds }}
{{- if eq . $type.Name }}
{{- $isKind = true }}
{{- end }}
{{- end }}
{{- if not $isKind }}
{{ template "type" . }}
{{ end }}
{{- end }}
{{- end }}
{{- end }}

{{- end -}}
7 changes: 2 additions & 5 deletions site/crd-ref-docs/templates/gv_list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
---
id: api_references
title: API Reference
toc_min_heading_level: 2
toc_max_heading_level: 4
---

## Packages
{{- range $groupVersions }}
- {{ markdownRenderGVLink . }}
{{- end }}

{{ range $groupVersions }}
{{ template "gvDetails" . }}
{{ end }}
Expand Down
71 changes: 48 additions & 23 deletions site/crd-ref-docs/templates/type.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,63 @@

#### {{ $type.Name }}

{{ if $type.IsAlias }}_Underlying type:_ _{{ markdownRenderTypeLink $type.UnderlyingType }}_{{ end }}

{{ $type.Doc }}

{{ if $type.References -}}
_Appears in:_
{{ if $type.IsAlias }}**Underlying type:** {{ markdownRenderTypeLink $type.UnderlyingType }}{{ end }}
{{ if $type.References }}
**Appears in:**
{{- range $type.SortedReferences }}
- {{ markdownRenderTypeLink . }}
{{- end }}
{{- end }}

{{ $type.Doc }}

{{ if $type.Members -}}
| Field | Type | Required | Description |
| --- | --- | --- | --- |

##### Fields

{{ if $type.GVK -}}
| `apiVersion` | _string_ | |`{{ $type.GVK.Group }}/{{ $type.GVK.Version }}`
| `kind` | _string_ | |`{{ $type.GVK.Kind }}`
{{ end -}}
<ApiField
name="apiVersion"
type="String"
required="true"
description="We are on version <code>{{ $type.GVK.Group }}/{{ $type.GVK.Version }}</code> of the API."
/>

<ApiField
name="kind"
type="String"
required="true"
description="This is a <code>{{ $type.GVK.Kind }}</code> resource"
/>
{{- end }}

{{ range $type.Members -}}
{{- with .Markers.notImplementedHide -}}
{{- else -}}
| `{{ .Name }}` | _{{ markdownRenderType .Type }}_ | {{ with .Markers.optional }} {{ "false" }} {{ else }} {{ "true" }} {{end}} | {{ template "type_members" . }} |
{{ end -}}
{{- end -}}
{{- end -}}
{{- if not .Markers.notImplementedHide -}}
<ApiField
name="{{ .Name }}"
type="{{ markdownRenderType .Type }}"
required="{{ if .Markers.optional }}false{{ else }}true{{ end }}"
{{- if .Default }}
defaultValue="{{ .Default }}"
{{- end }}
description="{{ template "type_members" . }}"
/>
{{- end }}
{{- end }}
{{- end }}

{{ if $type.EnumValues -}}
| Value | Description |
| ----- | ----------- |
##### Possible Values

{{ range $type.EnumValues -}}
| `{{ .Name }}` | {{ markdownRenderFieldDoc .Doc }} |
{{ end -}}
{{- end -}}
{{- end -}}
<ApiField
name="{{ .Name }}"
type="enum"
required="false"
description="{{ markdownRenderFieldDoc .Doc }}"
/>
{{- end }}
{{- end }}

{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion site/crd-ref-docs/templates/type_members.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{{- if eq $field.Name "metadata" -}}
Refer to Kubernetes API documentation for fields of `metadata`.
{{- else -}}
{{ markdownRenderFieldDoc $field.Doc }}
{{ markdownRenderFieldDoc $field.Doc | replace "\"" "`" }}
{{- end -}}
{{- end -}}
Loading