Skip to content

Commit 6d59caf

Browse files
authored
Merge pull request #2562 from mariuskimmina/plugins-doc
📖 Add documentation for declarative plugin
2 parents d517c07 + e5ac4f0 commit 6d59caf

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

docs/book/src/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105

106106
- [Extending the CLI](./plugins/extending-cli.md)
107107
- [Creating your own plugins](./plugins/creating-plugins.md)
108+
- [Available Plugins](./plugins/available-plugins.md)
109+
- [Declarative V1](./plugins/declarative-v1.md)
108110

109111
---
110112
[Appendix: The TODO Landing Page](./TODO.md)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Available Plugins
2+
3+
This section details how to use the currently available plugins in Kubebuilder.
4+
5+
- [Declarative V1](declarative-v1.md)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Declarative Plugin
2+
3+
The declarative plugin allows you to create [controllers][controller-runtime] using the [kubebuilder-declarative-pattern][kubebuilder-declarative-pattern].
4+
By using the declarative plugin, you can make the required changes on top of what is scaffolded by default when you create a Go project with Kubebuilder and the Golang plugins (i.e. go/v2, go/v3).
5+
6+
<aside class="note">
7+
<h1>Examples</h1>
8+
9+
You can check samples using this plugin by looking at the "addon" samples inside the [testdata][testdata] directory of the Kubebuilder project.
10+
11+
</aside>
12+
13+
14+
## When to use it
15+
16+
- If you are looking to scaffold one or more [controllers][controller-runtime] following [the pattern][kubebuilder-declarative-pattern] ( See an e.g. of the reconcile method implemented [here][addon-v3-controller])
17+
- If you want to have manifests shipped inside your Manager container. The declarative plugin works with channels, which allow you to push manifests. [More info][addon-channels-info]
18+
19+
## How to use it
20+
21+
The declarative plugin requires to be used with one of the available Golang plugins
22+
If you want that any API(s) and its respective controller(s) generate to reconcile them of your project adopt this partner then:
23+
24+
```sh
25+
kubebuilder init --plugins=go/v3,declarative/v1 --domain example.org --repo example.org/guestbook-operator
26+
```
27+
28+
If you want to adopt this pattern for specific API(s) and its respective controller(s) (not for any API/controller scaffold using Kubebuilder CLI) then:
29+
30+
```sh
31+
kubebuilder create api --plugins=go/v3,declarative/v1 --version v1 --kind Guestbook
32+
```
33+
34+
## Subcommands
35+
36+
The declarative plugin implements the following subcommands:
37+
38+
* init (`$ kubebuilder init [OPTIONS]`)
39+
* create api (`$ kubebuilder create api [OPTIONS]`)
40+
41+
## Affected files
42+
43+
The following scaffolds will be created or updated by this plugin:
44+
45+
* `controllers/*_controller.go`
46+
* `api/*_types.go`
47+
* `channels/packages/<packagename>/<version>/manifest.yaml`
48+
* `channels/stable`
49+
* `Dockerfile`
50+
51+
## Further ressources
52+
53+
* Read more about the [declarative pattern][kubebuilder-declarative-pattern]
54+
* Watch the KubeCon 2018 Video [Managing Addons with Operators][kubecon-video]
55+
* Check the [plugin implementation][plugin-implementation]
56+
57+
[dockerfile-addon]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v3-addon/Dockerfile#L16-L19
58+
[addon-channels-info]: https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/blob/master/docs/addon/walkthrough/README.md#adding-a-manifest
59+
[controller-runtime]: https://github.com/kubernetes-sigs/controller-runtime
60+
[kubebuilder-declarative-pattern]: https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern
61+
[testdata]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata/
62+
[kubecon-video]: https://www.youtube.com/watch?v=LPejvfBR5_w
63+
[plugin-implementation]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/pkg/plugins/golang/declarative
64+
[addon-v3-controller]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata/project-v3-addon

0 commit comments

Comments
 (0)