-
Notifications
You must be signed in to change notification settings - Fork 429
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
Upgrading from v0.16.5 -> v0.17.0 causes controller-gen crd generator to panic #1123
Comments
What is your go-version? |
@camilamacedo86 I am running into the same issue and my Go version is |
I can see
So, could you give an example of how we can reproduce the scenario? PS. We updated the version of controller-gen in Kubebuilder, and we did not find any issues in the tests and samples, which leads us to think that it is related to a specific use case bug or problems with your solution itself. Therefore, having the steps to reproduce the scenario would be nice. |
@camilamacedo86 our go version is 1.23.0. We are running controller-gen on the types in this folder: https://github.com/nginx/nginx-gateway-fabric/tree/main/apis/v1alpha1 |
@camilamacedo86 We hit this issue when running the $ go version
go version go1.23.4 darwin/arm64
$ go run sigs.k8s.io/controller-tools/cmd/[email protected] paths=./pkg/api/... \
paths=./controllers/... \
paths=./manager/... \
crd:crdVersions=v1 \
rbac:roleName=manager-role \
output:crd:dir=./config/crd/bases \
output:webhook:dir=./config/webhook \
webhook
panic: interface conversion: *types.Struct is not interface { Obj() *types.TypeName }: missing method Obj
goroutine 1 [running]:
sigs.k8s.io/controller-tools/pkg/crd.localNamedToSchema(0x14005c4d8f8, 0x1400145aa00)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:299 +0x37c
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0x14005c4d8f8, {0x1013c9558, 0x1400145aa00})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:220 +0xd0
sigs.k8s.io/controller-tools/pkg/crd.arrayToSchema(0x14005150bd0, 0x14001451d40)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:343 +0x11c
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0x14005150bd0, {0x1013c95b8, 0x14001451d40})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:224 +0x58
sigs.k8s.io/controller-tools/pkg/crd.structToSchema(0x14005c4ddb8, 0x14001458a20)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:477 +0x7d8
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0x14005c4ddb8, {0x1013c9528, 0x14001458a20})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:230 +0x90
sigs.k8s.io/controller-tools/pkg/crd.infoToSchema(0x14005c4ddb8)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:139 +0x150
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedSchemaFor(0x14000102900, {0x140009923c0, {0x1400037f6d0, 0xd}})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:193 +0x1e8
sigs.k8s.io/controller-tools/pkg/crd.(*schemaContext).requestSchema(0x140004ec060?, {0x0?, 0x1010f1524?}, {0x1400037f6d0?, 0x0?})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:108 +0xd8
sigs.k8s.io/controller-tools/pkg/crd.localNamedToSchema(0x14005150900, 0x14001689280)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:305 +0x42c
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0x14005150900, {0x1013c9558, 0x14001689280})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:220 +0xd0
sigs.k8s.io/controller-tools/pkg/crd.structToSchema(0x14005c4e5f8, 0x14001692300)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:477 +0x7d8
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0x14005c4e5f8, {0x1013c9528, 0x14001692300})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:230 +0x90
sigs.k8s.io/controller-tools/pkg/crd.infoToSchema(0x14005c4e5f8)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:139 +0x150
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedSchemaFor(0x14000102900, {0x140009923c0, {0x140006d5dd0, 0x7}})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:193 +0x1e8
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedFlattenedSchemaFor(0x14000102900, {0x140009923c0, {0x140006d5dd0, 0x7}})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:205 +0x9c
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedCRDFor(0x14000102900, {{0x14000f5e1be, 0x1a}, {0x140006d5dd0, 0x7}}, 0x0)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/spec.go:93 +0x3d8
sigs.k8s.io/controller-tools/pkg/crd.Generator.Generate({0x0, 0x0, 0x0, {0x14000190050, 0x1, 0x1}, 0x0, {0x0, 0x0}, {0x0, ...}, ...}, ...)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/gen.go:182 +0x464
sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0x140011a9320)
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:272 +0x21c
main.main.func1(0x140002d8200?, {0x140000b3380?, 0x4?, 0x1010ef714?})
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x64
github.com/spf13/cobra.(*Command).execute(0x14000032f08, {0x140001b6010, 0x8, 0x8})
/Users/arnchlm/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x14000032f08)
/Users/arnchlm/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
/Users/arnchlm/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
main.main()
/Users/arnchlm/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x290
exit status 2 |
@kate-osborn @abhay-krishna This seems to be either the same or similar as #1088 which was fixed just now in #1122. Can you please check if controller-gen including #1122 works for you? |
@sbueringer Yes indeed, including that commit worked! 🚀 Thank you very much! Will wait for it to be included in a new release to avoid the pseudo-versioning.
|
Perfect, thx for the quick feedback! I'll wait a bit so @kate-osborn has a chance to try it out and then cut a release soon'ish (in a few days) |
Sounds good, thank you very much! On another note, we are upgrading controller-gen from v0.8.0 to v0.16.5 (a huge bump I know!) and we saw that the generated RBAC role YAML had a large diff with a lot of removals, I wanted to make sure if this is intended behavior. Also CRD struct fields which were previously (i.e. have always been) marked as required (example) with Do you have any insights into this? |
This is intended. We did multiple iterations of implementing deduplications for RBAC (if you diff the RBAC you'll see that it's only deduplicated)
This PR implemented support for the |
@sbueringer #1122 works for me, too! Thanks for the quick response. |
@sbueringer Thanks for clarifiying! Looking closer, I did see that they were only being deduplicated by being incorporated into existing lists so avoiding the need for separate sections, which then got removed. Awesome optimizations! Also thanks for the reference to the |
Yes they are |
Just released v0.17.1. Thx for reporting the issue and thx to @mtardy for fixing it! :) /close |
@sbueringer: Closing this issue. 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. |
We are getting the following panic after upgrading from 0.16.5 to 0.17.0 when running the crd generator:
Link to failed workflow: https://github.com/nginx/nginx-gateway-fabric/actions/runs/12660268000/job/35281123021?pr=2962
We are running the following command:
The text was updated successfully, but these errors were encountered: