make: *** [generate] Error 127

Maybe you will get the following error when you try to work with a go operator-sdk project you cloned from GitHub.

*** [generate] Error 127

Here we see that simply the bin directory with the needed controller-genkustomize and setup-envtest files, wasn’t created by operator-sdk commands.

This blog post does address that topic for a macOS operating system and is structured in following sections:

  1. Fast solution
  2. Reproduce the problem
  3. Fix the problem

1. Fast solution

In short words we need just to copy the bin directory from an existing operator-sdk project we have on our machine and past it into the cloned project and it will work for our cloned project.

But we will have problems, when we create new projects with that installation setup using brew install operator-sdk.
(even when this is my preferred way 😦 because I want to avoid FATA[0009] failed to create API: unable to run post-scaffold tasks of β€œ”: exit status 2)

I created a GitHub issue.

2. Reproduce the problem

We are using the currently available operator SDK version 19.1.0 which we installed using brew as described in the operator-sdk documentation.

Step 1: Clone a GO operator-sdk project from GitHub

git clone
cd multi-tenancy-frontend-operator/frontendOperator

Step 2: Run make generate and get the error

make generate

  • Example output:

As we will see, there are files and bin folder missing. 

bin/controller-gen: No such file or directory

go: added v1.3.0
/multi-tenancy-frontend-operator/frontendOperator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
bash: /Users/thomassuedbroecker/Downloads/dev/verify/multi-tenancy-frontend-operator/frontendOperator/bin/controller-gen: No such file or directory
make: *** [generate] Error 127

Step 3: Verify operator-sdk version

operator-sdk version

  • Example output:

Ensure you have operator-sdk version: "v1.19.1" installed.

operator-sdk version: "v1.19.1", commit: "079d8852ce5b42aa5306a1e33f7ca725ec48d0e3", kubernetes version: "v1.23", go version: "go1.18.1", GOOS: "darwin", GOARCH: "amd64"

3. Fix the problem for now

We are using an Operator SDK version that worked before, in my case I used 18.0.0 successfully some time ago. As far as I remember, golang version 1.17.6 was related to operator-sdk 18.0.0 version.

Note: If you want to install an older Operator SDK version with brew, that won’t work as there is only one brew formulae, as I found out. I hope that the brew installation will be fixed in the future.

So, we will do the following sequence to fix the problem:

  1. Uninstall the operator-sdk we installed with brew
  2. Install operator-sdk 18.0.0 using the binaries and install golang in version go 1.17.6
  3. Verify does the creation of a new operator project now include the bin and the related files

Step 1: Uninstall operator-sdk we installed with brew

Follow the steps outlined in one of my blog posts, but only for uninstalling. The current version of the operator-sdk in brew is 1.19.1.

sudo go clean -cache
brew uninstall operator-sdk
brew uninstall go
sudo rm -rf /usr/local/Cellar/go
sudo rm -rf /usr/local/go
sudo rm -rf /Users/$YOUR_USER/go

Step 2: Install operator-sdk 18.0.0 and goland 1.17.6 using the binariesΒΆ

Here we follow the related operator-sdk documentation.

1. Create a folder for your downloads

mkdir operator-sdk
cd operator-sdk

2. Set platform information

export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')

3. Download the binary for your platform

curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}

4. Install the release binary in your PATH

chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk

5. Download go 1.17.6

6. Install go 1.17.6 using the downloaded file

7. Verify the installed operator-sdk and golang version

operator-sdk version

  • Example output:
operator-sdk version: "v1.18.0", commit: "c9c61b6921b29d731e64cd3cc33d268215fb3b25", kubernetes version: "1.21", go version: "go1.17.7", GOOS: "darwin", GOARCH: "amd64"

Let us just create an example project problemfix.

Step 1: Create a new empty folder outside the cloned projectΒΆ

cd .. 
mkdir fixproblem
cd fixproblem

Step 2: RunΒ operator-sdk init

operator-sdk init --domain --repo

  • Example output:
go: downloading v0.2.0
go: downloading v1.0.0-20141024135613-dd632973f1e7
go: downloading v1.1.0
Next: define a resource with:
$ operator-sdk create api

Step 2: Create an APIΒΆ

operator-sdk create api --group myproblemfix --version v1alpha1 --kind Myproblemfix --resource --controller

  • Example output:
Next: implement your new API and generate the manifests (e.g. CRDs,CRs) with:
$ make manifests

Step 3: RunΒ make generate

make generate
make manifest
make build

Step 3: Verify the bin folder and the needed files were createdΒΆ

fixproblem % tree
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ Makefile
β”œβ”€β”€ PROJECT
β”œβ”€β”€ api
β”‚   └── v1alpha1
β”‚       β”œβ”€β”€ groupversion_info.go
β”‚       β”œβ”€β”€ myproblemfix_types.go
β”‚       └── zz_generated.deepcopy.go
β”œβ”€β”€ bin
β”‚   β”œβ”€β”€ controller-gen
β”‚   β”œβ”€β”€ kustomize
β”‚   └── manager
β”œβ”€β”€ config
β”‚   β”œβ”€β”€ crd
β”‚   β”‚   β”œβ”€β”€ bases
β”‚   β”‚   β”‚   └── myproblemfix.myproblemfix.net_myproblemfixes.yaml
β”‚   β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   β”‚   β”œβ”€β”€ kustomizeconfig.yaml
β”‚   β”‚   └── patches
β”‚   β”‚       β”œβ”€β”€ cainjection_in_myproblemfixes.yaml
β”‚   β”‚       └── webhook_in_myproblemfixes.yaml
β”‚   β”œβ”€β”€ default
β”‚   β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   β”‚   β”œβ”€β”€ manager_auth_proxy_patch.yaml
β”‚   β”‚   └── manager_config_patch.yaml
β”‚   β”œβ”€β”€ manager
β”‚   β”‚   β”œβ”€β”€ controller_manager_config.yaml
β”‚   β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   β”‚   └── manager.yaml
β”‚   β”œβ”€β”€ manifests
β”‚   β”‚   └── kustomization.yaml
β”‚   β”œβ”€β”€ prometheus
β”‚   β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   β”‚   └── monitor.yaml
β”‚   β”œβ”€β”€ rbac
β”‚   β”‚   β”œβ”€β”€ auth_proxy_client_clusterrole.yaml
β”‚   β”‚   β”œβ”€β”€ auth_proxy_role.yaml
β”‚   β”‚   β”œβ”€β”€ auth_proxy_role_binding.yaml
β”‚   β”‚   β”œβ”€β”€ auth_proxy_service.yaml
β”‚   β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   β”‚   β”œβ”€β”€ leader_election_role.yaml
β”‚   β”‚   β”œβ”€β”€ leader_election_role_binding.yaml
β”‚   β”‚   β”œβ”€β”€ myproblemfix_editor_role.yaml
β”‚   β”‚   β”œβ”€β”€ myproblemfix_viewer_role.yaml
β”‚   β”‚   β”œβ”€β”€ role.yaml
β”‚   β”‚   β”œβ”€β”€ role_binding.yaml
β”‚   β”‚   └── service_account.yaml
β”‚   β”œβ”€β”€ samples
β”‚   β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   β”‚   └── myproblemfix_v1alpha1_myproblemfix.yaml
β”‚   └── scorecard
β”‚       β”œβ”€β”€ bases
β”‚       β”‚   └── config.yaml
β”‚       β”œβ”€β”€ kustomization.yaml
β”‚       └── patches
β”‚           β”œβ”€β”€ basic.config.yaml
β”‚           └── olm.config.yaml
β”œβ”€β”€ controllers
β”‚   β”œβ”€β”€ myproblemfix_controller.go
β”‚   └── suite_test.go
β”œβ”€β”€ go.mod
β”œβ”€β”€ go.sum
β”œβ”€β”€ hack
β”‚   └── boilerplate.go.txt
└── main.go


With that we ensure you have a working version. Now you can try to install different operator-sdk binaries if they work with the golang 1.17.6 related to operator development.

I hope this was useful to you and let’s see what’s next?



#operatorsdk, #macos, #golang, #operators

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at

Up ↑

%d bloggers like this: