operator-sdk: Operator-SDK add api error
$ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
INFO[0000] Generating api version app.example.com/v1alpha1 for kind AppService.
INFO[0000] Created pkg/apis/app/group.go
INFO[0000] Created pkg/apis/app/v1alpha1/appservice_types.go
INFO[0000] Created pkg/apis/addtoscheme_app_v1alpha1.go
INFO[0000] Created pkg/apis/app/v1alpha1/register.go
INFO[0000] Created pkg/apis/app/v1alpha1/doc.go
INFO[0000] Created deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml
INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [app:[v1alpha1], ]
F0203 10:54:29.486117 5946 deepcopy.go:885] Hit an unsupported type invalid type for invalid type, from app-operator/pkg/apis/app/v1alpha1.AppService
By @camilamacedo86 : Add info to centralized:
operator-sdk version:v0.15.1 go version:go1.13 linux/amd64 I’m writing operator in go Operate System:Centos7.2
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (10 by maintainers)
I’m not able to reproduce this either. We’ve seen issues with the code generators because they can sometimes rely on some Go environment variables being set, which are not usually necessary to set in normal Go installations (see https://github.com/operator-framework/operator-sdk/issues/2426)
Can you run the following command and retry:
That actually worked! Thanks!
Hi @jmccormick2001,
It is caused because of an error in your local env. You need to set the go env GOROOT. Run
export GOROOT=$(go env GOROOT)
See:
The GOROOT environment variable point to the directory where the go which should be used is installed. In this way, I understand that usually, you don’t need to set $GOROOT variable. However, you may face issues in some scenarios. For example; if you have more than one go version installed locally, or if you installed it in different locally from where was recommend or if you use homebrew to install. Just to illustrate the homebrew scenario see, for example, https://coderwall.com/p/c00m1g/set-goroot-variable-with-homebre
Duplication of many:
I can replicate this issue on Ubuntu 18.04 very easily. The only solution I found is setting the GOROOT as described here.
@joelanford I think I’ve got some additional information on this one that might be useful: this issue only appears on some of the linux (at least) binaries on the releases page, but not all. It seems like it might depend on the environment of the developer who built the binary.
For example, if I don’t have
GOROOT
set in my shell (even though it shows up ingo env GOROOT
) like you demonstrated above, I experience the issue with the following versions (not a complete list):Notably, v0.15.0 doesn’t give me this behaviour, it just works. Maybe @jmccormick2001 has some magic?
Also, if I build the broken versions locally myself, they don’t have the issue that the binaries on the GitHub releases page have.