Skip to content

Commit d8c8f4d

Browse files
committed
improvements and fixes in the documentation
1 parent d2fa79c commit d8c8f4d

File tree

7 files changed

+23
-12
lines changed

7 files changed

+23
-12
lines changed

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The kubebuilder book is served using [mdBook](https://github.com/rust-lang-nurse
44

55
1. Follow the instructions at [https://github.com/rust-lang-nursery/mdBook#installation](https://github.com/rust-lang-nursery/mdBook#installation) to
66
install mdBook.
7-
2. Make sure [controller-gen](https://pkg.go.dev/sigs.k8s.io/controller-tools/cmd/controller-gen) is install in `$GOPATH`.
7+
2. Make sure [controller-gen](https://pkg.go.dev/sigs.k8s.io/controller-tools/cmd/controller-gen) is installed in `$GOPATH`.
88
3. cd into the `docs/book` directory
99
4. Run `mdbook serve`
1010
5. Visit [http://localhost:3000](http://localhost:3000)

docs/book/src/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ environment variables to only add this option for development purposes, such as:
5555
5656
```go
5757
leaderElectionNS := ""
58-
if os.Getenv("ENABLE_LEADER_ELECATION_NAMESPACE") != "false" {
58+
if os.Getenv("ENABLE_LEADER_ELECTION_NAMESPACE") != "false" {
5959
leaderElectionNS = "<project-name>-system"
6060
}
6161

docs/book/src/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ common tooling to manage the objects.
5151
Building services as Kubernetes APIs provides many advantages to plain old REST, including:
5252

5353
* Hosted API endpoints, storage, and validation.
54-
* Rich tooling and clis such as `kubectl` and `kustomize`.
55-
* Support for Authn and granular Authz.
54+
* Rich tooling and CLIs such as `kubectl` and `kustomize`.
55+
* Support for AuthN and granular AuthZ.
5656
* Support for API evolution through API versioning and conversion.
5757
* Facilitation of adaptive / self-healing APIs that continuously respond to changes
5858
in the system state without user intervention.

docs/book/src/quick-start.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Projects created by Kubebuilder contain a Makefile that will install tools at ve
2121
- [kustomize](https://github.com/kubernetes-sigs/kustomize)
2222
- [controller-gen](https://github.com/kubernetes-sigs/controller-tools)
2323

24-
The versions which are defined in the `Makefile` and `go.mod` files are the versions tested and therefore is recommend to use the specified versions.
24+
The versions which are defined in the `Makefile` and `go.mod` files are the versions tested and therefore is recommended to use the specified versions.
2525

2626
</aside>
2727

@@ -91,7 +91,7 @@ and the `internal/controllers/guestbook_controller.go` where the reconciliation
9191
logic. For more info see [Designing an API](/cronjob-tutorial/api-design.md) and [What's in
9292
a Controller](cronjob-tutorial/controller-overview.md).
9393

94-
If you are editing the API definitions, generate the manifests such as Custom Resources (CRs) or Custom Resource Defintions (CRDs) using
94+
If you are editing the API definitions, generate the manifests such as Custom Resources (CRs) or Custom Resource Definitions (CRDs) using
9595
```bash
9696
make manifests
9797
```

docs/book/src/reference/good-practices.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Building your operator commonly involves extending the Kubernetes API itself. It
1818

1919
Additionally, we recommend checking the documentation on [Operator patterns][operator-pattern] from Kubernetes to better understand the purpose of the standard solutions built with KubeBuilder.
2020

21-
## Why you should adhere to the k8s API conventions and standards
21+
## Why you should adhere to the Kubernetes API conventions and standards
2222

23-
Embracing the [Kubernetes API conventions and standards][k8s-api-convetions] is crucial for maximizing the potential of your applications and deployments. By adhering to these established practices, you can benefit in several ways.
23+
Embracing the [Kubernetes API conventions and standards][k8s-api-conventions] is crucial for maximizing the potential of your applications and deployments. By adhering to these established practices, you can benefit in several ways.
2424

2525
Firstly, adherence ensures seamless interoperability within the Kubernetes ecosystem. Following conventions allows your applications to work harmoniously with other components, reducing compatibility issues and promoting a consistent user experience.
2626

@@ -57,7 +57,7 @@ These challenges underline the importance of assigning each controller the singl
5757

5858
## Why You Should Adopt Status Conditions
5959

60-
We recommend you manage your solutions using Status Conditionals following the [K8s Api conventions][k8s-aoi-convetions] because:
60+
We recommend you manage your solutions using Status Conditionals following the [K8s Api conventions][k8s-api-conventions] because:
6161

6262
- **Standardization**: Conditions provide a standardized way to represent the state of an Operator's custom resources, making it easier for users and tools to understand and interpret the resource's status.
6363
- **Readability**: Conditions can clearly express complex states by using a combination of multiple conditions, making it easier for users to understand the current state and progress of the resource.
@@ -75,10 +75,13 @@ Therefore, you can check an example of Status Conditional usage by looking at it
7575

7676
</aside>
7777

78-
[docs]: ./cronjob-tutorial/gvks.html
78+
[docs]: /cronjob-tutorial/gvks.html
7979
[operator-pattern]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/
8080
[controllers]: https://kubernetes.io/docs/concepts/architecture/controller/
8181
[controller-runtime-topic]: https://github.com/kubernetes-sigs/controller-runtime/blob/main/FAQ.md#q-how-do-i-have-different-logic-in-my-reconciler-for-different-types-of-events-eg-create-update-delete
8282
[controller-runtime]: https://github.com/kubernetes-sigs/controller-runtime
83-
[deploy-image]: ./plugins/deploy-image-plugin-v1-alpha.md
83+
[deploy-image]: /plugins/deploy-image-plugin-v1-alpha.md
8484
[controller-runtime-manager]: https://github.com/kubernetes-sigs/controller-runtime/blob/304027bcbe4b3f6d582180aec5759eb4db3f17fd/pkg/manager/manager.go#L53
85+
[k8s-api-conventions]: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md
86+
[k8s-control-loop]: https://kubernetes.io/docs/concepts/architecture/controller/
87+
[k8s-operator-pattern]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/

docs/book/src/reference/raising-events.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,13 @@ type MyKindReconciler struct {
7575
// See that we added the following code to allow us to pass the record.EventRecorder
7676
Recorder record.EventRecorder
7777
}
78+
```
79+
7880
### Passing the EventRecorder to the Controller
81+
7982
Events are published from a Controller using an [EventRecorder]`type CorrelatorOptions struct`,
8083
which can be created for a Controller by calling `GetRecorder(name string)` on a Manager. See that we will change the implementation scaffolded in `cmd/main.go`:
84+
8185
```go
8286
if err = (&controller.MyKindReconciler{
8387
Client: mgr.GetClient(),
@@ -89,15 +93,18 @@ which can be created for a Controller by calling `GetRecorder(name string)` on a
8993
os.Exit(1)
9094
}
9195
```
96+
9297
### Granting the required permissions
9398

9499
You must also grant the RBAC rules permissions to allow your project to create Events. Therefore, ensure that you add the [RBAC][rbac-markers] into your controller:
100+
95101
```go
96102
...
97103
//+kubebuilder:rbac:groups=core,resources=events,verbs=create;patch
98104
...
99105
func (r *MyKindReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
100106
```
107+
101108
And then, run `$ make manifests` to update the rules under `config/rbac/rule.yaml`.
102109
103110
[Events]: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#events

docs/book/src/reference/watching-resources/operator-managed.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ Managing dependency resources is fundamental to a controller, and it's not possi
1010
- ReplicaSets must know when their Pods are deleted, or change from healthy to unhealthy.
1111

1212
Through the `Owns()` functionality, Controller Runtime provides an easy way to watch dependency resources for changes.
13+
A resource can be defined as dependent on another resource through the 'ownerReferences' field.
1314

1415
As an example, we are going to create a `SimpleDeployment` resource.
1516
The `SimpleDeployment`'s purpose is to manage a `Deployment` that users can change certain aspects of, through the `SimpleDeployment` Spec.
16-
The `SimpleDeployment` controller's purpose is to make sure that it's owned `Deployment` always uses the settings provided by the user.
17+
The `SimpleDeployment` controller's purpose is to make sure that it's owned `Deployment` (has an ownerReference which points to `SimpleDeployment` resource) always uses the settings provided by the user.
1718

1819
### Provide basic templating in the `Spec`
1920

0 commit comments

Comments
 (0)