Skip to content

Commit cccf9bf

Browse files
committed
Add docs for generating docs
1 parent 6d0f20b commit cccf9bf

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ kubebuilder init --domain example.com
3030

3131
# Create a new API and controller
3232
kubebuilder create resource --group bar --version v1alpha1 --kind Foo
33+
kubectl apply -f hack/sample/foo.yaml
3334

3435
# Install and run your API into the cluster for your current kubeconfig context
3536
GOBIN=$(pwd)/bin go install <PROJECT_PACKAGE>/cmd/controller-manager
3637
bin/controller-manager --kubeconfig ~/.kube/config
38+
kubectl apply -f hack/sample/foo.yaml
39+
40+
# Build your documentation
41+
kubebuilder create example --group bar --version v1alpha1 --kind Foo
42+
kubebuilder docs
3743
```
3844

3945
See the [user guide](docs/tools_user_guide.md) for more details
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Building reference documentation
2+
3+
## Build reference documentation
4+
5+
You may build Kubernetes style reference documentation for your APIs to `docs/reference/build/index.html` by
6+
running `kubebuilder docs`.
7+
8+
**Note:** There is currently an issue where building docs does not work if multiple versions of APIs for the
9+
same group are defined.
10+
11+
## Create an example for your API
12+
13+
You may create an example that will be included in the reference documentation by running the following command
14+
and editing the newly created file:
15+
16+
```sh
17+
kubebuilder create example --group <group> --version <version> --kind <kind>
18+
```
19+
20+
## Add overview or API group documentation
21+
22+
You may add information about the API groups or creating an overview by editing the .md files
23+
under `docs/reference/static_includes`.

docs/tools_user_guide.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,18 @@ export CONTROLLER_IMAGE=<controller-image>
166166
kubectl run $NAME --serviceaccount=installer --image=$INSTALL_IMAGE --restart=OnFailure -- ./installer \
167167
--controller-image=$CONTROLLER_IMAGE --name=$NAME
168168
```
169+
170+
## Build docs for your APIs
171+
172+
It will be helpful for your users to have API documentation. You can generate Kubernetes style APIs using
173+
kubebuilder:
174+
175+
```sh
176+
# Create and edit an example for each API
177+
kubebuilder create example --group group --version version --kind kind
178+
179+
# Generate the docs to docs/reference/build/index.html
180+
kubebuilder docs
181+
```
182+
183+
For more information see [creating reference documentation](creating_reference_documentation.md)

0 commit comments

Comments
 (0)