一键导入
documentation-standards
// Standards for Kubebuilder documentation in docs/book/src/. Use when writing or reviewing documentation, tutorials, guides, or plugin docs.
// Standards for Kubebuilder documentation in docs/book/src/. Use when writing or reviewing documentation, tutorials, guides, or plugin docs.
Standards for CLI command and flag descriptions in Kubebuilder. Use when writing or reviewing CLI flags, commands, or help text.
Guidelines for maintaining the Kubebuilder Helm plugin (helm/v2-alpha) in pkg/plugins/optional/helm/v2alpha/. Use when working on Helm plugin code, templates, or chart generation.
| name | documentation-standards |
| description | Standards for Kubebuilder documentation in docs/book/src/. Use when writing or reviewing documentation, tutorials, guides, or plugin docs. |
| license | Apache-2.0 |
| metadata | {"author":"The Kubernetes Authors"} |
{{#include}} or {{#literatego}} from testdata when available (see Code Examples section)Tutorial testdata projects under docs/book/src/*/testdata/project/ are auto-generated.
Critical: Files in testdata are generated from two sources:
Tutorial-specific generators in hack/docs/internal/:
internal/cronjob-tutorial/ - CronJob tutorialinternal/getting-started/ - Getting Started guideinternal/multiversion-tutorial/ - Multiversion tutorialDefault scaffold from plugins in pkg/plugins/:
AGENTS.md generated by pkg/plugins/golang/v4/scaffolds/internal/templates/agents.goconfig/ kustomize files generated by pkg/plugins/common/kustomize/*/scaffolds/internal/templates/To fix documentation issues in testdata:
hack/docs/internal/AGENTS.md, config/ files): Edit plugin templates in pkg/plugins/make install to rebuild binary, then make generate-docsSee references/REFERENCE.md for generator locations and commands.
Marker documentation is auto-generated from controller-tools and cannot be edited directly.
Files using {{#markerdocs}} preprocessor (auto-generated from controller-tools comments):
docs/book/src/reference/markers/crd.mddocs/book/src/reference/markers/webhook.mddocs/book/src/reference/markers/object.mddocs/book/src/reference/markers/crd-validation.mddocs/book/src/reference/markers/rbac.mddocs/book/src/reference/markers/crd-processing.mddocs/book/src/reference/controller-gen.md (sections with {{#markerdocs}})To fix marker documentation:
github.com/kubernetes-sigs/controller-toolsmarkerdocs preprocessordocs/book/book.toml and runs via docs/book/markerdocs.shDo NOT:
If you find issues in marker documentation: Report them to controller-tools repository.
## Creating a new controller)```go not ```)../guide.md not /docs/guide.md)<aside class="note"> or <aside class="warning"> (see references/REFERENCE.md)ALWAYS prefer including from testdata when available - do not copy/paste code inline.
make test-bookUse includes (tutorial code, plugin examples, any testdata project code) Use inline code (very short snippets 1-3 lines, pseudo-code, code not in testdata yet)
# For Go code (adds syntax highlighting, imports)
{{#literatego ./testdata/project/internal/controller/cronjob_controller.go}}
# For other files (YAML, JSON, shell)
{{#include ./testdata/project/config/manager/manager.yaml}}
# For specific sections with anchors
{{#include ./testdata/project/Makefile:docker-build}}
Shell commands: Use $ prefix for commands, no prefix for output.
All examples and commands must be tested in clean environment before documenting.
See references/REFERENCE.md for detailed examples.
Always capitalize in prose:
Always lowercase in prose:
In code: Exact capitalization as defined (corev1.Namespace{}, metav1.ObjectMeta)
Before submitting:
{{#include}} or {{#literatego}} from testdata (not inline copy/paste)make fix-docs before committingSee references/REFERENCE.md for detailed examples and technical references.