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

make deploy - results in -> ~/go/bin/controller-gen: No such file or directory #104

Closed
adligo opened this issue Mar 18, 2022 · 15 comments
Closed

Comments

@adligo
Copy link

adligo commented Mar 18, 2022

Hi All,

I have a issue getting make deploy to work;

macOs 12.2.1 (21D62)

kubectl version --client
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:51:05Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"darwin/amd64"}

go version go1.18 darwin/amd64

GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

{Version:kustomize/v4.5.2 GitCommit:9091919699baf1c5a5bf71b32ca73a993e98088b BuildDate:2022-02-09T23:19:28Z GoOs:darwin GoArch:amd64}

The output looks as follows with some privacy modifications (i.e. -> ~)
...
go: added sigs.k8s.io/yaml v1.2.0
~/go/bin/controller-gen "crd:trivialVersions=true,crdVersions=v1" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/bin/sh: ~/go/bin/controller-gen: No such file or directory

Please Help, & TIA :)

@adligo
Copy link
Author

adligo commented Mar 18, 2022

Any good docker images that are known to build correctly ?

@adligo
Copy link
Author

adligo commented Mar 18, 2022

I guess docker pull grafana/k6

@adligo
Copy link
Author

adligo commented Mar 19, 2022

Also having this same issue on ubuntu

@adligo
Copy link
Author

adligo commented Mar 19, 2022

go get github.com/llparse/controller-gen
go install github.com/llparse/controller-gen

got me to a new error

go: added sigs.k8s.io/yaml v1.2.0
~/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
F0318 20:27:24.762765   87169 packages.go:59] Failed loading boilerplate: open k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt: no such file or directory
make: *** [manifests] Error 255

@adligo
Copy link
Author

adligo commented Mar 19, 2022

Or should that be;

go get sigs.k8s.io/controller-tools
go install sigs.k8s.io/controller-tools

@adligo
Copy link
Author

adligo commented Mar 19, 2022

brew install k6

@muh-nine
Copy link

@adligo did you find a solution to this error?

/Users/x/go/bin/controller-gen: No such file or directory

@yorugac
Copy link
Collaborator

yorugac commented Mar 21, 2022

Hi @adligo

Please look into Makefile; when controller-gen binary is absent it should be installed on its own:

k6-operator/Makefile

Lines 111 to 124 in 57e4b3e

controller-gen:
ifeq (, $(shell which controller-gen))
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif

make controller-gen is invoked by make deploy but It seems to fail in your case. So it would be useful to debug why exactly it fails. Either way, the commands can be found in Makefile as can be seen in this snippet.

@adligo
Copy link
Author

adligo commented Mar 21, 2022

Sure you should add the instructions for which controller-gen you need installed (or suggest installing) as part of your dependencies / instructions. I have tried a few but was still unsucessful.

@yorugac
Copy link
Collaborator

yorugac commented Mar 24, 2022

I have tried a few but was still unsucessful.

@adligo did the version in Makefile work? First try to follow the existing commands from make controller-gen and see what happens. E.g. do you get a failure, what kind of failure and at what step exactly? Without this info, it's not possible to derive a reason for make deploy failure.

As for your suggestion, I personally think that at this point Makefile in root directory is verbose enough for those who need to find the version of controller-gen: simply because most people don't need to install it by hand. Your case seems to be an exception at the moment, that's why it needs debugging. Of course, if you see how to improve our README, a PR would be welcome 🙂

@gyume2021
Copy link

gyume2021 commented Apr 15, 2022

Hi @adligo
My setting is as follows:

  1. OS: Ubuntu 20.04
  2. kubectl version:
    Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:58:47Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}
  3. go version go1.18 linux/amd64
  4. make version: GNU Make 4.2.1 Built for x86_64-pc-linux-gnu
  5. controller-gen version: v0.8.0

First, I set my GOBIN and GOPATH as ~/go/bin and my controller-gen is installed in ~/go/bin as well
Next, I removed trivialVersions=true in CRD_OPTIONS because it is not supported in my controller-gen version, and you can check yours with controller-gen -h
And I typed make deploy, I got

/home/go/bin/controller-gen "crd:crdVersions=v1" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
cd config/manager && /home/go/bin/kustomize edit set image controller=ghcr.io/grafana/operator:latest
/home/go/bin/kustomize build config/default | kubectl apply -f -
namespace/k6-operator-system unchanged
customresourcedefinition.apiextensions.k8s.io/k6s.k6.io configured
serviceaccount/k6-operator-controller unchanged
role.rbac.authorization.k8s.io/k6-operator-leader-election-role unchanged
clusterrole.rbac.authorization.k8s.io/k6-operator-manager-role configured
clusterrole.rbac.authorization.k8s.io/k6-operator-metrics-reader unchanged
clusterrole.rbac.authorization.k8s.io/k6-operator-proxy-role unchanged
rolebinding.rbac.authorization.k8s.io/k6-operator-leader-election-rolebinding unchanged
clusterrolebinding.rbac.authorization.k8s.io/k6-operator-manager-rolebinding unchanged
clusterrolebinding.rbac.authorization.k8s.io/k6-operator-proxy-rolebinding unchanged
service/k6-operator-controller-manager-metrics-service unchanged
deployment.apps/k6-operator-controller-manager unchanged

@taiyow
Copy link

taiyow commented May 29, 2022

@adligo
I met same error and solved.

If using go 1.18, go get is obsolete and use go install instead but k6-operator/Makefile has not changed so.

I installed following two commands manually:

go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0
go install sigs.k8s.io/kustomize/kustomize/v4@latest

and after that make deploy finished successfully.

@xendren
Copy link

xendren commented Jun 16, 2022

Thanks @taiyow. That worked.

@yorugac
Copy link
Collaborator

yorugac commented Jul 22, 2022

The suggested fixes are now part of Makefile in main. Closing the issue now. Thanks everyone!

@yorugac yorugac closed this as completed Jul 22, 2022
@daduguai
Copy link

daduguai commented Jul 30, 2022

@adligo I met same error and solved.

If using go 1.18, go get is obsolete and use go install instead but k6-operator/Makefile has not changed so.

I installed following two commands manually:

go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0
go install sigs.k8s.io/kustomize/kustomize/v4@latest

and after that make deploy finished successfully.

I've tried this, but it doesn't work. The directory "bin/controller-gen" is not created. Did anyone meet the same error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants