Skip to content
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

Update controller-gen to v0.14.0 #410

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

TheoBrigitte
Copy link
Contributor

This PR updates controller-gen to v0.14.0 in order to get rid of a bug impeding the make manifest and make generate commands

k6-operator $ make manifests
/my/local/path/controller-gen "crd:maxDescLen=0" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
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=0x1 addr=0x0 pc=0xa0e4be]

goroutine 49 [running]:
go/types.(*Checker).handleBailout(0xc000db0600, 0xc000adbd40)
        /usr/lib/go/src/go/types/check.go:367 +0x88
panic({0xbc8860?, 0x12b48a0?})
        /usr/lib/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xdc4c18, 0x12bd060})
        /usr/lib/go/src/go/types/sizes.go:228 +0x31e
go/types.(*Config).sizeof(...)
        /usr/lib/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0xdc4c18?, 0x12bd060?})
        /usr/lib/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xdcaff0, 0x1287f90}, 0xc000db0600, 0x12bd060, 0x0)
        /usr/lib/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).arrayLength(0xc000db0600, {0xdc92a0, 0xc0001b9aa0?})
        /usr/lib/go/src/go/types/typexpr.go:510 +0x2d3
go/types.(*Checker).typInternal(0xc000db0600, {0xdc78c0, 0xc000322b40}, 0xc00032ec30)
        /usr/lib/go/src/go/types/typexpr.go:299 +0x49d
go/types.(*Checker).definedType(0xc000db0600, {0xdc78c0, 0xc000322b40}, 0x10?)
        /usr/lib/go/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).typeDecl(0xc000db0600, 0xc00032ec30, 0xc000d11640, 0x0)
        /usr/lib/go/src/go/types/decl.go:615 +0x44d
go/types.(*Checker).objDecl(0xc000db0600, {0xdd04b8, 0xc00032ec30}, 0x0)
        /usr/lib/go/src/go/types/decl.go:197 +0xa7f
go/types.(*Checker).packageObjects(0xc000db0600)
        /usr/lib/go/src/go/types/resolver.go:681 +0x425
go/types.(*Checker).checkFiles(0xc000db0600, {0xc000080f30, 0x1, 0x1})
        /usr/lib/go/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
        /usr/lib/go/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc000227440, 0xc000254080)
        /my/local/path/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:286 +0x36a
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc000254080)
        /my/local/path/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:99 +0x39
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000e390b0, 0xc000254080)
        /my/local/path/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:268 +0x2b7
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x39?)
        /my/local/path/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:262 +0x53
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 37
        /my/local/path/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:260 +0x1c5
make: *** [Makefile:91: manifests] Error 2

It also simplifies the installation process for controller-gen

@CLAassistant
Copy link

CLAassistant commented Jun 4, 2024

CLA assistant check
All committers have signed the CLA.

@yorugac
Copy link
Collaborator

yorugac commented Jun 7, 2024

Hi @TheoBrigitte, I don't think there was a report of such a bug. Can you please expand on how to repeat the bug? Does it depend on specific versions of other tooling?

@TheoBrigitte
Copy link
Contributor Author

To my understanding the tools needed are go and make

Here is my environment

$ go version
go version go1.22.0 linux/amd64
$ make --version
GNU Make 4.4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ uname -a
Linux x1 5.15.154-1-MANJARO #1 SMP PREEMPT Wed Apr 10 19:10:26 UTC 2024 x86_64 GNU/Linux

How to reproduce

$ rm $(which controller-gen)
$ make manifests
<same error as above>

@yorugac
Copy link
Collaborator

yorugac commented Jun 7, 2024

OK, thanks. It seems it happens with Golang 1.22: k6-operator is at 1.21 now.
For reference:

I'll need to look into those in detail before returning to this PR. It'd be nice if there was another workaround...
But Go 1.21 should work.

Copy link
Collaborator

@yorugac yorugac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some looking around and testing, I think it should be good to go ahead with this change. Thanks again, @TheoBrigitte!

@yorugac yorugac merged commit dd07197 into grafana:main Jul 1, 2024
6 checks passed
@yorugac yorugac added this to the 0.15 milestone Jul 1, 2024
@TheoBrigitte TheoBrigitte deleted the update-controller-gen branch July 1, 2024 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants