Skip to content

'add api' panics due to null pointer #1853

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

Closed
jpkrohling opened this issue Aug 22, 2019 · 3 comments
Closed

'add api' panics due to null pointer #1853

jpkrohling opened this issue Aug 22, 2019 · 3 comments

Comments

@jpkrohling
Copy link

Bug Report

Running a simple add api command panics due to a null pointer.

What did you do?

$ GO111MODULE=on operator-sdk new app-operator 
INFO[0000] Creating new Go operator 'app-operator'.     
INFO[0000] Created go.mod                               
INFO[0000] Created tools.go                             
INFO[0000] Created cmd/manager/main.go                  
INFO[0000] Created build/Dockerfile                     
INFO[0000] Created build/bin/entrypoint                 
INFO[0000] Created build/bin/user_setup                 
INFO[0000] Created deploy/service_account.yaml          
INFO[0000] Created deploy/role.yaml                     
INFO[0000] Created deploy/role_binding.yaml             
INFO[0000] Created deploy/operator.yaml                 
INFO[0000] Created pkg/apis/apis.go                     
INFO[0000] Created pkg/controller/controller.go         
INFO[0000] Created version/version.go                   
INFO[0000] Created .gitignore                           
INFO[0000] Validating project                           
go: finding github.com/operator-framework/operator-sdk master
INFO[0004] Project validation successful.               
INFO[0004] Project creation complete.                   
$ cd app-operator/
$ GO111MODULE=on operator-sdk add api --api-version=jaegertracing.io/v1 --kind=Jaeger
INFO[0000] Generating api version jaegertracing.io/v1 for kind Jaeger. 
INFO[0000] Created pkg/apis/jaegertracing/group.go      
INFO[0001] Created pkg/apis/jaegertracing/v1/jaeger_types.go 
INFO[0002] Created pkg/apis/addtoscheme_jaegertracing_v1.go 
INFO[0002] Created pkg/apis/jaegertracing/v1/register.go 
INFO[0002] Created pkg/apis/jaegertracing/v1/doc.go     
INFO[0002] Created deploy/crds/jaegertracing_v1_jaeger_cr.yaml 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xce8d55]

goroutine 1 [running]:
k8s.io/gengo/parser.(*Builder).AddDirRecursive(0xc0020ea230, 0xc001082990, 0x2b, 0x2, 0x2)
	pkg/mod/k8s.io/[email protected]/parser/parse.go:229 +0xb5
sigs.k8s.io/controller-tools/pkg/crd/generator.(*Generator).Do(0xc001707760, 0x0, 0x0)
	pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/generator/generator.go:126 +0x3ac
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*CRD).CustomRender(0xc0005866e0, 0x2114500, 0x341bfc0, 0x7ffb9db12f00, 0xc0005866e0, 0x1)
	src/github.com/operator-framework/operator-sdk/internal/pkg/scaffold/crd.go:102 +0x27e
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).doRender(0xc001707cf8, 0xc0010828d0, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000058b40, 0x22, ...)
	src/github.com/operator-framework/operator-sdk/internal/pkg/scaffold/scaffold.go:222 +0x16c
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).doFile(0xc001707cf8, 0x209a2a0, 0xc0005866e0, 0x0, 0x0)
	src/github.com/operator-framework/operator-sdk/internal/pkg/scaffold/scaffold.go:192 +0x230
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).Execute(0xc001707cf8, 0xc0006d9c68, 0xc001707c98, 0x6, 0x6, 0x0, 0x0)
	src/github.com/operator-framework/operator-sdk/internal/pkg/scaffold/scaffold.go:157 +0x103
github.com/operator-framework/operator-sdk/cmd/operator-sdk/add.apiRun(0xc000556280, 0xc0003d6e20, 0x0, 0x2, 0x0, 0x0)
	src/github.com/operator-framework/operator-sdk/cmd/operator-sdk/add/api.go:118 +0x542
github.com/spf13/cobra.(*Command).execute(0xc000556280, 0xc0003d6da0, 0x2, 0x2, 0xc000556280, 0xc0003d6da0)
	pkg/mod/github.com/spf13/[email protected]/command.go:762 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0xc000389680, 0x209d6c0, 0xc0003dc800, 0x0)
	pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ec
github.com/spf13/cobra.(*Command).Execute(...)
	pkg/mod/github.com/spf13/[email protected]/command.go:800
main.main()
	src/github.com/operator-framework/operator-sdk/cmd/operator-sdk/main.go:85 +0x50f

Environment

  • operator-sdk version: operator-sdk version: v0.10.0, commit: ff80b17737a6a0aade663e4827e8af3ab5a21170
  • go version: go version go1.12.5 linux/amd64

Found while working on jaegertracing/jaeger-operator#607

@joelanford
Copy link
Member

@jpkrohling Thanks for reporting this. We've had several similar reports. I re-opened #1759 yesterday because there definitely seems to be something going on. I'm going to close this as a duplicate so everyone can follow the progress in #1759.

@jpkrohling
Copy link
Author

Just to close the loop, this seems to be fixed in the latest master (abac23c)

@jpkrohling
Copy link
Author

For the record, the same solution from #1854 applies here:

$ export GOROOT=/usr/lib/golang
$ GO111MODULE=on operator-sdk add api --api-version=jaegertracing.io/v1 --kind=Jaeger
INFO[0000] Generating api version jaegertracing.io/v1 for kind Jaeger. 
INFO[0000] Created pkg/apis/jaegertracing/group.go      
INFO[0003] Created pkg/apis/jaegertracing/v1/jaeger_types.go 
INFO[0003] Created pkg/apis/addtoscheme_jaegertracing_v1.go 
INFO[0003] Created pkg/apis/jaegertracing/v1/register.go 
INFO[0003] Created pkg/apis/jaegertracing/v1/doc.go     
INFO[0003] Created deploy/crds/jaegertracing_v1_jaeger_cr.yaml 
INFO[0007] Created deploy/crds/jaegertracing_v1_jaeger_crd.yaml 
INFO[0007] Running deepcopy code-generation for Custom Resource group versions: [jaegertracing:[v1], ] 
INFO[0010] Code-generation complete.                    
INFO[0010] Running OpenAPI code-generation for Custom Resource group versions: [jaegertracing:[v1], ] 
INFO[0017] Created deploy/crds/jaegertracing_v1_jaeger_crd.yaml 
INFO[0017] Code-generation complete.                    
INFO[0017] API generation complete.                     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants