Add some generated API documentation. (#81)

Add some generated API documentation using https://github.com/elastic/crd-ref-docs which is now packaged in the codegen image.
This commit is contained in:
Matt Moyer
2020-08-31 11:27:39 -05:00
committed by GitHub
parent 2546d3f823
commit f49317d7e4
23 changed files with 705 additions and 19 deletions
+12
View File
@@ -0,0 +1,12 @@
# Configuration file for https://github.com/elastic/crd-ref-docs
processor:
# Ignore internal API versions
ignoreGroupVersions:
- "crd.pinniped.dev/crdpinniped"
- "pinniped.dev/pinniped"
ignoreFields:
- "TypeMeta$"
render:
kubernetesVersion: KUBE_MINOR_VERSION
+19
View File
@@ -0,0 +1,19 @@
{{- define "gvDetails" -}}
{{- $gv := . -}}
[id="{{ asciidocGroupVersionID $gv | asciidocRenderAnchorID }}"]
=== {{ $gv.GroupVersionString }}
{{ $gv.Doc }}
{{- if $gv.Kinds }}
.Resource Types
{{- range $gv.SortedKinds }}
- {{ $gv.TypeForKind . | asciidocRenderTypeLink }}
{{- end }}
{{ end }}
{{ range $gv.SortedTypes }}
{{ template "type" . }}
{{ end }}
{{- end -}}
+19
View File
@@ -0,0 +1,19 @@
{{- define "gvList" -}}
{{- $groupVersions := . -}}
// Generated documentation. Please do not edit.
:anchor_prefix: k8s-api
[id="{p}-api-reference"]
== API Reference
.Packages
{{- range $groupVersions }}
- {{ asciidocRenderGVLink . }}
{{- end }}
{{ range $groupVersions }}
{{ template "gvDetails" . }}
{{ end }}
{{- end -}}
+35
View File
@@ -0,0 +1,35 @@
{{- define "type" -}}
{{- $type := . -}}
{{- if asciidocShouldRenderType $type -}}
[id="{{ asciidocTypeID $type | asciidocRenderAnchorID }}"]
==== {{ $type.Name }} {{ if $type.IsAlias }}({{ asciidocRenderTypeLink $type.UnderlyingType }}) {{ end }}
{{ $type.Doc }}
{{ if $type.References -}}
.Appears In:
****
{{- range $type.SortedReferences }}
- {{ asciidocRenderTypeLink . }}
{{- end }}
****
{{- end }}
{{ if $type.Members -}}
[cols="25a,75a", options="header"]
|===
| Field | Description
{{ if $type.GVK -}}
| *`apiVersion`* __string__ | `{{ $type.GVK.Group }}/{{ $type.GVK.Version }}`
| *`kind`* __string__ | `{{ $type.GVK.Kind }}`
{{ end -}}
{{ range $type.Members -}}
| *`{{ .Name }}`* __{{ asciidocRenderType .Type }}__ | {{ template "type_members" . }}
{{ end -}}
|===
{{ end -}}
{{- end -}}
{{- end -}}
+8
View File
@@ -0,0 +1,8 @@
{{- define "type_members" -}}
{{- $field := . -}}
{{- if eq $field.Name "metadata" -}}
Refer to Kubernetes API documentation for fields of `metadata`.
{{ else -}}
{{ $field.Doc }}
{{- end -}}
{{- end -}}