|
| 1 | +# go/v3 |
| 2 | + |
| 3 | +Kubebuilder tool will scaffold the go/v3 plugin by default. This plugin is a composition of the plugins ` kustomize.common.kubebuilder.io/v1` and `base.go.kubebuilder.io/v3`. By using you can scaffold the default project which is a helper to construct sets of [controllers][controller-runtime]. |
| 4 | + |
| 5 | +It basically scaffolds all the boilerplate code required to create and design controllers. Note that by following the [quickstart][quickstart] you will be using this plugin. |
| 6 | + |
| 7 | +<aside class="note"> |
| 8 | + |
| 9 | +<h1>Examples</h1> |
| 10 | + |
| 11 | +Samples are provided under the [testdata][testdata] directory of the Kubebuilder project. You can check samples using this plugin by looking at the `project-v3-<options>` projects under the [testdata][testdata] directory on the root directory of the Kubebuilder project. |
| 12 | + |
| 13 | +</aside> |
| 14 | + |
| 15 | +## When to use it |
| 16 | + |
| 17 | +- If you are looking to scaffold Golang projects to develop projects using [controllers][controller-runtime] |
| 18 | + |
| 19 | +## How to use it ? |
| 20 | + |
| 21 | +As `go/v3` is the default plugin there is no need to explicitly mention to Kubebuilder to use this plugin. |
| 22 | + |
| 23 | +To create a new project with the `go/v3` plugin the following command can be used: |
| 24 | + |
| 25 | +```sh |
| 26 | +kubebuilder init --domain tutorial.kubebuilder.io --repo tutorial.kubebuilder.io/project |
| 27 | +``` |
| 28 | +All the other subcommands supported by the go/v3 plugin can be executed similarly. |
| 29 | + |
| 30 | +<aside class="note"> |
| 31 | + |
| 32 | +<h1>Note</h1> |
| 33 | + |
| 34 | +Also, if you need you can explicitly inform the plugin via the option provided `--plugins=go/v3`. |
| 35 | + |
| 36 | +</aside> |
| 37 | + |
| 38 | +## Subcommands supported by the plugin |
| 39 | + |
| 40 | +- Init - `kubebuilder init [OPTIONS]` |
| 41 | +- Edit - `kubebuilder edit [OPTIONS]` |
| 42 | +- Create API - `kubebuilder create api [OPTIONS]` |
| 43 | +- Create Webhook - `kubebuilder create webhook [OPTIONS]` |
| 44 | + |
| 45 | +## Further resources |
| 46 | + |
| 47 | +- To check how plugins are composited by looking at this definition in the [main.go][plugins-main]. |
| 48 | +- Check the code implementation of the [base Golang plugin `base.go.kubebuilder.io/v3`][v3-plugin]. |
| 49 | +- Check the code implementation of the [Kustomize/v1 plugin][kustomize-plugin]. |
| 50 | +- Check [controller-runtime][controller-runtime] to know more about controllers. |
| 51 | + |
| 52 | +[controller-runtime]: https://github.com/kubernetes-sigs/controller-runtime |
| 53 | +[quickstart]: ../quick-start.md |
| 54 | +[testdata]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata |
| 55 | +[plugins-main]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/cmd/main.go |
| 56 | +[v3-plugin]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/pkg/plugins/golang/v3 |
| 57 | +[kustomize-plugin]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/pkg/plugins/common/kustomize/v1 |
0 commit comments