-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Kubebuilder is not listed in prerequisites #3461
Comments
Hi @deepak1725, I am unable to reproduce this issue. Kubebuilder should not be a pre-requirement and shows that your project is asking its binary to setup the Env Test. Could you please let us know the steps performed to generate this issue? Could you please let me know if you have kubebuilder installed when you create the project? |
@camilamacedo86 Steps:
|
Hi @deepak1725, Really thank you for raise that. As you know, SDK is in a process to be integrated with KB which means that its project layouts will be aligned. More info : Integrating Kubebuilder and Operator SDK. But, IMHO kubebuilder cannot be set as a pre-requirement because the kubebuilder version used by SDK as dependency can be diff of the version installed. The problem faced by you is because Env Test requires the We will discuss this scenario in the bug triage meeting on Monday. Feel free to attend if you wish. |
PR to fix it for v3 in Kubebuilder; kubernetes-sigs/kubebuilder#1600 |
Hi @deepak1725, See that we added a script to upstream to do this setup and we have a pr against master #3510 and against 0.19.x #3517 to update the docs. |
Description of the change: - Add info in the quick start over how to setup the env test. Otherwise. it will fail when users run docker-build - Add new doc with its options and more detailed information in the references. Motivation for the change: #3461
All done. We can improve the docs in the future as well. Really tks for raise that. |
@camilamacedo86 are we going to cherry-pick this in 0.19 later..? |
It is applied to the 0.19 already. See; https://v0-19-x.sdk.operatorframework.io/docs/golang/references/env-test-setup/ and the PR: #3517 |
We are re-open this one. After the kubebuilder/controller-runtime meeting was decided that we should not re-build the bins and instead of that get them from https://storage.googleapis.com/kubebuilder-tools. @joelanford has been working in an script against controller-runtime: kubernetes-sigs/controller-runtime#1092 And then, we imagine as a final solution something such as:
ENVTEST_ASSETS_DIR=$(pwd)/test/assets
fetch_envtest_assets() {
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m | sed 's/x86_64/amd64/')
mkdir -p $ENVTEST_ASSETS_DIR
curl -fsL "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-1.16.4-${OS}-${ARCH}.tar.gz" | tar zx --strip-components=1 -C $ENVTEST_ASSETS_DIR
}
setup_envtest_env() {
export TEST_ASSET_KUBE_APISERVER=$ENVTEST_ASSETS_DIR/bin/kube-apiserver
export TEST_ASSET_ETCD=$ENVTEST_ASSETS_DIR/bin/etcd
export TEST_ASSET_KUBECTL=$ENVTEST_ASSETS_DIR/bin/kubectl
} Then in a makefile (or wherever) Also, in the PRs #3551 and #3543 we are marking the Env Test doc as TBD as the step to setup it until we have a better solution. |
This shouldn't block v1.0 since the steps to get envtest tools are encoded in a script and documented. Moving this to v1.1.0. |
I just hit this on 1.0, and I don't see this explained in the docs. Is this the right page? https://sdk.operatorframework.io/docs/building-operators/golang/references/envtest-setup/ Might want to weave a link to that into the tutorial, although it's quite possible I missed it. |
Hi @jimdickinson, In the quickstart, you will see that a step was added to solve this problem for now. See: https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/#configuring-your-test-environment |
@camilamacedo86 - the link you sent leads to the |
The above link shows the latest version (1.1). For this version, the setup is no longer required. See that your project is built with the target as: https://github.com/operator-framework/operator-sdk/blob/master/testdata/go/memcached-operator/Makefile#L28-L33. However, if you see any problem could you please raise a new issue. |
I am using operator-sdk version 1.3.0 and get this error message: and here are the lines in the Makefile that seem to be discussed above: Any suggestion as to what I am doing wrong would be appreciated. |
@kansberry SHELL = /bin/bash to your Makefile, what happens? |
No, the command I am running is "make docker-build IMG=registry.hub.docker.com/$USERNAME/memcached-operator:v0.0.1". I also created an environment variable of SHELL=/bin/bash, as suggested, but this didn't fix the issue. I tried falling back to 1.2.0, and I get the same error. CORRECTION. I missed the part about adding the value to the Makefile. I just did that, and it worked. |
|
Thanks Estroz. I was experiencing the same problem as the OP. Doing your suggestion solved the problem! Environment - |
I'm still experiencing this issue |
Yep, I think this is a user-experience issue. If I have to do some research to rename a path for kubebuilder manually through some riga-maru, I don't think most users will find this edge case very friendly. I'd suggest an automated solution to prevent this error. |
These helped me:
|
Bug Report
Kubebuilder is Tightly coupled in requirements, which is fine but...
kubebuilder
is not listed in Prerequisitesmake docker-build ...
expects kubebuilder inusr/local/kubebuilder
only otherwise it raises an error, which I don't think is a good idea. User may have kubebuilder anywhere in PATH.What did you do?
make docker-build $IMG
What did you expect to see?
resolves kubebuilder from
$PATH
not from any Specific Location.What did you see instead? Under which circumstances?
Environment
operator-sdk version: 0.19
go version: 0.14
Kubernetes version information: 1.18
Kubernetes cluster kind: minikube
Are you writing your operator in ansible, helm, or go? go
Possible Solution
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: