operator-framework / operator-sdk

SDK for building Kubernetes applications. Provides high level APIs, useful abstractions, and project scaffolding.
https://sdk.operatorframework.io
Apache License 2.0
7.25k stars 1.75k forks source link

golang/tutorial failed unless I installed kubebuilder #4432

Closed ErezArbell closed 3 years ago

ErezArbell commented 3 years ago

Bug Report

This is exactly the same as closed issue https://github.com/operator-framework/operator-sdk/issues/3461

What did you do?

I followed this tutorial today: https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/

I run it until got to this command:

make docker-build docker-push IMG=<some-registry>/<project-name>:<tag>

What did you expect to see?

Should pass

What did you see instead? Under which circumstances?

Got error:

failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory

Then I installed kubebuilder following this guide: https://book.kubebuilder.io/quick-start.html#installation The ran again and this time is passed.

Environment

Operator type:

/language go

Kubernetes cluster type: not sure

$ operator-sdk version

operator-sdk version: "v1.3.0", commit: "1abf57985b43bf6a59dcd18147b3c574fa57d3f6", kubernetes version: "1.19.4", go version: "go1.15.5", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go) go version go1.15.7 linux/amd64

$ kubectl version Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.5", GitCommit:"e6503f8d8f769ace2f338794c914a96fc335df0f", GitTreeState:"clean", BuildDate:"2020-06-26T03:39:24Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}

Possible Solution

Either add kubebuilder to the list of prerequisite or remove the dependency.

Additional context

camilamacedo86 commented 3 years ago

The following info will be in the FAQ section for the next releases:

Note: If using an OS which does not point sh to the bash shell (Ubuntu for example) then you should add the following line to the Makefile:

SHELL := /bin/bash

This will fix potential issues when the docker-build target runs the controller test suite. Issues maybe similar to following error: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory occurred

Could you please let me know if it solves your scenario? Also, @estroz @jmrodri could we not find a solution that is valid for all envs and apply that in upstream?

estroz commented 3 years ago

The root cause of this issue is make test failing (a dependency of docker-build) because of the shell issue. There are two upstream issues related to this problem (https://github.com/kubernetes-sigs/controller-runtime/issues/1234, https://github.com/kubernetes-sigs/controller-runtime/issues/1300), and the workaround suggested above is documented in the FAQ (will be updated next week), so I'm going to close this.