Skip to content

Upgrading from v0.16.5 -> v0.17.0 causes controller-gen crd generator to panic #1123

Closed
@kate-osborn

Description

@kate-osborn

We are getting the following panic after upgrading from 0.16.5 to 0.17.0 when running the crd generator:

go run sigs.k8s.io/controller-tools/cmd/[email protected] crd object paths=./apis/... output:crd:artifacts:config=config/crd/bases
go: downloading sigs.k8s.io/controller-tools v0.17.0
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(0xc000fd3aa0, 0xc0005f26e0)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:299 +0x3eb
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc000fd3aa0, {0xec6900, 0xc0005f26e0})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:220 +0xd9
sigs.k8s.io/controller-tools/pkg/crd.structToSchema(0xc000a5d568, 0xc000714120)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:477 +0x872
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc000a5d568, {0xec68d0, 0xc000714120})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:230 +0x93
sigs.k8s.io/controller-tools/pkg/crd.infoToSchema(0xc000a5d568)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:139 +0x165
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedSchemaFor(0xc000[55](https://github.com/nginx/nginx-gateway-fabric/actions/runs/12660268000/job/35281123021?pr=2962#step:8:56)e0c0, {0xc0004070a0, {0xc000410810, 0x14}})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:193 +0x290
sigs.k8s.io/controller-tools/pkg/crd.(*schemaContext).requestSchema(0xc00030cf30?, {0x0?, 0xd73825?}, {0xc000410810?, 0x0?})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:108 +0xdb
sigs.k8s.io/controller-tools/pkg/crd.localNamedToSchema(0xc000a5d9a0, 0xc000706320)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:305 +0x4ae
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc000a5d9a0, {0xec6900, 0xc000706320})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:220 +0xd9
sigs.k8s.io/controller-tools/pkg/crd.arrayToSchema(0xc000fd3a10, 0xc0007112c0)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:343 +0x10a
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc000fd3a10, {0xec6960, 0xc0007112c0})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:224 +0x51
sigs.k8s.io/controller-tools/pkg/crd.structToSchema(0xc000a5de[58](https://github.com/nginx/nginx-gateway-fabric/actions/runs/12660268000/job/35281123021?pr=2962#step:8:59), 0xc000714480)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:477 +0x872
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc000a5de58, {0xec68d0, 0xc000714480})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:230 +0x93
sigs.k8s.io/controller-tools/pkg/crd.infoToSchema(0xc000a5de58)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:139 +0x165
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedSchemaFor(0xc00055e0c0, {0xc0004070a0, {0xc0003[60](https://github.com/nginx/nginx-gateway-fabric/actions/runs/12660268000/job/35281123021?pr=2962#step:8:61)8f0, 0xc}})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:193 +0x290
sigs.k8s.io/controller-tools/pkg/crd.(*schemaContext).requestSchema(0xc000fd3950?, {0xc00030cf30?, 0xd73825?}, {0xc0003608f0?, 0xc?})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:108 +0xdb
sigs.k8s.io/controller-tools/pkg/crd.namedToSchema(0xc000fd3950, 0xc000012858)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:322 +0x234
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc000fd3950, {0xec6930, 0xc000012858})
/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:222 +0xf6
sigs.k8s.io/controller-tools/pkg/crd.structToSchema(0xc000a5e650, 0xc000012870)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:477 +0x872
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc000a5e650, {0xec68d0, 0xc000012870})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:230 +0x[93](https://github.com/nginx/nginx-gateway-fabric/actions/runs/12660268000/job/35281123021?pr=2962#step:8:94)
sigs.k8s.io/controller-tools/pkg/crd.infoToSchema(0xc000a5e650)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:139 +0x165
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedSchemaFor(0xc00055e0c0, {0xc000407080, {0xc0004f2018, 0x14}})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:193 +0x290
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedFlattenedSchemaFor(0xc00055e0c0, {0xc000407080, {0xc0004f2018, 0x14}})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:205 +0xcd
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedCRDFor(0xc00055e0c0, {{0xc00003e3ce, 0x11}, {0xc0004f2018, 0x14}}, 0x0)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/spec.go:93 +0x57a
sigs.k8s.io/controller-tools/pkg/crd.Generator.Generate({0x0, 0x0, 0x0, {0x0, 0x0, 0x0}, 0x0, {0x0, 0x0}, {0x0, ...}, ...}, ...)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/gen.go:182 +0x566
sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc0001823f0)
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:272 +0x234
main.main.func1(0xc0001f4200?, {0xc00024e280?, 0x4?, 0xd7193d?})
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x6a
github.com/spf13/cobra.(*Command).execute(0xc000204c08, {0xc000036060, 0x4, 0x4})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:[98](https://github.com/nginx/nginx-gateway-fabric/actions/runs/12660268000/job/35281123021?pr=2962#step:8:99)5 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000204c08)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
main.main()
	/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x2f6
exit status 2

Link to failed workflow: https://github.com/nginx/nginx-gateway-fabric/actions/runs/12660268000/job/35281123021?pr=2962

We are running the following command:

go run sigs.k8s.io/controller-tools/cmd/[email protected] crd object paths=./apis/... output:crd:artifacts:config=config/crd/bases

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions