kubebuilder: etcd should not be assumed to be in /usr/local/kubebuilder/bin/etcd
I installed the Kubebuilder binaries in a personal folder:
/usr/local/home/cflewis/bin/kubebuilder/etcd
Kubebuilder assumes that etcd is in /usr/local/kubebuilder/bin/etcd
$ make test
go generate ./pkg/... ./cmd/...
go fmt ./pkg/... ./cmd/...
go vet ./pkg/... ./cmd/...
go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go all
CRD manifests generated under '/usr/local/home/cflewis/src/go/src/github.com/cflewis/kubebuilder-demo/config/crds'
RBAC manifests generated under '/usr/local/home/cflewis/src/go/src/github.com/cflewis/kubebuilder-demo/config/rbac'
go test ./pkg/... ./cmd/... -coverprofile cover.out
? github.com/cflewis/kubebuilder-demo/pkg/apis [no test files]
? github.com/cflewis/kubebuilder-demo/pkg/apis/ships [no test files]
2018/07/20 14:11:56 fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
FAIL github.com/cflewis/kubebuilder-demo/pkg/apis/ships/v1beta1 0.199s
? github.com/cflewis/kubebuilder-demo/pkg/controller [no test files]
2018/07/20 14:11:56 fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
FAIL github.com/cflewis/kubebuilder-demo/pkg/controller/sloop 0.186s
? github.com/cflewis/kubebuilder-demo/cmd/manager [no test files]
Makefile:9: recipe for target 'test' failed
make: *** [test] Error 1
My grepping found this:
./vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go: defaultEtcdBin = "/usr/local/kubebuilder/bin/etcd"
As long as etcd is in the user’s path, things should work. Is there a reason a full path was hardcoded?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 12
- Comments: 15 (4 by maintainers)
Commits related to this issue
- Move kubebuilder to /usr/local due to https://github.com/kubernetes-sigs/kubebuilder/issues/326 — committed to mhausenblas/katacoda-scenarios by sttts 6 years ago
- add custom shim for kubebuilder allows setting of KUBEBUILDER_ASSETS environment variable so kubebuilder can find the binary assets https://github.com/kubernetes-sigs/kubebuilder/issues/326#issuecomm... — committed to virtualstaticvoid/asdf-kubebuilder by virtualstaticvoid 4 years ago
kubebuilder needs to be unzipped or linked to default directory which is ‘/usr/local/kubebuilder’ as instructed in document. Kubebuilder uses binaries from it
I saw the same error when I ran
make testin the workspace created using kubebuiler due to missing/usr/local/kubebuilder/bin/etcdfile on the host:The following steps resolved the error for me and then
make testworked fine:Please consider adding the information to
in the kubebuilder book.
You can also set the KUBEBUILDER_ASSETS environment variable, for posterity
We can use setup-envtest tool to download which version of assets we need and use like below:
export KUBEBUILDER_ASSETS=<path of kubebuilder/bin>
probably remove the “space” on the both sides of the equal sign will be better
With this commit https://github.com/kubernetes-sigs/controller-runtime/commit/c5e5439a4953c1a2cab7975cab74cedc0dde3da2 (which is included at least in 1.0.5) we can use the envvar
KUBEBUILDER_ASSETSto pass the bin-directory explicitly.Worked for me with the getting-started example (Except for struggling because of #359).
Yes, I also find this rather very surprising.
That sounds okay to me, shall we close?
On Fri, 19 Oct 2018, 2:36 pm Christoph Glaubitz, notifications@github.com wrote: