-
Notifications
You must be signed in to change notification settings - Fork 425
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
Panic parsing resources not directly imported #1063
Comments
Please check if the panic also occurs with the published controller-gen binaries from here: https://github.com/kubernetes-sigs/controller-tools/releases/tag/v0.16.3 (compiled with Go 1.22). Trying to figure out if this is just another occurence of: #1053 |
Hi @sbueringer I have tested it, and this issue still occurs in version 0.16.3 ➜ ./bin/controller-gen --version
Version: v0.16.3
➜ ./bin/controller-gen rbac:roleName=manager-role crd webhook paths="./api/...;./controllers/..." output:crd:artifacts:config=config/crd/bases
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd18e792]
goroutine 1 [running]:
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedPackage(0xc000e8c000, 0x0)
/Users/huyantian/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:237 +0x52
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedSchemaFor(0xc000e8c000, {0x0, {0xc0015fe660, 0x1e}})
/Users/huyantian/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:170 +0x5a
sigs.k8s.io/controller-tools/pkg/crd.(*schemaContext).requestSchema(0xc004da4480?, {0xc00086eb40?, 0xd2758f5?}, {0xc0015fe660?, 0x1e?})
/Users/huyantian/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:108 +0xdb
sigs.k8s.io/controller-tools/pkg/crd.namedToSchema(0xc004da4480, 0xc000fd54d0) |
Thx for checking! Then we'll need someone to investigate this /help |
@sbueringer: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Here is some help
So I took a look since you mentioned that and it seems unrelated. It's not something that was broken by upgrading the Go version, and I tried to run the reproducer on older versions and the bug seems to be there as it produces a panic. I took a look at it since it could have been as trivial to fix as my bug, but it seems more complicated and I think I lack context and would need to spend more time on this to understand. The panic is happening here: controller-tools/pkg/crd/parser.go Line 237 in f79cfef
Because in this case
And this is nil because in controller-tools/pkg/crd/schema.go Lines 103 to 112 in f79cfef
You have pkgPath being Now I don't really know how you parse and populate this imports part, I ended up in some So I guess maybe you can give me pointers or someone that has more knowledge over this can write a patch themselves! |
Thx for taking a look and sharing your results. Unfortunately, I also don't know more (have been helping maintaining CT for a while now, but unfortunately I always have to research from almost scratch to figure out what's going on :)) |
Minimal repro:
Create the needed directories
mkdir repro1 repro2 repro3
and put the files insideThen run controller-gen with:
The result should be the following:
If you uncomment the anonymous import in the
repro1
directory, the generation succeeds.The text was updated successfully, but these errors were encountered: