What did you do?
operator-sdk new submariner-operator
cd submariner-operator/
operator-sdk add api --api-version=submariner.io/v1alpha1 --kind=Submariner
What did you expect to see?
Working add api
What did you see instead? Under which circumstances?
F1203 10:14:34.573020 3109 deepcopy.go:885] Hit an unsupported type invalid type for invalid type, from github.com/submariner-io/submariner-operator/pkg/apis/submariner/v1alpha1.Submariner
goroutine 1 [running]:
k8s.io/klog.stacks(0xc000d13e00, 0xc000a0f0e0, 0xc1, 0x111)
/home/joe/go/pkg/mod/k8s.io/[email protected]/klog.go:855 +0xb8
k8s.io/klog.(*loggingT).output(0x335c940, 0xc000000003, 0xc000270c40, 0x3146640, 0xb, 0x375, 0x0)
/home/joe/go/pkg/mod/k8s.io/[email protected]/klog.go:806 +0x351
k8s.io/klog.(*loggingT).printf(0x335c940, 0x3, 0x1ee9b04, 0x2a, 0xc001154d18, 0x3, 0x3)
/home/joe/go/pkg/mod/k8s.io/[email protected]/klog.go:705 +0x14b
k8s.io/klog.Fatalf(...)
/home/joe/go/pkg/mod/k8s.io/[email protected]/klog.go:1256
k8s.io/gengo/examples/deepcopy-gen/generators.(*genDeepCopy).doStruct(0xc000cb0800, 0xc0000ebef0, 0xc00074e6e0)
/home/joe/go/pkg/mod/k8s.io/[email protected]/examples/deepcopy-gen/generators/deepcopy.go:885 +0x7bd
k8s.io/gengo/examples/deepcopy-gen/generators.(*genDeepCopy).generateFor(0xc000cb0800, 0xc0000ebef0, 0xc00074e6e0)
/home/joe/go/pkg/mod/k8s.io/[email protected]/examples/deepcopy-gen/generators/deepcopy.go:695 +0xc5
k8s.io/gengo/examples/deepcopy-gen/generators.(*genDeepCopy).GenerateType(0xc000cb0800, 0xc0002709a0, 0xc0000ebef0, 0x21b7320, 0xc000e9ffa0, 0x0, 0x1eb9e33)
/home/joe/go/pkg/mod/k8s.io/[email protected]/examples/deepcopy-gen/generators/deepcopy.go:608 +0xe98
k8s.io/gengo/generator.(*Context).executeBody(0xc0002709a0, 0x21b42a0, 0xc000934750, 0x222f9c0, 0xc000cb0800, 0x60, 0xc0011550c8)
Environment
# operator-sdk version
operator-sdk version: "v0.12.0", commit: "2445fcda834ca4b7cf0d6c38fba6317fb219b469", go version: "go1.13.3 linux/amd64"
# go version
go version go1.13.4 linux/amd64
and same result with:
[root@00ed05ef611d submariner-operator]# go version
go version go1.12.13 linux/amd64
More hints on the issue:
# operator-sdk generate openapi
INFO[0000] Running OpenAPI code-generation for Custom Resource group versions: [submariner:[v1alpha1], ]
E1203 12:01:56.439922 272 openapi.go:304] Error when generating: TypeMeta, TypeMeta invalid type
Error: openapi-gen generator error: Failed executing generator: some packages had errors:
cannot generate spec for type invalid type
Hi @mangelajo,
The go version compatible with SDK 0.12 is the 1.13+.
Are you with the project created inside of $GOPATH? Also, what is the path of the project?
It shows the same scenario of https://github.com/operator-framework/operator-sdk/issues/1854#issuecomment-525132306.
See that you need to be in the $GOPATH and the dir paths need to match with the project. E.g for https://github.com/operator-framework/operator-sdk/ the dir path needs to be $GOPATH /github.com/operator-framework/operator-sdk/
If the above information do not help you sort it out, could you share your code/project?
Thank you Camila!
I tested with go 1.13+ too, I updated the bug report,
It's not on $GOPATH since we are using GO111MODULES in the project, let me
test
irc: ajo / mangelajo
Miguel Angel Ajo Pelayo
+34 636 52 25 69
skype: ajoajoajo
On Tue, Dec 3, 2019 at 1:05 PM Camila Macedo notifications@github.com
wrote:
Hi @mangelajo https://github.com/mangelajo,
The go version compatible with SDK 0.12 is the 1.13+.
Are you with the project created inside of $GOPATH? Also, what is the path
of the project?
It shows the same scenario of #1854 (comment)
https://github.com/operator-framework/operator-sdk/issues/1854#issuecomment-525132306
.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/operator-framework/operator-sdk/issues/2288?email_source=notifications&email_token=AAI7G4TD7QMGFPTQDAH543DQWZDSFA5CNFSM4JUVQW42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFZEXKA#issuecomment-561138600,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAI7G4VAS23RZNPO7FVBNUTQWZDSFANCNFSM4JUVQW4Q
.
HI @mangelajo,
Note that go do not work well with more than one version installed. So, ensure that you have locally just the 1.13+.
[root@68d43dc05cf5 submariner-operator]# echo $GOPATH
/go
[root@68d43dc05cf5 submariner-operator]# pwd
/go/src/github.com/submariner-io/submariner-operator
[root@68d43dc05cf5 submariner-operator]# echo $GOROOT
[root@68d43dc05cf5 submariner-operator]# export GOROOT=$GOPATH
[root@68d43dc05cf5 submariner-operator]# operator-sdk generate k8s
INFO[0000] Running deepcopy code-generation for Custom Resource group
versions: [submariner:[v1alpha1], ]
INFO[0000] Code-generation complete.
This was the issue, as soon as GOROOT is set it will work.
I think we may detect this condition from operator-sdk and warn the user
irc: ajo / mangelajo
Miguel Angel Ajo Pelayo
+34 636 52 25 69
skype: ajoajoajo
On Tue, Dec 3, 2019 at 1:42 PM Camila Macedo notifications@github.com
wrote:
HI @mangelajo https://github.com/mangelajo,
Note that go do not work well with more than one version installed. So,
ensure that you have locally just the 1.13+.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/operator-framework/operator-sdk/issues/2288?email_source=notifications&email_token=AAI7G4W2WSIH5FC276IDDO3QWZH5DA5CNFSM4JUVQW42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFZHVGY#issuecomment-561150619,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAI7G4XA7SPZZX3J444XQ33QWZH5DANCNFSM4JUVQW4Q
.
Sorry, GOROOT must be /usr/lib/golang in my case.
It has to point to the golang installation, otherwise operator-sdk generate
openapi won't work.
irc: ajo / mangelajo
Miguel Angel Ajo Pelayo
+34 636 52 25 69
skype: ajoajoajo
On Tue, Dec 3, 2019 at 1:56 PM Miguel Angel miguelangel@ajo.es wrote:
[root@68d43dc05cf5 submariner-operator]# echo $GOPATH
/go
[root@68d43dc05cf5 submariner-operator]# pwd
/go/src/github.com/submariner-io/submariner-operator
[root@68d43dc05cf5 submariner-operator]# echo $GOROOT[root@68d43dc05cf5 submariner-operator]# export GOROOT=$GOPATH
[root@68d43dc05cf5 submariner-operator]# operator-sdk generate k8s
INFO[0000] Running deepcopy code-generation for Custom Resource group
versions: [submariner:[v1alpha1], ]
INFO[0000] Code-generation complete.This was the issue, as soon as GOROOT is set it will work.
I think we may detect this condition from operator-sdk and warn the user
about it. What do you think ?
irc: ajo / mangelajo
Miguel Angel Ajo Pelayo
+34 636 52 25 69
skype: ajoajoajoOn Tue, Dec 3, 2019 at 1:42 PM Camila Macedo notifications@github.com
wrote:HI @mangelajo https://github.com/mangelajo,
Note that go do not work well with more than one version installed. So,
ensure that you have locally just the 1.13+.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/operator-framework/operator-sdk/issues/2288?email_source=notifications&email_token=AAI7G4W2WSIH5FC276IDDO3QWZH5DA5CNFSM4JUVQW42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFZHVGY#issuecomment-561150619,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAI7G4XA7SPZZX3J444XQ33QWZH5DANCNFSM4JUVQW4Q
.
Hi @mangelajo,
I am not sure if I understood. Could you fix the local env with the info informed and see it worked or not?
Hi @mangelajo,
I cloned your project locally to check it. See that I am running inside of the GOPATH and with the same path/dir of your project and all worked fine.
camilamacedo@Camilas-MacBook-Pro ~/go/src/github.com $ mkdir submariner-io
camilamacedo@Camilas-MacBook-Pro ~/go/src/github.com $ cd submariner-io/
camilamacedo@Camilas-MacBook-Pro ~/go/src/github.com/submariner-io $ git clone [email protected]:submariner-io/submariner-operator.git
Cloning into 'submariner-operator'...
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 616 (delta 13), reused 18 (delta 7), pack-reused 574
Receiving objects: 100% (616/616), 220.91 KiB | 1.10 MiB/s, done.
Resolving deltas: 100% (302/302), done.
camilamacedo@Camilas-MacBook-Pro ~/go/src/github.com/submariner-io $ cd submariner-operator/
camilamacedo@Camilas-MacBook-Pro ~/go/src/github.com/submariner-io/submariner-operator (master) $ operator-sdk generate k8s
INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [submariner:[v1alpha1], ]
INFO[0014] Code-generation complete.
camilamacedo@Camilas-MacBook-Pro ~/go/src/github.com/submariner-io/submariner-operator (master) $ operator-sdk generate openapi
INFO[0000] Running OpenAPI code-generation for Custom Resource group versions: [submariner:[v1alpha1], ]
INFO[0007] Created deploy/crds/submariner.io_submariners_crd.yaml
INFO[0007] Code-generation complete.
camilamacedo@Camilas-MacBook-Pro ~/go/src/github.com/submariner-io/submariner-operator
(master) $ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/camilamacedo/Library/Caches/go-build"
GOENV="/Users/camilamacedo/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/camilamacedo/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/camilamacedo/go/src/github.com/submariner-io/submariner-operator/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/r_/ym6yn3cd0q3fm5jcgcwvj4z00000gn/T/go-build134513003=/tmp/go-build -gno-record-gcc-switches -fno-common"
camilamacedo@Camilas-MacBook-Pro ~/go/src/github.com/submariner-io/submariner-operator (master) $
Please, let us know if you are ok to close this one or has anything else that you are expecting here.
Let me close this one.
I want to open a new one for better "no GOROOT" handling in some situations where the error message is left to the underlying generators and is very obscure.
I am still hitting this exact issue:
$ pwd
/home/mbooth/go/src/github.com/openstack-k8s-operators
$ operator-sdk new foo --verbose
DEBU[0000] Debug logging is set
INFO[0000] Creating new Go operator 'foo'.
INFO[0000] Created go.mod
INFO[0000] Created tools.go
INFO[0000] Created cmd/manager/main.go
INFO[0000] Created build/Dockerfile
INFO[0000] Created build/bin/entrypoint
INFO[0000] Created build/bin/user_setup
INFO[0000] Created deploy/service_account.yaml
INFO[0000] Created deploy/role.yaml
INFO[0000] Created deploy/role_binding.yaml
INFO[0000] Created deploy/operator.yaml
INFO[0000] Created pkg/apis/apis.go
INFO[0000] Created pkg/controller/controller.go
INFO[0000] Created version/version.go
INFO[0000] Created .gitignore
INFO[0000] Validating project
DEBU[0000] Running []string{"go", "build", "./..."}
INFO[0002] Project validation successful.
INFO[0002] Project creation complete.
$ cd foo
$ operator-sdk add api --api-version=foo.example.com/v1alpha1 --kind=Foo --verbose
DEBU[0000] Debug logging is set
INFO[0000] Generating api version foo.example.com/v1alpha1 for kind Foo.
INFO[0000] Created pkg/apis/foo/group.go
INFO[0000] Created pkg/apis/foo/v1alpha1/foo_types.go
INFO[0000] Created pkg/apis/addtoscheme_foo_v1alpha1.go
INFO[0000] Created pkg/apis/foo/v1alpha1/register.go
INFO[0000] Created pkg/apis/foo/v1alpha1/doc.go
INFO[0000] Created deploy/crds/foo.example.com_v1alpha1_foo_cr.yaml
DEBU[0000] Setting GOROOT=/usr/lib/golang
INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [foo:[v1alpha1], ]
F0506 12:04:45.607871 10761 deepcopy.go:885] Hit an unsupported type invalid type for invalid type, from github.com/openstack-k8s-operators/foo/pkg/apis/foo/v1alpha1.Foo
My environment:
$ go version
go version go1.13.10 linux/amd64
$ operator-sdk version
operator-sdk version: "v0.17.0", commit: "2fd7019f856cdb6f6618e2c3c80d15c3c79d1b6c", kubernetes version: "unknown", go version: "go1.13.10 linux/amd64"
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mbooth/.cache/go-build"
GOENV="/home/mbooth/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mbooth/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build274026007=/tmp/go-build -gno-record-gcc-switches"
Most helpful comment
[root@68d43dc05cf5 submariner-operator]# echo $GOPATH
/go
[root@68d43dc05cf5 submariner-operator]# pwd
/go/src/github.com/submariner-io/submariner-operator
[root@68d43dc05cf5 submariner-operator]# echo $GOROOT
[root@68d43dc05cf5 submariner-operator]# export GOROOT=$GOPATH
[root@68d43dc05cf5 submariner-operator]# operator-sdk generate k8s
INFO[0000] Running deepcopy code-generation for Custom Resource group
versions: [submariner:[v1alpha1], ]
INFO[0000] Code-generation complete.
This was the issue, as soon as GOROOT is set it will work.
I think we may detect this condition from operator-sdk and warn the user
about it. What do you think ?
irc: ajo / mangelajo
Miguel Angel Ajo Pelayo
+34 636 52 25 69
skype: ajoajoajo
On Tue, Dec 3, 2019 at 1:42 PM Camila Macedo notifications@github.com
wrote: