diff --git a/docs/README.md b/docs/README.md index 3da3a7d1aa82bc538c7896826ee157264135f62f..009e375164b6d9703ab2c70840eb153cb26c3d0e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -39,5 +39,5 @@ crdoc --resources ../theodolite/crd/ --output api-reference/crds.md With the following command, crdoc is installed and executed in Docker: ```sh -docker run --rm -v "`pwd`/../theodolite/crd/":/crd -v "`pwd`/api-reference":/api-reference golang sh -c "go install fybrik.io/crdoc@latest && crdoc --resources /crd/ --output /api-reference/crds.md" +docker run --rm -v "`pwd`/../theodolite/crd/":/crd -v "`pwd`/api-reference":/api-reference golang sh -c "go install fybrik.io/crdoc@v0.5.1 && crdoc --resources /crd/ --template /api-reference/crds.tmpl --output /api-reference/crds.md" ``` diff --git a/docs/api-reference/crds.tmpl b/docs/api-reference/crds.tmpl new file mode 100644 index 0000000000000000000000000000000000000000..3f642f371823a75b069f4747fcb0c1715fa5f31d --- /dev/null +++ b/docs/api-reference/crds.tmpl @@ -0,0 +1,104 @@ +--- +title: Theodolite CRDs +has_children: false +parent: API Reference +nav_order: 1 +--- + + +# API Reference + +Packages: +{{range .Groups}} +- [{{.Group}}/{{.Version}}](#{{ anchorize (printf "%s/%s" .Group .Version) }}) +{{- end -}}{{/* range .Groups */}} + +{{- range .Groups }} +{{- $group := . }} + +# {{.Group}}/{{.Version}} + +Resource Types: +{{range .Kinds}} +- [{{.Name}}](#{{ anchorize .Name }}) +{{end}}{{/* range .Kinds */}} + +{{range .Kinds}} +{{$kind := .}} +## {{.Name}} +<sup><sup>[↩ Parent](#{{ anchorize (printf "%s/%s" $group.Group $group.Version) }} )</sup></sup> + +{{range .Types}} + +{{if not .IsTopLevel}} +### {{.Name}} +{{if .ParentKey}}<sup><sup>[↩ Parent](#{{.ParentKey}})</sup></sup>{{end}} +{{end}} + + +{{.Description}} + +<table> + <thead> + <tr> + <th>Name</th> + <th>Type</th> + <th>Description</th> + <th>Required</th> + </tr> + </thead> + <tbody> + {{- if .IsTopLevel -}} + <tr> + <td><b>apiVersion</b></td> + <td>string</td> + <td>{{$group.Group}}/{{$group.Version}}</td> + <td>true</td> + </tr> + <tr> + <td><b>kind</b></td> + <td>string</td> + <td>{{$kind.Name}}</td> + <td>true</td> + </tr> + <tr> + <td><b><a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#objectmeta-v1-meta">metadata</a></b></td> + <td>object</td> + <td>Refer to the Kubernetes API documentation for the fields of the `metadata` field.</td> + <td>true</td> + </tr> + {{- end -}} + {{- range .Fields -}} + <tr> + <td><b>{{if .TypeKey}}<a href="#{{.TypeKey}}">{{.Name}}</a>{{else}}{{.Name}}{{end}}</b></td> + <td>{{.Type}}</td> + <td> + {{.Description}}<br/> + {{- if or .Schema.Format .Schema.Enum .Schema.Default .Schema.Minimum .Schema.Maximum }} + <br/> + {{- end}} + {{- if .Schema.Format }} + <i>Format</i>: {{ .Schema.Format }}<br/> + {{- end }} + {{- if .Schema.Enum }} + <i>Enum</i>: {{ .Schema.Enum | toStrings | join ", " }}<br/> + {{- end }} + {{- if .Schema.Default }} + <i>Default</i>: {{ .Schema.Default }}<br/> + {{- end }} + {{- if .Schema.Minimum }} + <i>Minimum</i>: {{ .Schema.Minimum }}<br/> + {{- end }} + {{- if .Schema.Maximum }} + <i>Maximum</i>: {{ .Schema.Maximum }}<br/> + {{- end }} + </td> + <td>{{.Required}}</td> + </tr> + {{- end -}} + </tbody> +</table> + +{{- end}}{{/* range .Types */}} +{{- end}}{{/* range .Kinds */}} +{{- end}}{{/* range .Groups */}} \ No newline at end of file