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

etcd should not be assumed to be in /usr/local/kubebuilder/bin/etcd #326

Closed
cflewis opened this issue Jul 20, 2018 · 15 comments
Closed

etcd should not be assumed to be in /usr/local/kubebuilder/bin/etcd #326

cflewis opened this issue Jul 20, 2018 · 15 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@cflewis
Copy link
Contributor

cflewis commented Jul 20, 2018

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?

sttts added a commit to mhausenblas/katacoda-scenarios that referenced this issue Jul 27, 2018
@interma
Copy link
Contributor

interma commented Aug 1, 2018

+1
Assumes etcd exists in ${PATH} is better.

@fanzhangio
Copy link

kubebuilder needs to be unzipped or linked to default directory which is ‘/usr/local/kubebuilder’ as instructed in document. Kubebuilder uses binaries from it

@foolusion
Copy link

This is definitely not ideal. Why should the installation directory matter.

@errordeveloper
Copy link

Yes, I also find this rather very surprising.

@chrigl
Copy link

chrigl commented Oct 19, 2018

With this commit kubernetes-sigs/controller-runtime@c5e5439 (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).

@errordeveloper
Copy link

errordeveloper commented Oct 24, 2018 via email

@abbi-gaurav
Copy link

Please consider adding the information to

export KUBEBUILDER_ASSETS = <path of kubebuilder/bin>

in the kubebuilder book.

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 28, 2019
@vhosakot
Copy link

vhosakot commented May 22, 2019

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

@DirectXMan12
Copy link
Contributor

You can also set the KUBEBUILDER_ASSETS environment variable, for posterity

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 29, 2019
@fejta-bot
Copy link

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

@k8s-ci-robot
Copy link
Contributor

@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.

@mayyyyying
Copy link

export KUBEBUILDER_ASSETS=<path of kubebuilder/bin>

probably remove the "space" on the both sides of the equal sign will be better

@dineshba
Copy link

We can use setup-envtest tool to download which version of assets we need and use like below:

export KUBEBUILDER_ASSETS=$(setup-envtest use 1.25.0 -p path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests