Skip to content

Fatal deepcopy error on operator-sdk add api #2353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tomklino opened this issue Dec 27, 2019 · 2 comments
Closed

Fatal deepcopy error on operator-sdk add api #2353

tomklino opened this issue Dec 27, 2019 · 2 comments

Comments

@tomklino
Copy link

While following the getting started guide (created a memcached operator), and reaching the part of the guide that stated add a new custom-resource-definition, I issued the command operator-sdk add api --api-version=cache.example.com/v1alpha1 --kind=Memcached

Some files have changed but eventually the command failed like so:

memcached-operator (master) $ operator-sdk add api --api-version=cache.example.com/v1alpha1 --kind=Memcached
INFO[0000] Generating api version cache.example.com/v1alpha1 for kind Memcached. 
INFO[0000] Created pkg/apis/cache/group.go              
INFO[0000] Created pkg/apis/cache/v1alpha1/memcached_types.go 
INFO[0000] Created pkg/apis/addtoscheme_cache_v1alpha1.go 
INFO[0000] Created pkg/apis/cache/v1alpha1/register.go  
INFO[0000] Created pkg/apis/cache/v1alpha1/doc.go       
INFO[0000] Created deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml 
INFO[0000] Created deploy/crds/cache.example.com_memcacheds_crd.yaml 
INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [cache:[v1alpha1], ] 
F1227 15:01:21.313323    2077 deepcopy.go:885] Hit an unsupported type invalid type for invalid type, from ./pkg/apis/cache/v1alpha1.Memcached

I'm not sure if I did something wrong but I followed the tutorial to the letter and tried recreating the project from scratch just in case, but ran into the same issue. Additionally, I could not find any similar case while googling the error

Versions:

$ operator-sdk version
operator-sdk version: "v0.13.0", commit: "1af9c95bb51420c55a7f7f2b7fabebda24451276", go version: "go1.13.3 linux/amd64"

$ go version
go version go1.13.5 linux/amd64

$ git version
git version 2.17.1
@tomklino
Copy link
Author

Okay, so about 60 seconds after posting this, a very helpful person on the kubernetes slack pointed me to this issue.

tl;dr: the environment variable GOROOT should have been set like so

export GOROOT=$(go env GOROOT)

@estroz
Copy link
Member

estroz commented Dec 28, 2019

@tomklino I assume you were able to resolve your issue using the suggested workaround. If not, feel free to re-open this issue.

@estroz estroz closed this as completed Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants