egress-operator icon indicating copy to clipboard operation
egress-operator copied to clipboard

What is needed for "make manifests" to work

Open yangchi opened this issue 1 month ago • 1 comments

Hi,

Thank you! This is an amazing project. When I tried to run either "make run" or "make manifests" or "make docker-build", I get a nil pointer defer panic with the controller-gen command:

make manifests
+ mkdir -p bin
+ pwd
+ GOBIN=/mnt/ephemeral/repos/egress-operator/bin go install sigs.k8s.io/controller-tools/cmd/[email protected]
./bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xb02578]

goroutine 1 [running]:
sigs.k8s.io/controller-tools/pkg/crd.structToSchema(0xc0039bdd70, 0xc000f80678)
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:407 +0x98
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc0039bdd70, {0xf03ab0, 0xc000f80678})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:230 +0xfe
sigs.k8s.io/controller-tools/pkg/crd.structToSchema(0xc003983e28, 0xc000f80708)
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:477 +0x86f
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc003983e28, {0xf03ab0, 0xc000f80708})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:230 +0xfe
sigs.k8s.io/controller-tools/pkg/crd.infoToSchema(0xc003983e28)
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:139 +0x165
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedSchemaFor(0xc000134f00, {0xc000ade900, {0xc00003c0f0, 0x13}})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:193 +0x290
sigs.k8s.io/controller-tools/pkg/crd.(*schemaContext).requestSchema(0xc0003e32f0?, {0x0?, 0xdb90ea?}, {0xc00003c0f0?, 0x0?})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:108 +0xdb
sigs.k8s.io/controller-tools/pkg/crd.localNamedToSchema(0xc00499dbf0, 0xc000d12b60)
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:305 +0x4ac
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc00499dbf0, {0xf03ae0, 0xc000d12b60})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:220 +0xb9
sigs.k8s.io/controller-tools/pkg/crd.structToSchema(0xc003984650, 0xc000f80930)
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:477 +0x86f
sigs.k8s.io/controller-tools/pkg/crd.typeToSchema(0xc003984650, {0xf03ab0, 0xc000f80930})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:230 +0xfe
sigs.k8s.io/controller-tools/pkg/crd.infoToSchema(0xc003984650)
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/schema.go:139 +0x165
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedSchemaFor(0xc000134f00, {0xc000ade900, {0xc0002224c0, 0xf}})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:193 +0x290
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedFlattenedSchemaFor(0xc000134f00, {0xc000ade900, {0xc0002224c0, 0xf}})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:205 +0xcd
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedCRDFor(0xc000134f00, {{0xc0013d520e, 0x10}, {0xc0002224c0, 0xf}}, 0x0)
        /mnt/ephemeral2/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, ...}, ...}, ...)
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/gen.go:182 +0x55e
sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc0001761b0)
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:272 +0x22f
main.main.func1(0xc000050300?, {0xc000338a00?, 0x4?, 0xdb71bd?})
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x6a
github.com/spf13/cobra.(*Command).execute(0xc000036c08, {0xc000134130, 0x5, 0x5})
        /mnt/ephemeral2/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000036c08)
        /mnt/ephemeral2/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /mnt/ephemeral2/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
main.main()
        /mnt/ephemeral2/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x2f6
make: *** [Makefile:40: manifests] Error 2

I have all the pre-requisites installed. Any idea why this happens and what I may need to make the CRD generation work ? (FWIW: I also tried controller-gen 0.19.0. Same problem.)

yangchi avatar Nov 07 '25 17:11 yangchi

Declare a TopologySpreadSkews type outside of ExternalServiceSpec makes this problem go away. https://github.com/monzo/egress-operator/blob/master/api/v1/externalservice_types.go#L93-L98

yangchi avatar Nov 07 '25 17:11 yangchi