The declarative plugin allows you to create controllers using the kubebuilder-declarative-pattern. 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).
When to use it ?
- If you are looking to scaffold one or more controllers following the pattern ( See an e.g. of the reconcile method implemented here)
- 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
How to use it ?
The declarative plugin requires to be used with one of the available Golang plugins If you want that any API(s) and its respective controller(s) generate to reconcile them of your project adopt this partner then:
kubebuilder init --plugins=go/v3,declarative/v1 --domain example.org --repo example.org/guestbook-operator
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:
kubebuilder create api --plugins=go/v3,declarative/v1 --version v1 --kind Guestbook
The declarative plugin implements the following subcommands:
- init (
$ kubebuilder init [OPTIONS])
- create api (
$ kubebuilder create api [OPTIONS])
The following scaffolds will be created or updated by this plugin:
- Read more about the declarative pattern
- Watch the KubeCon 2018 Video Managing Addons with Operators
- Check the plugin implementation