kubebuilder v2 create fail with Go 1.13

Created on 18 Sep 2019  路  5Comments  路  Source: kubernetes-sigs/kubebuilder

/kind bug

I am getting the following errors while trying to generate a new crd scaffold.

...
/usr/local/Cellar/go/1.13/libexec/src/unicode/utf8/utf8.go:521:2: missing constant value
/usr/local/Cellar/go/1.13/libexec/src/unicode/utf8/utf8.go:522:1: expected 'IDENT', found '}'
/usr/local/Cellar/go/1.13/libexec/src/unicode/utf8/utf8.go:522:3: expected ')', found 'EOF'
/usr/local/Cellar/go/1.13/libexec/src/unicode/utf8/utf8.go:522:3: expected ';', found 'EOF'
...
not all generators ran succesfully
make: *** [generate] Error 1
2019/09/18 10:49:59 error running make: exit status 2

Versions

kubebuilder version
# Version: version.Version{KubeBuilderVersion:"2.0.0", KubernetesVendor:"1.14.1", GitCommit:"b31cc5d96dbc91749eb49c2cf600bd951a46d4bd", BuildDate:"2019-08-22T23:39:53Z", GoOs:"unknown", GoArch:"unknown"}
go version
# go version go1.13 darwin/amd64

Repro steps

  1. Installed kubebuilder, kustomize per these instructions
  2. Init a new project
go mod init github.com/fred/crds
kubebuilder init --domain fred
  1. Create an API
kubebuilder create api --group webapp --version v1 --kind Guestbook

Results

kubebuilder create api fails with the following errors.

Create Resource [y/n]
y
Create Controller [y/n]
y
Writing scaffold for you to edit...
api/v1/guestbook_types.go
controllers/guestbook_controller.go
Running make...
/Users/fernand/go_wk/derailed/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths="./..."
/usr/local/Cellar/go/1.13/libexec/src/unicode/utf8/utf8.go:28:8: expected ';', found b00000000
/usr/local/Cellar/go/1.13/libexec/src/unicode/utf8/utf8.go:64:1: expected 'IDENT', found 'var'
/usr/local/Cellar/go/1.13/libexec/src/unicode/utf8/utf8.go:87:1: expected 'IDENT', found 'type'
/usr/local/Cellar/go/1.13/libexec/src/unicode/utf8/utf8.go:87:1: missing constant value
...
Error: not all generators ran succesfully
Usage:
  controller-gen [flags]

Examples:
    # Generate RBAC manifests and crds for all types under apis/,
    # outputting crds to /tmp/crds and everything else to stdout
    controller-gen rbac:roleName=<role name> crd paths=./apis/... output:crd:dir=/tmp/crds output:stdout

    # Generate deepcopy implementations for a particular file
    controller-gen deepcopy paths=./apis/v1beta1/some_types.go

    # Run all the generators for a given project
    controller-gen paths=./apis/...


Flags:
  -h, --help            help for controller-gen
  -w, --which-markers   print out all markers available with the requested generators


Options

  webhook
  output:webhook:artifacts:config=<string>[,code=<string>]
  output:webhook:dir=<string>
  output:webhook:none
  output:webhook:stdout
  rbac:roleName=<string>
  output:rbac:artifacts:config=<string>[,code=<string>]
  output:rbac:dir=<string>
  output:rbac:none
  output:rbac:stdout
  paths=<[]string>
  object[:headerFile=<string>][,year=<string>]
  output:object:artifacts:config=<string>[,code=<string>]
  output:object:dir=<string>
  output:object:none
  output:object:stdout
  crd[:trivialVersions=<bool>]
  output:crd:artifacts:config=<string>[,code=<string>]
  output:crd:dir=<string>
  output:crd:none
  output:crd:stdout
  output:artifacts:config=<string>[,code=<string>]
  output:dir=<string>
  output:none
  output:stdout

not all generators ran succesfully
make: *** [generate] Error 1
2019/09/18 10:49:59 error running make: exit status 2
kinbug

Most helpful comment

Found the problem, my bad!
Had a stale controller-gen in my GOBIN from a previous kubebuilder install.
All generation looks good now.

All 5 comments

Found the problem, my bad!
Had a stale controller-gen in my GOBIN from a previous kubebuilder install.
All generation looks good now.

Thanks, had the same problem.

so this still happened with go and kubebuilder. What did you do to fix it? I tried deleting and reinstalling things, but I'm getting the same problem @derailed?

@Skarlso , If you have controller-gen file under $GOBIN delete it and try create api again. If your $GOBIN is not set it defaults to $GOPATH/bin. Hope this helps.

Turns out I had to build the project and use that binary me self. So now it works. 馃槉

Was this page helpful?
0 / 5 - 0 ratings