Skip to content
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

Error: failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v3": exit status 2 #2

Closed
drew0ps opened this issue Jun 9, 2022 · 4 comments

Comments

@drew0ps
Copy link

drew0ps commented Jun 9, 2022

Hello,

We find the operator builder really useful, although I have issues running the ref implementation.

FYI - I am running this on WSL2
cat /etc/release
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

operator-builder version
0.6.0

go version
go version go1.18.3 linux/amd64

Heres the sequence of events:

go mod init github.com/ahuffman/guestbook-app-ref-implementation-for-operator-builder
go: creating new go.mod: module github.com/ahuffman/guestbook-app-ref-implementation-for-operator-builder
operator-builder init \
    --workload-config .source/workload.yaml \
    --skip-go-version-check
Writing kustomize manifests for you to edit...
Writing scaffold for you to edit...
Get controller runtime:
$ go get sigs.k8s.io/controller-runtime@v0.7.2
2022/06/09 12:43:28 Adding workload scaffolding...
Update dependencies:
$ go mod tidy
Next: define a resource with:
$ operator-builder create api
 operator-builder create api --workload-config .source-manifests/workload.yaml
Create Resource [y/n]
y
Create Controller [y/n]
y
Writing kustomize manifests for you to edit...
Writing scaffold for you to edit...
apis/apps/v1/guestbook_types.go
controllers/apps/guestbook_controller.go
2022/06/09 14:14:18 Building API...
Update dependencies:
$ go mod tidy
Running make:
$ make generate
go: creating new go.mod: module tmp
Downloading sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1
go: added github.com/fatih/color v1.7.0
go: added github.com/gobuffalo/flect v0.2.0
go: added github.com/gogo/protobuf v1.3.1
go: added github.com/google/gofuzz v1.1.0
go: added github.com/inconshreveable/mousetrap v1.0.0
go: added github.com/json-iterator/go v1.1.8
go: added github.com/mattn/go-colorable v0.1.2
go: added github.com/mattn/go-isatty v0.0.8
go: added github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: added github.com/modern-go/reflect2 v1.0.1
go: added github.com/spf13/cobra v1.0.0
go: added github.com/spf13/pflag v1.0.5
go: added golang.org/x/mod v0.2.0
go: added golang.org/x/net v0.0.0-20200226121028-0de0cce0169b
go: added golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7
go: added golang.org/x/text v0.3.2
go: added golang.org/x/tools v0.0.0-20200616195046-dc31b401abb5
go: added golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: added gopkg.in/inf.v0 v0.9.1
go: added gopkg.in/yaml.v2 v2.2.8
go: added gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966
go: added k8s.io/api v0.18.2
go: added k8s.io/apiextensions-apiserver v0.18.2
go: added k8s.io/apimachinery v0.18.2
go: added k8s.io/klog v1.0.0
go: added k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89
go: added sigs.k8s.io/controller-tools v0.4.1
go: added sigs.k8s.io/structured-merge-diff/v3 v3.0.0
go: added sigs.k8s.io/yaml v1.2.0
/home/developer/codebase/guestbook-app-ref-implementation-for-operator-builder/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
bash: /home/developer/codebase/guestbook-app-ref-implementation-for-operator-builder/bin/controller-gen: No such file or directory
make: *** [Makefile:44: generate] Error 127
Error: failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v3": exit status 2
Usage:
  operator-builder create api [flags]

Examples:
  # Add API attributes defined by a workload config file
  operator-builder create api --workload-config .source-manifests/workload.yaml


Flags:
      --controller               if set, generate the controller without prompting the user (default true)
      --crd-version string       version of CustomResourceDefinition to scaffold. Options: [v1, v1beta1] (default "v1")
      --force                    attempt to create resource even if it already exists
      --group string             resource Group
  -h, --help                     help for api
      --kind string              resource Kind
      --make make generate       if true, run make generate after generating files (default true)
      --namespaced               resource is namespaced (default true)
      --plural string            resource irregular plural form
      --resource                 if set, generate the resource without prompting the user (default true)
      --version string           resource Version
      --workload-config string   path to workload config file

Global Flags:
      --plugins strings   plugin keys to be used for this subcommand execution

FATA[0004] failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v3": exit status 2

Any ideas why this might be?

@ahuffman
Copy link
Collaborator

ahuffman commented Jun 9, 2022

@lander2k2 @scottd018. I'm able to reproduce this error on v0.6.0. Can you take a look at what might be missing from the readme?

@scottd018
Copy link

@ahuffman was able to produce with go1.18.3 (works with 1.17.9). @lander2k2 and I already had 1.18 on the roadmap, but we aren't quite there yet. let me see if i can find a quick workaround for you in the meantime

@scottd018
Copy link

@ahuffman @martonadam47 You can try this again using the latest update in main branch of operator-builder (simply clone and use make build to create a binary artifact from the cloned repo at bin/operator-builder). We went ahead and updated to Go version 1.18 across most projects in the stack and I was able to get this issue fixed by doing so.

See issue nukleros/operator-builder#39 for more info.

Also note that operator-builder moved to a new location at https://github.com/nukleros/operator-builder . Let me know if you have issues! :)

@ahuffman
Copy link
Collaborator

@martonadam47 I validated this is fixed with the current code in https://github.com/nukleros/operator-builder. I also went ahead and updated the docs.

Thanks for reporting this to us!

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

3 participants