'failed to create API with "go.kubebuilder.io/v3"

koko@henqiangmafanrangyirang operator % operator-sdk create api --group prom.my.domain --version v1beta1 --kind Prom
Create Resource [y/n]
y
Create Controller [y/n]
y
Error: failed to create API with "go.kubebuilder.io/v3": multiple groups are not allowed by default, to enable multi-group visit https://kubebuilder.io/migration/multi-group.html
----------
koko@henqiangmafanrangyirang operator % operator-sdk create api --group batch --version v1 --kind Prom
Create Resource [y/n]
y
Create Controller [y/n]
y
Error: failed to create API with "go.kubebuilder.io/v3": multiple groups are not allowed by default, to enable multi-group visit https://kubebuilder.io/migration/multi-group.html
------
koko@henqiangmafanrangyirang ~ % operator-sdk version
operator-sdk version: "v1.5.0", commit: "98f30d59ade2d911a7a8c76f0169a7de0dec37a0", kubernetes version: "1.19.4", go version: "go1.15.5", GOOS: "darwin", GOARCH: "amd64"

Why failed to create? Although it tells me that I cannot customize, I still failed to use the group【batch】 of k8s, What should I do



Solution 1:[1]

The error message seemed clear to me, and suggested this doc, which is correct. https://kubebuilder.io/migration/multi-group.html

If the error wasnt clear to you, could you file an issue with kubebuilder? (golang operators using operator-sdk use kubebuilder under the hood)

Solution 2:[2]

I think you are trying for the same group, and not a different group.

Try the below command

operator-sdk create api --group prom --version v1beta1 --kind Prom

I just removed ".my.domain" from your command, This should work, Thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 asmacdo
Solution 2 M. Gopal