-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: We want to have our CRDs documented Solution: Use gen-crd-api-reference-docs to generate the docs automatically Co-authored-by: Danielle De Leo <[email protected]> Co-authored-by: Saylor Berman <[email protected]>
- Loading branch information
1 parent
b3e7d39
commit eb2daaf
Showing
16 changed files
with
1,555 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"hideMemberFields": [ | ||
"TypeMeta" | ||
], | ||
"hideTypePatterns": [ | ||
"ParseError$", | ||
"List$" | ||
], | ||
"externalPackages": [ | ||
{ | ||
"typeMatchPrefix": "^k8s\\.io/apimachinery/pkg/apis/meta/v1\\.Duration$", | ||
"docsURLTemplate": "https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration" | ||
}, | ||
{ | ||
"typeMatchPrefix": "^k8s\\.io/(api|apimachinery/pkg/apis)/", | ||
"docsURLTemplate": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#{{lower .TypeIdentifier}}-{{arrIndex .PackageSegments -1}}-{{arrIndex .PackageSegments -2}}" | ||
}, | ||
{ | ||
"typeMatchPrefix": "^sigs.k8s.io/gateway-api/apis/", | ||
"docsURLTemplate": "https://pkg.go.dev/sigs.k8s.io/gateway-api/apis/{{arrIndex .PackageSegments -1}}#{{.TypeIdentifier}}" | ||
} | ||
], | ||
"typeDisplayNamePrefixOverrides": { | ||
"k8s.io/api/": "Kubernetes ", | ||
"k8s.io/apimachinery/pkg/apis/": "Kubernetes " | ||
}, | ||
"markdownDisabled": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{{ define "members" }} | ||
|
||
{{ range .Members }} | ||
{{ if not (hiddenMember .)}} | ||
<tr> | ||
<td> | ||
<code>{{ fieldName . }}</code><br/> | ||
<em> | ||
{{ if linkForType .Type }} | ||
<a href="{{ linkForType .Type}}"> | ||
{{ typeDisplayName .Type }} | ||
</a> | ||
{{ else }} | ||
{{ typeDisplayName .Type }} | ||
{{ end }} | ||
</em> | ||
</td> | ||
<td> | ||
{{ if fieldEmbedded . }} | ||
<p> | ||
(Members of <code>{{ fieldName . }}</code> are embedded into this type.) | ||
</p> | ||
{{ end}} | ||
|
||
{{ if isOptionalMember .}} | ||
<em>(Optional)</em> | ||
{{ end }} | ||
|
||
{{ safe (renderComments .CommentLines) }} | ||
|
||
{{ if and (eq (.Type.Name.Name) "ObjectMeta") }} | ||
Refer to the Kubernetes API documentation for the fields of the | ||
<code>metadata</code> field. | ||
{{ end }} | ||
|
||
{{ if or (eq (fieldName .) "spec") }} | ||
<br/> | ||
<br/> | ||
<table class="table table-bordered table-striped"> | ||
{{ template "members" .Type }} | ||
</table> | ||
{{ end }} | ||
</td> | ||
</tr> | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{{ define "packages" }} | ||
--- | ||
title: "API Reference" | ||
description: "NGINX Gateway API Reference" | ||
weight: 100 | ||
toc: false | ||
--- | ||
|
||
{{ with .packages}} | ||
<p>Packages:</p> | ||
<ul> | ||
{{ range . }} | ||
<li> | ||
<a href="#{{- packageAnchorID . -}}">{{ packageDisplayName . }}</a> | ||
</li> | ||
{{ end }} | ||
</ul> | ||
{{ end}} | ||
|
||
{{ range .packages }} | ||
<h2 id="{{- packageAnchorID . -}}"> | ||
{{- packageDisplayName . -}} | ||
</h2> | ||
|
||
{{ with (index .GoPackages 0 )}} | ||
{{ with .DocComments }} | ||
<p> | ||
{{ safe (renderComments .) }} | ||
</p> | ||
{{ end }} | ||
{{ end }} | ||
|
||
Resource Types: | ||
<ul> | ||
{{- range (visibleTypes (sortedTypes .Types)) -}} | ||
{{ if isExportedType . -}} | ||
<li> | ||
<a href="{{ linkForType . }}">{{ typeDisplayName . }}</a> | ||
</li> | ||
{{- end }} | ||
{{- end -}} | ||
</ul> | ||
|
||
{{ range (visibleTypes (sortedTypes .Types))}} | ||
{{ template "type" . }} | ||
{{ end }} | ||
<hr/> | ||
{{ end }} | ||
|
||
<p><em> | ||
Generated with <code>gen-crd-api-reference-docs</code> | ||
</em></p> | ||
|
||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{{ define "type" }} | ||
|
||
<h3 id="{{ anchorIDForType . }}"> | ||
{{- .Name.Name }} | ||
{{ if eq .Kind "Alias" }}(<code>{{.Underlying}}</code> alias)</p>{{ end -}} | ||
<a class="headerlink" href="#{{ anchorIDForType . }}" title="Permanent link">¶</a> | ||
</h3> | ||
{{ with (typeReferences .) }} | ||
<p> | ||
(<em>Appears on: </em> | ||
{{- $prev := "" -}} | ||
{{- range . -}} | ||
{{- if $prev -}},{{ end -}} | ||
{{ $prev = . }} | ||
<a href="{{ linkForType . }}">{{ typeDisplayName . }}</a> | ||
{{- end -}} | ||
) | ||
</p> | ||
{{ end }} | ||
|
||
|
||
<p> | ||
{{ safe (renderComments .CommentLines) }} | ||
</p> | ||
|
||
{{ with (constantsOfType .) }} | ||
<table class="table table-bordered table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Value</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{- range . -}} | ||
<tr> | ||
{{- /* | ||
renderComments implicitly creates a <p> element, so we | ||
add one to the display name as well to make the contents | ||
of the two cells align evenly. | ||
*/ -}} | ||
<td><p>{{ typeDisplayName . }}</p></td> | ||
<td>{{ safe (renderComments .CommentLines) }}</td> | ||
</tr> | ||
{{- end -}} | ||
</tbody> | ||
</table> | ||
{{ end }} | ||
|
||
{{ if .Members }} | ||
<table class="table table-bordered table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Field</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{ if isExportedType . }} | ||
<tr> | ||
<td> | ||
<code>apiVersion</code><br/> | ||
string</td> | ||
<td> | ||
<code> | ||
{{apiGroup .}} | ||
</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<code>kind</code><br/> | ||
string | ||
</td> | ||
<td><code>{{.Name.Name}}</code></td> | ||
</tr> | ||
{{ end }} | ||
{{ template "members" .}} | ||
</tbody> | ||
</table> | ||
{{ end }} | ||
|
||
{{ end }} |
Oops, something went wrong.