简体   繁体   中英

operator-sdk: getting error - Hit an unsupported type invalid type for invalid type

I'm trying to create go operator with operator-sdk, and do next steps:

  • operator-sdk new --repo=github.com/myrepo/myoperator myoperator
  • cd myoperator
  • operator-sdk add api --kind=MyOperator --api-version=app.example.com/v1alpha1 --skip-generation
  • operator-sdk generate k8s

On last step I get the error:

INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [app:[v1alpha1], ]
F0410 09:39:08.770751    1722 deepcopy.go:885] Hit an unsupported type invalid type for invalid type, from ./pkg/apis/app/v1alpha1.MyOperator

I think that I've missed something, but can't find out what exactly... Could somebody tell me what's wrong?

Thank you

I've found the root cause - GOROOT variable should be set and point to root of go installation

In my case GOROOT was set correctly, but operator-sdk depended on it being exported as a env var.

export GOROOT=$(go env GOROOT) was the solution for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM