Kubebuilder will scaffold using the
go/v4-alpha plugin only if specified when initializing the project.
This plugin is a composition of the plugins
It scaffolds a project template that helps in constructing sets of controllers.
It scaffolds boilerplate code to create and design controllers. Note that by following the quickstart you will be using this plugin.
When to use it ?
- If you are looking to scaffold Golang projects to develop projects using controllers
- If you are looking to experiment with the future default scaffold that will be provided by Kubebuilder CLI
- If your local environment is Apple Silicon (
- If you are looking to use kubernetes-sigs/kustomize v4
- If you are looking to have your project update with the latest version available
- if you are not targeting k8s versions <
1.20if you are using webhooks
- If you are looking to work on with scaffolds which are compatible with k8s
- If you are looking for the new layout following the Standard Go Project Layout where
the “api(s)” are scaffold under the
apidirectory, “controller(s)” under
internal, and the
How to use it ?
To create a new project with the
go/v4-alpha plugin the following command can be used:
kubebuilder init --domain tutorial.kubebuilder.io --repo tutorial.kubebuilder.io/project --plugins=go/v4-alpha
Subcommands supported by the plugin
- Init -
kubebuilder init [OPTIONS]
- Edit -
kubebuilder edit [OPTIONS]
- Create API -
kubebuilder create api [OPTIONS]
- Create Webhook -
kubebuilder create webhook [OPTIONS]
- To see the composition of plugins, you can check the source code for the Kubebuilder main.go.
- Check the code implementation of the [base Golang plugin
- Check the code implementation of the Kustomize/v2-alpha plugin.
- Check controller-runtime to know more about controllers.