Skip to content

DOC-1387 Add Kubernetes automations to the CLI #103

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .github/crd-config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
processor:
# RE2 regular expressions describing types that should be excluded from the generated documentation.
ignoreTypes:
render:
kubernetesVersion: 1.23
knownTypes:
- name: SecretObjectReference
package: sigs.k8s.io/gateway-api/apis/v1beta1
link: https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.SecretObjectReference
17 changes: 17 additions & 0 deletions .github/crd-config/templates/asciidoctor/operator/gv_details.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- define "gvDetails" -}}
{{- $gv := . -}}

{{ $gv.Doc }}

{{- if $gv.Kinds }}
.Resource Types
{{- range $gv.SortedKinds }}
- {{ $gv.TypeForKind . | asciidocRenderTypeLink }}
{{- end }}
{{ end }}

{{ range $gv.SortedTypes }}
{{ template "type" . }}
{{ end }}

{{- end -}}
16 changes: 16 additions & 0 deletions .github/crd-config/templates/asciidoctor/operator/gv_list.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- define "gvList" -}}
{{- $groupVersions := . -}}

// Autogenerated documentation. Do not edit this page See https://github.com/redpanda-data/docs/blob/main/.github/workflows/generate-crd.yml.
{{- with index $groupVersions 0 }}
= {{ . }}
{{- end }}
:anchor_prefix: k8s-api
:description: Custom resource definitions for Redpanda resources. Use the Redpanda resources to create and manage Redpanda clusters, users and topics with the Redpanda Operator.
:page-aliases: reference:k-topic-crd.adoc

{{ range $groupVersions }}
{{ template "gvDetails" . }}
{{ end }}

{{- end -}}
38 changes: 38 additions & 0 deletions .github/crd-config/templates/asciidoctor/operator/type.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- define "type" -}}
{{- $type := . -}}
{{- if asciidocShouldRenderType $type -}}

[id="{{ asciidocTypeID $type | asciidocRenderAnchorID }}"]
== {{ $type.Name }} {{ if $type.IsAlias }}({{ asciidocRenderTypeLink $type.UnderlyingType }}) {{ end }}

{{ $type.Doc }}

{{ if eq $type.Name "RedpandaClusterSpec" }}
For descriptions and default values, see xref:k-redpanda-helm-spec.adoc[].
{{ end }}

{{ 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 -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- define "type_members" -}}
{{- $field := . -}}
{{- if eq $field.Name "metadata" -}}
Refer to the Kubernetes API documentation for fields of `metadata`.
{{ else -}}
{{ asciidocRenderFieldDoc $field.Doc }}
{{- end -}}
{{- end -}}
19 changes: 19 additions & 0 deletions .github/crd-config/templates/markdown/gv_details.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- define "gvDetails" -}}
{{- $gv := . -}}

## {{ $gv.GroupVersionString }}

{{ $gv.Doc }}

{{- if $gv.Kinds }}
### Resource Types
{{- range $gv.SortedKinds }}
- {{ $gv.TypeForKind . | markdownRenderTypeLink }}
{{- end }}
{{ end }}

{{ range $gv.SortedTypes }}
{{ template "type" . }}
{{ end }}

{{- end -}}
15 changes: 15 additions & 0 deletions .github/crd-config/templates/markdown/gv_list.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- define "gvList" -}}
{{- $groupVersions := . -}}

# Redpanda Operator CRD Reference

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

{{ range $groupVersions }}
{{ template "gvDetails" . }}
{{ end }}

{{- end -}}
38 changes: 38 additions & 0 deletions .github/crd-config/templates/markdown/type.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- define "type" -}}
{{- $type := . -}}
{{- if markdownShouldRenderType $type -}}

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

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

{{ $type.Doc }}

{{ if eq $type.Name "RedpandaClusterSpec" }}
These fields are used to configure the Redpanda Helm chart. For descriptions and default values, see [Redpanda Helm Chart Specification
](../redpanda-helm-spec).
{{ end }}

{{ if $type.References -}}
_Appears in:_
{{- range $type.SortedReferences }}
- {{ markdownRenderTypeLink . }}
{{- end }}
{{- end }}

{{ if $type.Members -}}
| Field | Description |
| --- | --- |
{{ if $type.GVK -}}
| `apiVersion` _string_ | `{{ $type.GVK.Group }}/{{ $type.GVK.Version }}`
| `kind` _string_ | `{{ $type.GVK.Kind }}`
{{ end -}}

{{ range $type.Members -}}
| `{{ .Name }}` _{{ markdownRenderType .Type }}_ | {{ template "type_members" . }} |
{{ end -}}

{{ end -}}

{{- end -}}
{{- end -}}
8 changes: 8 additions & 0 deletions .github/crd-config/templates/markdown/type_members.tpl
Original file line number Diff line number Diff line change
@@ -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 -}}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ venv/
__pycache__/
gen/
tree-sitter/
test/
test/
modules/
Loading