-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
quickstart does not work #6681
Comments
downgrade Go to 1.21 works for me |
Downgrade to Go 1.21 Works for me as well, on all platforms. Go 1.22 is stable. This could be:
Potential fixes could include:
Does anyone have the skills and availability to spearhead this? |
After fighting with this for a couple of days, I came across this thread. I can confirm the same issue with go 1.22 on both a Mac M1 (ARM64) and on Linux amd64. Downgrading to 1.21 on both systems resolved the problem. |
Would be nice to have official operator-sdk Docker image updated, so that it would have Go 1.21 compiler in it and binary compiled with the same version. Had to manually rebuild image with version change in here https://github.com/operator-framework/operator-sdk/blob/master/images/operator-sdk/Dockerfile#L22. Having a working Docker image can at least be considered a quick workaround without needing to downgrade the local Golang runtime version. |
This could probably be useful. If you think you have strong use-case support, you should consider opening a ticket for it. |
Looks like might be related to kubernetes-sigs/controller-tools#851 ? Edit: On go1.22 and controller-tools@v0.12.1 the issue is present (running go test ./...), while running tests on latest release does not fail. |
For clarity, does that rule out kubernetes-sigs/controller-tools#851 as the culprit? |
@richard-fairthorne other way around. The panic is caused by the version of controller-tools currently used in operator-sdk. Updating it probably should fix the issue. |
Upgrading go from 1.21.1 to 1.21.7 works for me |
For MAC darwin/arm64 users following will work:
go version go1.21.7 darwin/arm64
operator-sdk init --domain example.com --repo <your_repo_url>
operator-sdk create api --group cache --version v1alpha1 --kind Memcached --resource --controller
make generate |
This error appears connected to the controller-gen binary. A similar panic was documented in an issue on the controller-tools repo:
kubernetes-sigs/controller-tools#888 The fix involves updating the CONTROLLER_TOOLS_VERSION in your Makefile from v0.13.0 to v0.14.0. This will rebuild a working controller-gen binary even with the latest Go version (v1.22.1). Ensure you |
We discussed this and we need to bump several dependencies in several places in our end to fix this. We'll be targeting this for our next release. Until then, our recommendation is to stick to go 1.21. |
|
Yes with controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1033ec604]
goroutine 117 [running]:
go/types.(*Checker).handleBailout(0x1400062e200, 0x14000861d18)
/usr/local/go/src/go/types/check.go:367 +0x9c
panic({0x1036c5a60?, 0x103c5caf0?})
/usr/local/go/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x103790990, 0x103c65300})
/usr/local/go/src/go/types/sizes.go:228 +0x314
go/types.(*Config).sizeof(...)
/usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x103790990?, 0x103c65300?})
/usr/local/go/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x103796c30, 0x103c30240}, 0x1400062e200, 0x103c65300, 0x0)
/usr/local/go/src/go/types/const.go:92 +0x138
go/types.(*Checker).arrayLength(0x1400062e200, {0x103794f78, 0x14000e243a0?})
/usr/local/go/src/go/types/typexpr.go:510 +0x238
go/types.(*Checker).typInternal(0x1400062e200, {0x103793598, 0x14000c45980}, 0x0)
/usr/local/go/src/go/types/typexpr.go:299 +0x3bc
go/types.(*Checker).definedType(0x1400062e200, {0x103793598, 0x14000c45980}, 0x102e64bac?)
/usr/local/go/src/go/types/typexpr.go:180 +0x2c
go/types.(*Checker).varType(0x1400062e200, {0x103793598, 0x14000c45980})
/usr/local/go/src/go/types/typexpr.go:145 +0x2c
go/types.(*Checker).structType(0x1400062e200, 0x140012ca090, 0x140012ca090?)
/usr/local/go/src/go/types/struct.go:113 +0x128
go/types.(*Checker).typInternal(0x1400062e200, {0x103793508, 0x140010e5860}, 0x14001232410)
/usr/local/go/src/go/types/typexpr.go:316 +0xed0
go/types.(*Checker).definedType(0x1400062e200, {0x103793508, 0x140010e5860}, 0x103500528?)
/usr/local/go/src/go/types/typexpr.go:180 +0x2c
go/types.(*Checker).typeDecl(0x1400062e200, 0x14001232410, 0x14000c42940, 0x0)
/usr/local/go/src/go/types/decl.go:615 +0x39c
go/types.(*Checker).objDecl(0x1400062e200, {0x10379bb40, 0x14001232410}, 0x0)
/usr/local/go/src/go/types/decl.go:197 +0x880
go/types.(*Checker).packageObjects(0x1400062e200)
/usr/local/go/src/go/types/resolver.go:681 +0x3c0
go/types.(*Checker).checkFiles(0x1400062e200, {0x14000ea8738, 0x3, 0x3})
/usr/local/go/src/go/types/check.go:408 +0x164
go/types.(*Checker).Files(...)
/usr/local/go/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0x140002713b0, 0x140001f6e80)
/Users/alejandrojnm/Project/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:286 +0x2d8
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0x140001f6e80)
/Users/alejandrojnm/Project/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:99 +0x44
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0x140007c0570, 0x140001f6e80)
/Users/alejandrojnm/Project/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:268 +0x304
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x22?)
/Users/alejandrojnm/Project/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:262 +0x58
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 103
/Users/alejandrojnm/Project/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:260 +0x230
make: *** [generate] Error 2
Error: failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v4": exit status 2 |
I'm having this problem with go1.21.9 $ go version
go version go1.21.9 darwin/arm64 |
i have the below go version and it works fine when I UPDATED THE CONTROLLER-GEN VERSION in the Makefile to >=0.14.0 |
Work for me. Thanks @harshitsinghvi22 |
|
This worked for me, |
Bug Report
What did you do?
I followed the quickstart documentation found at https://v1-33-x.sdk.operatorframework.io/docs/building-operators/golang/quickstart/
What did you expect to see?
It's a quickstart. I expected to see an operator-sdk project start, quickly, preferably, without error.
What did you see instead? Under which circumstances?
I saw segfaults and puppy tears. Here is the output:
Environment
Operator type:
/language go
Kubernetes cluster type:
Didn't get far enough to talk to a cluster, but minikube was running.
$ operator-sdk version
operator-sdk version: "v1.33.0", commit: "542966812906456a8d67cf7284fc6410b104e118", kubernetes version: "1.27.0", go version: "go1.21.5", GOOS: "linux", GOARCH: "amd64"
$ go version
(if language is Go)go version go1.22.0 linux/amd64
$ kubectl version
Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Possible Solution
Additional context
These logs are from amd64 hardware. The exact same thing happens on apple silicon, docker desktop on apple silicon, and docker desktop amd64-rosetta on Apple silicon.
The text was updated successfully, but these errors were encountered: