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?
+1
Assumes etcd exists in ${PATH} is better.
kubebuilder needs to be unzipped or linked to default directory which is ‘/usr/local/kubebuilder’ as instructed in document. Kubebuilder uses binaries from it
This is definitely not ideal. Why should the installation directory matter.
Yes, I also find this rather very surprising.
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_ASSETS to pass the bin-directory explicitly.
export KUBEBUILDER_ASSETS=~/sdk/kubebuilder_1.0.5_linux_amd64/bin/
Worked for me with the getting-started example (Except for struggling because of #359).
That sounds okay to me, shall we close?
On Fri, 19 Oct 2018, 2:36 pm Christoph Glaubitz, notifications@github.com
wrote:
With this commit kubernetes-sigs/controller-runtime@c5e5439
https://github.com/kubernetes-sigs/controller-runtime/commit/c5e5439a4953c1a2cab7975cab74cedc0dde3da2
(which is included at least in 1.0.5) we can use the envvar
KUBEBUILDER_ASSETS to pass the bin-directory explicitly.export KUBEBUILDER_ASSETS=~/sdk/kubebuilder_1.0.5_linux_amd64/bin/
Worked for me with the getting-started example (Except for struggling
because of #359
https://github.com/kubernetes-sigs/kubebuilder/issues/359).—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes-sigs/kubebuilder/issues/326#issuecomment-431365391,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPWS6QC5weX16_2ZzmfFz5NysSXGYmIks5umdVVgaJpZM4VZR0S
.
Please consider adding the information to
export KUBEBUILDER_ASSETS = <path of kubebuilder/bin>
in the kubebuilder book.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
I saw the same error when I ran make test in the workspace created using kubebuiler due to missing /usr/local/kubebuilder/bin/etcd file on the host:
go test ./api/... ./controllers/... -coverprofile cover.out
...
2019-05-22T16:25:21.837Z ERROR controller-runtime.test-env unable to start the controlplane {"tries": 0, "error": "fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory"}
The following steps resolved the error for me and then make test worked fine:
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.0.0-alpha.1/kubebuilder_2.0.0-alpha.1_linux_amd64.tar.gz
tar -zxvf kubebuilder_2.0.0-alpha.1_linux_amd64.tar.gz
sudo mv kubebuilder_2.0.0-alpha.1_linux_amd64 /usr/local/kubebuilder
$ find /usr/local/kubebuilder
/usr/local/kubebuilder
/usr/local/kubebuilder/bin
/usr/local/kubebuilder/bin/etcd
/usr/local/kubebuilder/bin/kube-apiserver
/usr/local/kubebuilder/bin/kubebuilder
/usr/local/kubebuilder/bin/kubectl
workspace_directory$ make test
go fmt ./...
go vet ./...
go test ./api/... ./controllers/... -coverprofile cover.out
ok redacted/api/v1alpha1 7.420s coverage: 2.4% of statements
ok redacted/controllers 5.816s coverage: 0.0% of statements
You can also set the KUBEBUILDER_ASSETS environment variable, for posterity
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
@fejta-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue with/reopen.
Mark the issue as fresh with/remove-lifecycle rotten.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Most helpful comment
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: