cass-operator icon indicating copy to clipboard operation
cass-operator copied to clipboard

How to add new CRDs

Open vitorguidi opened this issue 1 year ago • 3 comments

I want to play around with this project and experiment with vertical autoscaling. Having said that, I looked through the makefile and did not find a way to add a new API.

As this project is bootstraped with kubebuilder, I attempted to run the following command, and got a bad result:

` vitor@Pato:~/projects/cass-operator$ kubebuilder create api --group cassandra.datastax.com --version v1beta1 --kind cassandradatacenterautoscaler Error: no plugin could be resolved with key "go.kubebuilder.io/v4-alpha" for project version "3" (plugin version is unstable, there may be an upgrade available: https://kubebuilder.io/migration/plugin/plugins.html) Usage: kubebuilder [flags]

Examples: The first step is to initialize your project: kubebuilder init [--plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]]

<PLUGIN KEYS> is a comma-separated list of plugin keys from the following table and <PROJECT VERSION> a supported project version for these plugins.

                         Plugin keys | Supported project versions

-----------------------------------------+---------------------------- base.go.kubebuilder.io/v3 | 3 base.go.kubebuilder.io/v4 | 3 declarative.go.kubebuilder.io/v1 | 2, 3 deploy-image.go.kubebuilder.io/v1-alpha | 3 go.kubebuilder.io/v2 | 2, 3 go.kubebuilder.io/v3 | 3 go.kubebuilder.io/v4 | 3 grafana.kubebuilder.io/v1-alpha | 3 kustomize.common.kubebuilder.io/v1 | 3 kustomize.common.kubebuilder.io/v2 | 3

For more specific help for the init command of a certain plugins and project version configuration please run: kubebuilder init --help --plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]

Default plugin keys: "go.kubebuilder.io/v4" Default project version: "3"

Flags: -h, --help help for kubebuilder --plugins strings plugin keys to be used for this subcommand execution --project-version string project version (default "3")

FATA no plugin could be resolved with key "go.kubebuilder.io/v4-alpha" for project version "3" (plugin version is unstable, there may be an upgrade available: https://kubebuilder.io/migration/plugin/plugins.html) `

What is the correct/expected way to go about creating new APIs/CRDs/controllers?

vitorguidi avatar Jan 11 '24 01:01 vitorguidi

You can fix that issue by modifying the PROJECT file and moving from v4-alpha -> v4. After that, kubebuilder / operator-sdk should work.

burmanm avatar Jan 11 '24 08:01 burmanm

Not that kubebuilder is needed, one can also add APIs by just creating correct files and modifying the PROJECT file.

burmanm avatar Jan 11 '24 08:01 burmanm

Another way is to use operator-sdk 1.32, as the v4 thing is added in 1.33. Works as well, ended up figuring this one out before reading your reply. This did the trick: operator-sdk create api --group cassandra.datastax.com --version v1beta1 --kind CassandraDataCenterAutoscaler --resource --controller Thanks!

vitorguidi avatar Jan 15 '24 05:01 vitorguidi

Closing stale tickets, reopen if there's anything else.

burmanm avatar Jul 12 '24 16:07 burmanm