|
| 1 | +# go/v4-alpha (go.kubebuilder.io/v4-alpha) |
| 2 | + |
| 3 | +Kubebuilder will scaffold using the go/v4-alpha plugin only if specified when initializing the project. |
| 4 | +This plugin is a composition of the plugins ` kustomize.common.kubebuilder.io/v2-alpha` and `base.go.kubebuilder.io/v3`. |
| 5 | +It scaffolds a project template that helps in constructing sets of [controllers][controller-runtime]. |
| 6 | + |
| 7 | +It scaffolds boilerplate code to create and design controllers. |
| 8 | +Note that by following the [quickstart][quickstart] you will be using this plugin. |
| 9 | +<aside class="note"> |
| 10 | + |
| 11 | +<h1>Examples</h1> |
| 12 | + |
| 13 | +You can check samples using this plugin by looking at the `project-v4-<options>` projects |
| 14 | +under the [testdata][testdata] directory on the root directory of the Kubebuilder project. |
| 15 | + |
| 16 | +</aside> |
| 17 | + |
| 18 | +## When to use it ? |
| 19 | + |
| 20 | +- If you are looking to scaffold Golang projects to develop projects using [controllers][controller-runtime] |
| 21 | +- If you are looking to experiment with the future default scaffold that will be provided by Kubebuilder CLI |
| 22 | +- If your local environment is Apple Silicon (`darwin/arm64`) |
| 23 | +- If you are looking to use [kubernetes-sigs/kustomize][kustomize] v4 |
| 24 | + |
| 25 | +## How to use it ? |
| 26 | + |
| 27 | +To create a new project with the `go/v4-alpha` plugin the following command can be used: |
| 28 | + |
| 29 | +```sh |
| 30 | +kubebuilder init --domain tutorial.kubebuilder.io --repo tutorial.kubebuilder.io/project --plugins=go/v4-alpha |
| 31 | +``` |
| 32 | + |
| 33 | +## Subcommands supported by the plugin |
| 34 | + |
| 35 | +- Init - `kubebuilder init [OPTIONS]` |
| 36 | +- Edit - `kubebuilder edit [OPTIONS]` |
| 37 | +- Create API - `kubebuilder create api [OPTIONS]` |
| 38 | +- Create Webhook - `kubebuilder create webhook [OPTIONS]` |
| 39 | + |
| 40 | +## Further resources |
| 41 | + |
| 42 | +- To see the composition of plugins, you can check the source code for the Kubebuilder [main.go][plugins-main]. |
| 43 | +- Check the code implementation of the [base Golang plugin `base.go.kubebuilder.io/v3`][v3-plugin]. |
| 44 | +- Check the code implementation of the [Kustomize/v2-alpha plugin][kustomize-plugin]. |
| 45 | +- Check [controller-runtime][controller-runtime] to know more about controllers. |
| 46 | + |
| 47 | +[controller-runtime]: https://github.com/kubernetes-sigs/controller-runtime |
| 48 | +[quickstart]: ../quick-start.md |
| 49 | +[testdata]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata |
| 50 | +[plugins-main]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/cmd/main.go |
| 51 | +[kustomize-plugin]: ../plugins/kustomize-v2-alpha.md |
| 52 | +[kustomize]: https://github.com/kubernetes-sigs/kustomize |
0 commit comments