Skip to content

Commit 68bedfc

Browse files
authored
Merge pull request #3037 from multani/improve-doc
📖 Improve rendering of the documentation
2 parents 5d59e40 + be94061 commit 68bedfc

File tree

21 files changed

+163
-140
lines changed

21 files changed

+163
-140
lines changed

docs/book/src/SUMMARY.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
- [Implementing defaulting/validating webhooks](./cronjob-tutorial/webhook-implementation.md)
2727
- [Running and deploying the controller](./cronjob-tutorial/running.md)
2828

29-
- [Deploying the cert manager](./cronjob-tutorial/cert-manager.md)
29+
- [Deploying cert-manager](./cronjob-tutorial/cert-manager.md)
3030
- [Deploying webhooks](./cronjob-tutorial/running-webhook.md)
3131

3232
- [Writing tests](./cronjob-tutorial/writing-tests.md)
@@ -109,15 +109,15 @@
109109
- [Plugins][plugins]
110110

111111
- [Available Plugins](./plugins/available-plugins.md)
112-
- [To create a project](./docs/invalid)
112+
- [To scaffold a project](./plugins/to-scaffold-project.md)
113113
- [go/v2 (Deprecated)](./plugins/go-v2-plugin.md)
114114
- [go/v3 (Default init scaffold)](./plugins/go-v3-plugin.md)
115115
- [go/v4-alpha](./plugins/go-v4-plugin.md)
116-
- [To add optional features](./docs/invalid)
116+
- [To add optional features](./plugins/to-add-optional-features.md)
117117
- [declarative/v1](./plugins/declarative-v1.md)
118118
- [grafana/v1-alpha](./plugins/grafana-v1-alpha.md)
119119
- [deploy-image/v1-alpha](./plugins/deploy-image-plugin-v1-alpha.md)
120-
- [To be extended for others tools](./docs/invalid)
120+
- [To be extended for others tools](./plugins/to-be-extended.md)
121121
- [kustomize/v1](./plugins/kustomize-v1.md)
122122
- [kustomize/v2-alpha](./plugins/kustomize-v2-alpha.md)
123123
- [Extending the CLI](./plugins/extending-cli.md)

docs/book/src/component-config-tutorial/api-changes.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ loading the config from the file.
5757

5858
</aside>
5959

60-
Lastly, we'll change the `NewManager` call to use the `options` varible we
60+
Lastly, we'll change the `NewManager` call to use the `options` variable we
6161
defined above.
6262

6363
```go
@@ -106,13 +106,16 @@ configMapGenerator:
106106
- controller_manager_config.yaml
107107
```
108108
109-
Update the file `default/kustomization.yaml` by adding under the patchesStrategicMerge: the following patch:
109+
Update the file `default/kustomization.yaml` by adding under the [`patchesStrategicMerge:` key](https://kubectl.docs.kubernetes.io/references/kustomize/builtins/#_patchesstrategicmerge_) the following patch:
110110

111+
```yaml
112+
patchesStrategicMerge:
111113
# Mount the controller config file for loading manager configurations
112114
# through a ComponentConfig type
113115
- manager_config_patch.yaml
116+
```
114117

115-
Update the file `default/manager_config_patch.yaml` by adding under the spec: the following patch:
118+
Update the file `default/manager_config_patch.yaml` by adding under the `spec:` key the following patch:
116119

117120
```yaml
118121
spec:
@@ -131,4 +134,3 @@ spec:
131134
configMap:
132135
name: manager-config
133136
```
134-

docs/book/src/cronjob-tutorial/basic-project.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ basic pieces of boilerplate.
77

88
First up, basic infrastructure for building your project:
99

10-
<details> <summary>`go.mod`: A new Go module matching our project, with
10+
<details><summary><code>go.mod</code>: A new Go module matching our project, with
1111
basic dependencies</summary>
1212

1313
```go
1414
{{#include ./testdata/project/go.mod}}
1515
```
1616
</details>
1717

18-
<details><summary>`Makefile`: Make targets for building and deploying your controller</summary>
18+
<details><summary><code>Makefile</code>: Make targets for building and deploying your controller</summary>
1919

2020
```makefile
2121
{{#include ./testdata/project/Makefile}}
2222
```
2323
</details>
2424

25-
<details><summary>`PROJECT`: Kubebuilder metadata for scaffolding new components</summary>
25+
<details><summary><code>PROJECT</code>: Kubebuilder metadata for scaffolding new components</summary>
2626

2727
```yaml
2828
{{#include ./testdata/project/PROJECT}}
Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
# Deploying the cert manager
1+
# Deploying cert-manager
22

3-
We suggest using [cert manager](https://github.com/jetstack/cert-manager) for
3+
We suggest using [cert-manager](https://github.com/jetstack/cert-manager) for
44
provisioning the certificates for the webhook server. Other solutions should
55
also work as long as they put the certificates in the desired location.
66

77
You can follow
8-
[the cert manager documentation](https://cert-manager.io/docs/installation/)
8+
[the cert-manager documentation](https://cert-manager.io/docs/installation/)
99
to install it.
1010

11-
Cert manager also has a component called CA injector, which is responsible for
12-
injecting the CA bundle into the Mutating|ValidatingWebhookConfiguration.
11+
cert-manager also has a component called [CA
12+
Injector](https://cert-manager.io/docs/concepts/ca-injector/), which is responsible for
13+
injecting the CA bundle into the [`MutatingWebhookConfiguration`](https://pkg.go.dev/k8s.io/api/admissionregistration/v1#MutatingWebhookConfiguration)
14+
/ [`ValidatingWebhookConfiguration`](https://pkg.go.dev/k8s.io/api/admissionregistration/v1#ValidatingWebhookConfiguration).
1315

1416
To accomplish that, you need to use an annotation with key
1517
`cert-manager.io/inject-ca-from`
16-
in the Mutating|ValidatingWebhookConfiguration objects.
17-
The value of the annotation should point to an existing certificate CR instance
18+
in the [`MutatingWebhookConfiguration`](https://pkg.go.dev/k8s.io/api/admissionregistration/v1#MutatingWebhookConfiguration)
19+
/ [`ValidatingWebhookConfiguration`](https://pkg.go.dev/k8s.io/api/admissionregistration/v1#ValidatingWebhookConfiguration) objects.
20+
The value of the annotation should point to an existing [certificate request instance](https://cert-manager.io/docs/concepts/certificaterequest/)
1821
in the format of `<certificate-namespace>/<certificate-name>`.
1922

2023
This is the [kustomize](https://github.com/kubernetes-sigs/kustomize) patch we
21-
used for annotating the Mutating|ValidatingWebhookConfiguration objects.
24+
used for annotating the [`MutatingWebhookConfiguration`](https://pkg.go.dev/k8s.io/api/admissionregistration/v1#MutatingWebhookConfiguration)
25+
/ [`ValidatingWebhookConfiguration`](https://pkg.go.dev/k8s.io/api/admissionregistration/v1#ValidatingWebhookConfiguration) objects.
26+
2227
```yaml
2328
{{#include ./testdata/project/config/default/webhookcainjection_patch.yaml}}
2429
```

docs/book/src/cronjob-tutorial/cronjob-tutorial.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,18 @@ kubebuilder init --domain tutorial.kubebuilder.io --repo tutorial.kubebuilder.io
5353
```
5454

5555
<aside class="note">
56+
5657
Your project's name defaults to that of your current working directory.
5758
You can pass `--project-name=<dns1123-label-string>` to set a different project name.
59+
5860
</aside>
5961

6062
Now that we've got a project in place, let's take a look at what
6163
Kubebuilder has scaffolded for us so far...
6264

6365
<aside class="note">
64-
<h1>Developing in $GOPATH</h1>
66+
67+
<h1>Developing in <code>$GOPATH</code></h1>
6568

6669
If your project is initialized within [`GOPATH`][GOPATH-golang-docs], the implicitly called `go mod init` will interpolate the module path for you.
6770
Otherwise `--repo=<module path>` must be set.

docs/book/src/cronjob-tutorial/running-webhook.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Why?
1010
- You can tear it down in seconds.
1111
- You don't need to push your images to remote registry.
1212

13-
## Cert Manager
13+
## cert-manager
1414

15-
You need to follow [this](./cert-manager.md) to install the cert manager bundle.
15+
You need to follow [this](./cert-manager.md) to install the cert-manager bundle.
1616

1717
## Build your image
1818

docs/book/src/cronjob-tutorial/testdata/emptymain.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020
Our package starts out with some basic imports. Particularly:
2121
2222
- The core [controller-runtime](https://pkg.go.dev/sigs.k8s.io/controller-runtime?tab=doc) library
23-
- The default controller-runtime logging, Zap (more on that a bit later)
23+
- The default controller-runtime logging, [Zap](https://pkg.go.dev/go.uber.org/zap) (more on that a bit later)
2424
2525
*/
2626

@@ -117,7 +117,7 @@ func main() {
117117
}
118118

119119
/*
120-
Note that the Manager can restrict the namespace that all controllers will watch for resources by:
120+
Note that the `Manager` can restrict the namespace that all controllers will watch for resources by:
121121
*/
122122

123123
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
@@ -131,12 +131,13 @@ func main() {
131131
})
132132

133133
/*
134-
The above example will change the scope of your project to a single Namespace. In this scenario,
134+
The above example will change the scope of your project to a single `Namespace`. In this scenario,
135135
it is also suggested to restrict the provided authorization to this namespace by replacing the default
136-
ClusterRole and ClusterRoleBinding to Role and RoleBinding respectively.
137-
For further information see the kubernetes documentation about Using [RBAC Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/).
136+
`ClusterRole` and `ClusterRoleBinding` to `Role` and `RoleBinding` respectively.
137+
For further information see the Kubernetes documentation about Using [RBAC Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/).
138138
139-
Also, it is possible to use the MultiNamespacedCacheBuilder to watch a specific set of namespaces:
139+
Also, it is possible to use the [`MultiNamespacedCacheBuilder`](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/cache#MultiNamespacedCacheBuilder)
140+
to watch a specific set of namespaces:
140141
*/
141142

142143
var namespaces []string // List of Namespaces
@@ -152,7 +153,7 @@ func main() {
152153
})
153154

154155
/*
155-
For further information see [MultiNamespacedCacheBuilder](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/cache?tab=doc#MultiNamespacedCacheBuilder)
156+
For further information see [`MultiNamespacedCacheBuilder`](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/cache?tab=doc#MultiNamespacedCacheBuilder)
156157
*/
157158

158159
// +kubebuilder:scaffold:builder

docs/book/src/multiversion-tutorial/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ a [feature gate][kube-feature-gates]), and became beta in Kubernetes 1.15
3434

3535
If you're on Kubernetes 1.13-1.14, make sure to enable the feature gate.
3636
If you're on Kubernetes 1.12 or below, you'll need a new cluster to use
37-
conversion. Check out the [KinD instructions](/reference/kind.md) for
37+
conversion. Check out the [kind instructions](/reference/kind.md) for
3838
instructions on how to set up a all-in-one cluster.
3939

4040
</aside>

docs/book/src/plugins/available-plugins.md

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,6 @@
22

33
This section describes the plugins supported and shipped in with the Kubebuilder project.
44

5-
## To scaffold the projects
6-
7-
The following plugins are useful to scaffold the whole project with the tool.
8-
9-
| Plugin | Key | Description |
10-
| ---------------------------------------------------------------------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11-
| [go.kubebuilder.io/v2 - (Deprecated)](go-v2-plugin.md) | `go/v2` | Golang plugin responsible for scaffolding the legacy layout provided with Kubebuilder CLI >= `2.0.0` and < `3.0.0`. |
12-
| [go.kubebuilder.io/v3 - (Default scaffold with Kubebuilder init)](go-v3-plugin.md) | `go/v3` | Default scaffold used for creating a project when no plugin(s) are provided. Responsible for scaffolding Golang projects and its configurations. |
13-
| [go.kubebuilder.io/v4-alpha - (Add Apple Sillicom Support)](go-v4-plugin.md) | `go/v4` | Scaffold composite by `base.go.kubebuilder.io/v3` and [kustomize.common.kubebuilder.io/v2-alpha](kustomize-v2-alpha.md). Responsible for scaffolding Golang projects and its configurations. |
14-
15-
## To add optional features
16-
17-
The following plugins are useful to generate code and take advantage of optional features
18-
19-
| Plugin | Key | Description |
20-
| ---------------------------------------------------------------------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21-
| [declarative.go.kubebuilder.io/v1](declarative-v1.md) | `declarative/v1` | Optional plugin used to scaffold APIs/controllers using the [kubebuilder-declarative-pattern][kubebuilder-declarative-pattern] project. |
22-
| [grafana.kubebuilder.io/v1-alpha](grafana-v1-alpha.md) | `grafana/v1-alpha` | Optional helper plugin which can be used to scaffold Grafana Manifests Dashboards for the default metrics which are exported by controller-runtime. |
23-
| [deploy-image.go.kubebuilder.io/v1-alpha](deploy-image-plugin-v1-alpha) | `deploy-image/v1-alpha` | Optional helper plugin which can be used to scaffold APIs and controller with code implementation to Deploy and Manage an Operand(image). |
24-
25-
## To help projects using Kubebuilder as Lib to composite new solutions and plugins
26-
27-
<aside class="note">
28-
29-
<h1>You can also create your own plugins, see:</h1>
30-
31-
- [Creating your own plugins][create-plugins].
32-
33-
</aside>
34-
35-
Then, see that you can use the kustomize plugin, which is responsible for to scaffold the kustomize files under `config/`, as
36-
the base language plugins which are responsible for to scaffold the Golang files to create your own plugins to work with
37-
another languages (i.e. [Operator-SDK][sdk] does to allow users work with Ansible/Helm) or to add
38-
helpers on top, such as [Operator-SDK][sdk] does to add their features to integrate the projects with [OLM][olm].
39-
40-
| Plugin | Key | Description |
41-
| ---------------------------------------------------------------------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
42-
| [kustomize.common.kubebuilder.io/v1](kustomize-v1.md) | `kustomize/v1` | Responsible for scaffold all manifests to configure the projects with [kustomize(v3)][kustomize]. (create and update the `config/` directory). This plugin is used in the composition to create the plugin (`go/v3`). |
43-
| [kustomize.common.kubebuilder.io/v2-alpha](kustomize-v2-alpha.md) | `kustomize/v2-alpha` | It has the same purpose of `kustomize/v1`. However, it works with [kustomize][kustomize] version `v4` and addresses the required changes for future kustomize configurations. It will probably be used with the future `go/v4-alpha` plugin. |
44-
| `base.go.kubebuilder.io/v3` | `base/v3` | Responsible for scaffold all files which specific requires Golang. This plugin is used in the composition to create the plugin (`go/v3`) |
45-
46-
<aside class="note">
47-
48-
<h1>Plugins Versioning</h1>
49-
50-
**ALPHA** plugins can introduce breaking changes. For further info see [Plugins Versioning](./plugins/plugins-versioning.md).
51-
52-
</aside>
53-
54-
[create-plugins]: creating-plugins.md
55-
[kubebuilder-declarative-pattern]: https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern
56-
[kustomize]: https://kustomize.io/
57-
[sdk]: https://github.com/operator-framework/operator-sdk
58-
[olm]: https://olm.operatorframework.io/
59-
5+
{{#include to-scaffold-project.md }}
6+
{{#include to-add-optional-features.md }}
7+
{{#include to-be-extended.md }}

docs/book/src/plugins/creating-plugins.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Creating your own plugins
22

3+
[extending-cli]: extending-cli.md
4+
[controller-runtime]: https://github.com/kubernetes-sigs/controller-runtime
5+
[operator-pattern]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator
6+
[sdk-ansible]: https://sdk.operatorframework.io/docs/building-operators/ansible/
7+
[sdk-cli-pkg]: https://pkg.go.dev/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli
8+
[sdk-helm]: https://sdk.operatorframework.io/docs/building-operators/helm/
9+
[sdk]: https://github.com/operator-framework/operator-sdk
10+
311
## Overview
412

5-
You can extend the Kubebuilder API to create your own plugins. If [extending the CLI][extending-cli], your plugin will be implemented in your project and registered to the CLI as has been done by the [SDK][sdk] project. See its [cli code][sdk-cli-pkg] as an example.
13+
You can extend the Kubebuilder API to create your own plugins. If [extending the CLI][extending-cli], your plugin will be implemented in your project and registered to the CLI as has been done by the [SDK][sdk] project. See its [CLI code][sdk-cli-pkg] as an example.
614

715
## Language-based Plugins
816

@@ -44,23 +52,21 @@ And then, you will also be able to use custom plugins and options currently or i
4452

4553
Note that users are also able to use plugins to customize their scaffolds and address specific needs.
4654

47-
See that Kubebuilder provides the [deploy-image][deploy-image] plugin that allows the user to create the controller & CRs which will deploy and manage an image on the cluster:
55+
See that Kubebuilder provides the [`deploy-image`][deploy-image] plugin that allows the user to create the controller & CRs which will deploy and manage an image on the cluster:
4856

4957
```sh
5058
kubebuilder create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached,-m=64,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha"
5159
```
5260

53-
This plugin will perform a custom scaffold following the [Operator Pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator).
61+
This plugin will perform a custom scaffold following the [Operator Pattern][operator-pattern].
5462

55-
Another example is the [grafana][grafana] plugin that scaffolds a new folder container manifests to visualize operator status on Grafana Web UI:
63+
Another example is the [`grafana`][grafana] plugin that scaffolds a new folder container manifests to visualize operator status on Grafana Web UI:
5664

5765
```sh
5866
kubebuilder edit --plugins="grafana.kubebuilder.io/v1-alpha"
5967
```
6068

6169
In this way, by [Extending the Kubebuilder CLI][extending-cli], you can also create custom plugins such this one.
6270

63-
Feel free to check the implementation under:
64-
65-
- deploy-image: <https://github.com/kubernetes-sigs/kubebuilder/tree/v3.7.0/pkg/plugins/golang/deploy-image/v1alpha1>
66-
- grafana: <https://github.com/kubernetes-sigs/kubebuilder/tree/v3.7.0/pkg/plugins/optional/grafana/v1alpha>
71+
[grafana]: https://github.com/kubernetes-sigs/kubebuilder/tree/v3.7.0/pkg/plugins/optional/grafana/v1alpha
72+
[deploy-image]: https://github.com/kubernetes-sigs/kubebuilder/tree/v3.7.0/pkg/plugins/golang/deploy-image/v1alpha1

0 commit comments

Comments
 (0)