Skip to content

Segfault when adding api #2049

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
lulf opened this issue Oct 11, 2019 · 5 comments
Closed

Segfault when adding api #2049

lulf opened this issue Oct 11, 2019 · 5 comments
Assignees
Labels
triage/support Indicates an issue that is a support question.

Comments

@lulf
Copy link

lulf commented Oct 11, 2019

Bug Report

What did you do?
Followed the quickstart guide with latest operator-sdk release. Got the the point of generating an api.

What did you expect to see?
That api was generated

What did you see instead? Under which circumstances?

Segfault.

[lulf@pteppic lulf]$ mkdir -p $HOME/projects/example-inc/

[lulf@pteppic lulf]$ cd $HOME/projects/example-inc/

[lulf@pteppic example-inc]$ export GO111MODULE=on

[lulf@pteppic example-inc]$ operator-sdk new app-operator --repo github.com/example-inc/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 v0.10.x
INFO[0003] Project validation successful.
INFO[0003] Project creation complete.

[lulf@pteppic example-inc]$ cd app-operator

[lulf@pteppic app-operator]$ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
INFO[0000] Generating api version app.example.com/v1alpha1 for kind AppService.
INFO[0000] Created pkg/apis/app/group.go
INFO[0000] Created pkg/apis/app/v1alpha1/appservice_types.go
INFO[0000] Created pkg/apis/addtoscheme_app_v1alpha1.go
INFO[0000] Created pkg/apis/app/v1alpha1/register.go
INFO[0000] Created pkg/apis/app/v1alpha1/doc.go
INFO[0000] Created deploy/crds/app_v1alpha1_appservice_cr.yaml
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xce8dc5]

goroutine 1 [running]:
k8s.io/gengo/parser.(*Builder).AddDirRecursive(0xc0002aa870, 0xc00041b920, 0x2c, 0x2, 0x2)
        pkg/mod/k8s.io/[email protected]/parser/parse.go:229 +0xb5
sigs.k8s.io/controller-tools/pkg/crd/generator.(*Generator).Do(0xc000641760, 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(0xc0000f58c0, 0x2114520, 0x341bfc0, 0x7f428a4b3620, 0xc0000f58c0, 0x1)
        /Users/haseeb/work/module-projects/operator-sdk/internal/pkg/scaffold/crd.go:102 +0x27e
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).doRender(0xc000641cf8, 0xc00041b860, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000551b00, 0x23, ...)
        /Users/haseeb/work/module-projects/operator-sdk/internal/pkg/scaffold/scaffold.go:222 +0x16c
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).doFile(0xc000641cf8, 0x209a2c0, 0xc0000f58c0, 0x0, 0x0)
        /Users/haseeb/work/module-projects/operator-sdk/internal/pkg/scaffold/scaffold.go:192 +0x230
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).Execute(0xc000641cf8, 0xc00078bc68, 0xc000641c98, 0x6, 0x6, 0x0, 0x0)
        /Users/haseeb/work/module-projects/operator-sdk/internal/pkg/scaffold/scaffold.go:157 +0x103
github.com/operator-framework/operator-sdk/cmd/operator-sdk/add.apiRun(0xc000364780, 0xc0002ce820, 0x0, 0x2, 0x0, 0x0)
        /Users/haseeb/work/module-projects/operator-sdk/cmd/operator-sdk/add/api.go:118 +0x542
github.com/spf13/cobra.(*Command).execute(0xc000364780, 0xc0002ce7e0, 0x2, 0x2, 0xc000364780, 0xc0002ce7e0)
        pkg/mod/github.com/spf13/[email protected]/command.go:762 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0xc000364280, 0x209d6e0, 0xc000696800, 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()
        /Users/haseeb/work/module-projects/operator-sdk/cmd/operator-sdk/main.go:85 +0x50f


Environment

  • OS: Fedora 30

  • operator-sdk version: 0.10.1

  • go version: go1.12.10 linux/amd64

Additional context
Add any other context about the problem here.

@Mengkzhaoyun
Copy link

Mengkzhaoyun commented Oct 12, 2019

Environment

  • OS: Ubuntu 18.04
  • operator-sdk version: 0.11.0
  • go version: go version go1.13.1 linux/amd64

the same problem

@fengxsong
Copy link
Contributor

Environment

  • OS: Ubuntu 18.04
  • operator-sdk version: 0.11.0
  • go version: go version go1.13.1 linux/amd64

the same problem

this answer may help.

@Mengkzhaoyun
Copy link

@fengxsong , thank you , after set GOROOT in ENV , the bug fixed.

@camilamacedo86
Copy link
Contributor

Also, note that the 1.13 is not supported yet.
You need to use 1.12+ for now.
I am closing this one since you already found the solution.

@camilamacedo86 camilamacedo86 self-assigned this Oct 12, 2019
@camilamacedo86 camilamacedo86 added the triage/support Indicates an issue that is a support question. label Oct 12, 2019
@lulf
Copy link
Author

lulf commented Oct 12, 2019

@camilamacedo86 Should the fact that GOROOT must be set, be documented somewhere (maybe user guide/getting started)?

Seems like a common problem you would run into in a clean development environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/support Indicates an issue that is a support question.
Projects
None yet
Development

No branches or pull requests

4 participants