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 test fails #5090

Closed
ghost opened this issue Jul 25, 2021 · 26 comments
Closed

make test fails #5090

ghost opened this issue Jul 25, 2021 · 26 comments
Assignees
Labels
language/go Issue is related to a Go operator project lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/support Indicates an issue that is a support question.
Milestone

Comments

@ghost
Copy link

ghost commented Jul 25, 2021

Bug Report

What did you do?

Create new folder and run

go mod init example.com/m/v2

operator-sdk init --plugins go/v3 --domain example.org --owner "Your name"

operator-sdk create api --group ship --version v1beta1 --kind Frigate

make test

What did you expect to see?

PASS

What did you see instead? Under which circumstances?

/home/deb/osdk/bin/controller-gen "crd:trivialVersions=true,preserveUnknownFields=false" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/home/deb/osdk/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
controllers/suite_test.go
go vet ./...
/home/deb/osdk/bin/setup-envtest use 1.21
Version: 1.21.2
OS/Arch: linux/amd64
Path: /home/deb/.local/share/kubebuilder-envtest/k8s/1.21.2-linux-amd64
go test ./... -coverprofile cover.out
?       example.com/m/v2        [no test files]
?       example.com/m/v2/api/v1beta1    [no test files]
Running Suite: Controller Suite
===============================
Random Seed: 1627252835
Will run 0 of 0 specs

STEP: bootstrapping test environment
2021-07-25T23:40:35.352+0100    DEBUG   controller-runtime.test-env     starting control plane
2021-07-25T23:40:35.353+0100    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"}
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:330
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:260
example.com/m/v2/controllers.glob..func1
        /home/deb/osdk/controllers/suite_test.go:58
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:113
github.com/onsi/ginkgo/internal/leafnodes.(*runner).run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:64
github.com/onsi/ginkgo/internal/leafnodes.(*simpleSuiteNode).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go:25
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runBeforeSuite
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:123
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:63
github.com/onsi/ginkgo/internal/suite.(*Suite).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/suite/suite.go:79
github.com/onsi/ginkgo.runSpecsWithCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:238
github.com/onsi/ginkgo.RunSpecsWithDefaultAndCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:221
example.com/m/v2/controllers.TestAPIs
        /home/deb/osdk/controllers/suite_test.go:44
testing.tRunner
        /usr/local/go/src/testing/testing.go:1193
2021-07-25T23:40:35.353+0100    ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 1, "error": "fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory"}
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:330
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:260
example.com/m/v2/controllers.glob..func1
        /home/deb/osdk/controllers/suite_test.go:58
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:113
github.com/onsi/ginkgo/internal/leafnodes.(*runner).run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:64
github.com/onsi/ginkgo/internal/leafnodes.(*simpleSuiteNode).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go:25
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runBeforeSuite
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:123
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:63
github.com/onsi/ginkgo/internal/suite.(*Suite).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/suite/suite.go:79
github.com/onsi/ginkgo.runSpecsWithCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:238
github.com/onsi/ginkgo.RunSpecsWithDefaultAndCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:221
example.com/m/v2/controllers.TestAPIs
        /home/deb/osdk/controllers/suite_test.go:44
testing.tRunner
        /usr/local/go/src/testing/testing.go:1193
2021-07-25T23:40:35.354+0100    ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 2, "error": "fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory"}
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:330
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:260
example.com/m/v2/controllers.glob..func1
        /home/deb/osdk/controllers/suite_test.go:58
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:113
github.com/onsi/ginkgo/internal/leafnodes.(*runner).run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:64
github.com/onsi/ginkgo/internal/leafnodes.(*simpleSuiteNode).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go:25
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runBeforeSuite
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:123
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:63
github.com/onsi/ginkgo/internal/suite.(*Suite).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/suite/suite.go:79
github.com/onsi/ginkgo.runSpecsWithCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:238
github.com/onsi/ginkgo.RunSpecsWithDefaultAndCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:221
example.com/m/v2/controllers.TestAPIs
        /home/deb/osdk/controllers/suite_test.go:44
testing.tRunner
        /usr/local/go/src/testing/testing.go:1193
2021-07-25T23:40:35.354+0100    ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 3, "error": "fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory"}
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:330
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:260
example.com/m/v2/controllers.glob..func1
        /home/deb/osdk/controllers/suite_test.go:58
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:113
github.com/onsi/ginkgo/internal/leafnodes.(*runner).run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:64
github.com/onsi/ginkgo/internal/leafnodes.(*simpleSuiteNode).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go:25
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runBeforeSuite
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:123
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:63
github.com/onsi/ginkgo/internal/suite.(*Suite).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/suite/suite.go:79
github.com/onsi/ginkgo.runSpecsWithCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:238
github.com/onsi/ginkgo.RunSpecsWithDefaultAndCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:221
example.com/m/v2/controllers.TestAPIs
        /home/deb/osdk/controllers/suite_test.go:44
testing.tRunner
        /usr/local/go/src/testing/testing.go:1193
2021-07-25T23:40:35.354+0100    ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 4, "error": "fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory"}
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:330
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:260
example.com/m/v2/controllers.glob..func1
        /home/deb/osdk/controllers/suite_test.go:58
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:113
github.com/onsi/ginkgo/internal/leafnodes.(*runner).run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go:64
github.com/onsi/ginkgo/internal/leafnodes.(*simpleSuiteNode).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go:25
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runBeforeSuite
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:123
github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go:63
github.com/onsi/ginkgo/internal/suite.(*Suite).Run
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/internal/suite/suite.go:79
github.com/onsi/ginkgo.runSpecsWithCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:238
github.com/onsi/ginkgo.RunSpecsWithDefaultAndCustomReporters
        /home/deb/osdk/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go:221
example.com/m/v2/controllers.TestAPIs
        /home/deb/osdk/controllers/suite_test.go:44
testing.tRunner
        /usr/local/go/src/testing/testing.go:1193
Failure [0.002 seconds]
[BeforeSuite] BeforeSuite
/home/deb/osdk/controllers/suite_test.go:49

  Unexpected error:
      <*fmt.wrapError | 0xc00007e600>: {
          msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory",
          err: <*fmt.wrapError | 0xc00007e5e0>{
              msg: "failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory",
              err: <*fs.PathError | 0xc00033a7b0>{
                  Op: "fork/exec",
                  Path: "/usr/local/kubebuilder/bin/etcd",
                  Err: <syscall.Errno>0x2,
              },
          },
      }
      unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
  occurred

  /home/deb/osdk/controllers/suite_test.go:59
------------------------------
STEP: tearing down the test environment
Panic [0.000 seconds]
[AfterSuite] AfterSuite
/home/deb/osdk/controllers/suite_test.go:73

  Test Panicked
  runtime error: invalid memory address or nil pointer dereference
  /usr/local/go/src/runtime/panic.go:212

  Full Stack Trace
  sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*APIServer).Stop(0xc0005b4000, 0x4b6acd, 0x177ce51)
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane/apiserver.go:417 +0x2d
  sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*ControlPlane).Stop(0xc0002ee000, 0x4f5b00, 0xc00011f560)
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane/plane.go:87 +0x1e5
  sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Stop(0xc0002ee000, 0x21, 0x0)
        /home/deb/osdk/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:194 +0xa5
  example.com/m/v2/controllers.glob..func2()
        /home/deb/osdk/controllers/suite_test.go:75 +0x5b
  example.com/m/v2/controllers.TestAPIs(0xc00048cc00)
        /home/deb/osdk/controllers/suite_test.go:44 +0xcd
  testing.tRunner(0xc00048cc00, 0x1823cb8)
        /usr/local/go/src/testing/testing.go:1193 +0xef
  created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1238 +0x2b3
------------------------------


Ran 0 of 0 Specs in 0.002 seconds
FAIL! -- 0 Passed | 0 Failed | 0 Pending | 0 Skipped
You're using deprecated Ginkgo functionality:
=============================================
Ginkgo 2.0 is under active development and will introduce (a small number of) breaking changes.
To learn more, view the migration guide at https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md
To comment, chime in at https://github.com/onsi/ginkgo/issues/711

  You are using a custom reporter.  Support for custom reporters will likely be removed in V2.  Most users were using them to generate junit or teamcity reports and this functionality will be merged into the core reporter.  In addition, Ginkgo 2.0 will support emitting a JSON-formatted report that users can then manipulate to generate custom reports.

  If this change will be impactful to you please leave a comment on https://github.com/onsi/ginkgo/issues/711
  Learn more at: https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md#removed-custom-reporters

To silence deprecations that can be silenced set the following environment variable:
  ACK_GINKGO_DEPRECATIONS=1.16.4

--- FAIL: TestAPIs (0.00s)
FAIL
coverage: 0.0% of statements
FAIL    example.com/m/v2/controllers    0.017s
FAIL
make: *** [Makefile:89: test] Error 1

Environment

Operator type:

/language go

Kubernetes cluster type:

vanilla

$ operator-sdk version

operator-sdk version: "unknown", commit: "unknown", kubernetes version: "unknown", go version: "go1.16.6", GOOS: "windows", GOARCH: "amd64"

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8", GitCommit:"9f2892aab98fe339f3bd70e3c470144299398ace", GitTreeState:"clean", BuildDate:"2020-08-13T16:12:48Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.3", GitCommit:"ca643a4d1f7bfe34773c74f79527be4afd95bf39", GitTreeState:"clean", BuildDate:"2021-07-15T20:59:07Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}

Possible Solution

Additional context

Running inside WSL 2 Ubuntu 20 on Windows 10

Doing shell = /bin/bash does not work. Are KB and friends a prerequisite?

Video

osdk2.mp4
@openshift-ci openshift-ci bot added the language/go Issue is related to a Go operator project label Jul 25, 2021
@ghost
Copy link
Author

ghost commented Jul 26, 2021

Is go 1.16 supported - kubernetes-sigs/kubebuilder#2124 (comment)?

@ghost
Copy link
Author

ghost commented Jul 26, 2021

This solved my issue - kubernetes-sigs/controller-runtime#1034 (comment)
..
Basically, Operator-SDK is not up-to-date.

I switched to Kubebuilder. Operator-SDK is using it under the hood.

I followed this - https://book.kubebuilder.io/quick-start.html, and it works.

Video

osdk-pass.mp4

Commands are basically the same.

I wasted about 5 hours on this. Operator-SDK team, please fix this, so others don't go through this.

I would pay a premium to get answers in minutes than spend hours.

@varshaprasad96
Copy link
Member

varshaprasad96 commented Jul 26, 2021

This could be a bug and needs investigation. Looks like the author is using the latest version of operator-sdk which uses setup-envtest. The error seems to be because kubebuilder assets are not available at the right location:

/usr/local/kubebuilder/bin/etcd: no such file or directory

setup-envtest downloads the binaries at tmp/k8s/<os_specific_folder>, so I would expect the test setup not to search at the default location (/usr/local/kubebuilder) - which is happening here. The reason kubebuilder works is because they are using previous version of kb project (with controller-runtime 0.8+).

@varshaprasad96
Copy link
Member

kubernetes-sigs/kubebuilder#2272 would solve this issue.

@cg2p
Copy link

cg2p commented Aug 5, 2021

This solved my issue - kubernetes-sigs/controller-runtime#1034 (comment)
..
Basically, Operator-SDK is not up-to-date.

I switched to Kubebuilder. Operator-SDK is using it under the hood.

I followed this - https://book.kubebuilder.io/quick-start.html, and it works.

Video

osdk-pass.mp4

Commands are basically the same.

I wasted about 5 hours on this. Operator-SDK team, please fix this, so others don't go through this.

I would pay a premium to get answers in minutes than spend hours.

Did you get this working with operator-sdk - I have same. I do not have kubebuilder installed separate to operator-sdk?

@varshaprasad96
Copy link
Member

@cg2p A 1.10.x patch release would be out soon as soon as #5117 is merged. That would solve this issue.

@ctrought
Copy link

ctrought commented Sep 9, 2021

Still seeing this issue in 1.11 installed via brew, followed the quick start instructions.

$ operator-sdk version
operator-sdk version: "v1.11.0", commit: "28dcd12a776d8a8ff597e1d8527b08792e7312fd", kubernetes version: "v1.20.2", go version: "go1.16.6", GOOS: "darwin", GOARCH: "arm64"
Failure [0.003 seconds]
[BeforeSuite] BeforeSuite 
/users/ctrought/git/memcached-operator/controllers/suite_test.go:52

  Unexpected error:
      <*fmt.wrapError | 0x14000088320>: {
          msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
          err: <*fmt.wrapError | 0x14000088300>{
              msg: "failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
              err: <*exec.Error | 0x140000882c0>{
                  Name: "etcd",
                  Err: <*errors.errorString | 0x14000366f10>{
                      s: "executable file not found in $PATH",
                  },
              },
          },
      }
      unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: "etcd": executable file not found in $PATH
  occurred

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 8, 2021
@Aisuko
Copy link

Aisuko commented Dec 27, 2021

Same issue on v1.15.0.

operator-sdk version: "v1.15.0", commit: "f6326e832a8a5e5453d0ad25e86714a0de2c0fc8", kubernetes version: "v1.21", go version: "go1.17.2", GOOS: "darwin", GOARCH: "amd64"
  Unexpected error:
      <*fmt.wrapError | 0xc000496180>: {
          msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
          err: <*fmt.wrapError | 0xc000496160>{
              msg: "failed to start the controlplane. retried 5 times: exec: \"etcd\": executable file not found in $PATH",
              err: <*exec.Error | 0xc000496120>{
                  Name: "etcd",
                  Err: <*errors.errorString | 0xc0002ecf30>{
                      s: "executable file not found in $PATH",
                  },
              },
          },
      }
      unable to start control plane itself: failed to start the controlplane. retried 5 times: exec: "etcd": executable file not found in $PATH
  occurred

@Aisuko
Copy link

Aisuko commented Dec 28, 2021

Alright. Finally, I update the ENVTEST_K8S_VERSION from V1.16.9 to V1.22 to soloved this issue on make test. I guess this may related to above said the CRDs support version out of scope.

But I hit same issue while I want to debug step by step locally with suit_test.go. In order to save your time, you should add BinaryAssetsDirectory when init the envtest.Environment , the value from $(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path) in the Makefile

	testEnv = &envtest.Environment{
		CRDDirectoryPaths:     []string{filepath.Join("..", "config", "crd", "bases")},
		ErrorIfCRDPathMissing: true,
                // Add and configure the value
		BinaryAssetsDirectory: "/Users/tifa/Library/Application Support/io.kubebuilder.envtest/k8s/1.22.1-darwin-amd64",
	}

Related code:

https://github.com/kubernetes-sigs/controller-runtime/blob/f236f0345ad2933912ebf34bfcf0f93620769654/pkg/envtest/server.go#L148

@paolomainardi
Copy link

paolomainardi commented Jan 1, 2022

Facing the same issue under a darwin/arm64 machine, it miserably fails not finding the etcd binary.

❯ brew info operator-sdk
operator-sdk: stable 1.15.0 (bottled), HEAD
SDK for building Kubernetes applications
https://coreos.com/operators/
/opt/homebrew/Cellar/operator-sdk/1.15.0 (9 files, 186MB) *
  Poured from bottle on 2022-01-01 at 18:50:44
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/operator-sdk.rb
License: Apache-2.0
==> Dependencies
Required: go ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Analytics
install: 1,201 (30 days), 6,265 (90 days), 26,316 (365 days)
install-on-request: 1,200 (30 days), 6,259 (90 days), 26,312 (365 days)
build-error: 1 (30 days)
❯ brew info kubebuilder
kubebuilder: stable 3.2.0 (bottled), HEAD
SDK for building Kubernetes APIs using CRDs
https://github.com/kubernetes-sigs/kubebuilder
/opt/homebrew/Cellar/kubebuilder/3.2.0 (8 files, 29MB) *
  Poured from bottle on 2022-01-01 at 19:56:58
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/kubebuilder.rb
License: Apache-2.0
==> Dependencies
Build: git-lfs ✘
Required: go ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Analytics
install: 441 (30 days), 1,768 (90 days), 6,831 (365 days)
install-on-request: 437 (30 days), 1,751 (90 days), 6,796 (365 days)
build-error: 0 (30 days)

@paolomainardi
Copy link

Maybe related (i should dig more on how the things work) but the directory where it supposed to have the envtest binary is empty:

❯ ls -ltr /Users/paolomainardi/Library/Application\ Support/io.kubebuilder.envtest
total 0
drwxr-xr-x  2 paolomainardi  staff  64 Jan  1 20:10 k8s
❯ ls -ltr /Users/paolomainardi/Library/Application\ Support/io.kubebuilder.envtest/k8s
total 0

It the scripts try to download for the current architecture darwin/arm64 it should fail cause they are not present.

export K8S_VERSION=1.21.2
curl -sSLo envtest-bins.tar.gz "https://go.kubebuilder.io/test-tools/${K8S_VERSION}/darwin/arm64"`

@timbrd
Copy link

timbrd commented Jan 2, 2022

Maybe related (i should dig more on how the things work) but the directory where it supposed to have the envtest binary is empty:

❯ ls -ltr /Users/paolomainardi/Library/Application\ Support/io.kubebuilder.envtest
total 0
drwxr-xr-x  2 paolomainardi  staff  64 Jan  1 20:10 k8s
❯ ls -ltr /Users/paolomainardi/Library/Application\ Support/io.kubebuilder.envtest/k8s
total 0

It the scripts try to download for the current architecture darwin/arm64 it should fail cause they are not present.

export K8S_VERSION=1.21.2
curl -sSLo envtest-bins.tar.gz "https://go.kubebuilder.io/test-tools/${K8S_VERSION}/darwin/arm64"`

Where do the binaries have to be placed? This is the folder you mentioned in your last message (/Users/<username>/Library/Application\ Support/io.kubebuilder.envtest/), but it is still not working:

.
├── bin
│   ├── etcd
│   ├── kube-apiserver
│   └── kubectl
├── etcd
├── k8s
│   ├── etcd
│   ├── kube-apiserver
│   └── kubectl
├── kube-apiserver
└── kubectl

@paolomainardi
Copy link

@timbrd if you have the binaries (it seems so) than you need to apply a manual fix like explained here: #5090 (comment) (not tested because i currently have just a silicon cpu right now)

@timbrd
Copy link

timbrd commented Jan 2, 2022

@timbrd if you have the binaries (it seems so) than you need to apply a manual fix like explained here: #5090 (comment) (not tested because i currently have just a silicon cpu right now)

I have an Apple Silicon chip too. The patch was already applied in my Makefile, it's still not working though:

STEP: bootstrapping test environment
2022-01-02T16:45:56.295+0100	DEBUG	controller-runtime.test-env	starting control plane
2022-01-02T16:45:56.300+0100	ERROR	controller-runtime.test-env	unable to start the controlplane	{"tries": 0, "error": "exec: \"etcd\": executable file not found in $PATH"}
github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync
	/Users/tbordemann/go/pkg/mod/github.com/onsi/ginkgo@v1.16.4/internal/leafnodes/runner.go:113
github.com/onsi/ginkgo/internal/leafnodes.(*runner).run
	/Users/tbordemann/go/pkg/mod/github.com/onsi/ginkgo@v1.16.4/internal/leafnodes/runner.go:64

Anything else I should try to do?

@paolomainardi
Copy link

@timbrd i don't really know how to fix it, stumbled upon this issue just yesterday and it was my first time using this project and kubebuilder

@timbrd
Copy link

timbrd commented Jan 2, 2022

@paolomainardi I fixed it by manually adding the folder containing the etcd and kube-apiserver binaries, which I haved downloaded before, to $PATH:

$ export $PATH=$PATH:${HOME}/Library/Application\ Support/io.kubebuilder.envtest/

Now I can run the tests without modifying the makefile.

It seems though, that the fix which was mentioned by @varshaprasad96 does not work.

@paolomainardi
Copy link

@timbrd thanks for keeping me posted, the question now is: how do you have those binaries ? 🤔

This is what i have running tests on a brand new project:

❯ make test
/Users/paolomainardi/webapps/me/labs/additronk8s/k8s/go/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/Users/paolomainardi/webapps/me/labs/additronk8s/k8s/go/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
unable to find a version that was supported for platform darwin/arm64
KUBEBUILDER_ASSETS="" go test ./... -coverprofile cover.out
?   	github.com/paolomainardi/additronk8s-retrogames-kubernetes-controller	[no test files]
?   	github.com/paolomainardi/additronk8s-retrogames-kubernetes-controller/api/v1alpha1	[no test files]
Running Suite: Controller Suite
===============================
Random Seed: 1641233247
Will run 0 of 0 specs

STEP: bootstrapping test environment
2022-01-03T19:07:27.925+0100	DEBUG	controller-runtime.test-env	starting control plane
2022-01-03T19:07:27.930+0100	ERROR	controller-runtime.test-env	unable to start the controlplane	{"tries": 0, "error": "exec: \"etcd\": executable file not found in $PATH"}

And no binaries:

❯ ls -ltr ${HOME}/Library/Application\ Support/io.kubebuilder.envtest/
total 0
drwxr-xr-x  2 paolomainardi  staff  64 Jan  1 20:10 k8s

@Aisuko
Copy link

Aisuko commented Jan 17, 2022

If we execute make envtest manually. We can execute setup-envtest use manually to check the information and add the path it prints out to the BinaryAssetsDirectory

Yes, I hit the same issue again on WSL container.

➜  recycle ./bin/setup-envtest use 
Version: 1.23.1
OS/Arch: linux/amd64
md5: *********************
Path: /home/username/.local/share/kubebuilder-envtest/k8s/1.23.1-linux-amd64

@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 16, 2022
@openshift-ci openshift-ci bot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Feb 16, 2022
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci
Copy link

openshift-ci bot commented Mar 18, 2022

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

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

@openshift-ci openshift-ci bot closed this as completed Mar 18, 2022
@huiyichanmian
Copy link

在机器下面临同样的问题darwin/arm64,它很遗憾找不到 etcd 二进制文件。

❯ brew info operator-sdk
operator-sdk: stable 1.15.0 (bottled), HEAD
SDK for building Kubernetes applications
https://coreos.com/operators/
/opt/homebrew/Cellar/operator-sdk/1.15.0 (9 files, 186MB) *
  Poured from bottle on 2022-01-01 at 18:50:44
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/operator-sdk.rb
License: Apache-2.0
==> Dependencies
Required: go ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Analytics
install: 1,201 (30 days), 6,265 (90 days), 26,316 (365 days)
install-on-request: 1,200 (30 days), 6,259 (90 days), 26,312 (365 days)
build-error: 1 (30 days)
❯ brew info kubebuilder
kubebuilder: stable 3.2.0 (bottled), HEAD
SDK for building Kubernetes APIs using CRDs
https://github.com/kubernetes-sigs/kubebuilder
/opt/homebrew/Cellar/kubebuilder/3.2.0 (8 files, 29MB) *
  Poured from bottle on 2022-01-01 at 19:56:58
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/kubebuilder.rb
License: Apache-2.0
==> Dependencies
Build: git-lfs ✘
Required: go ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Analytics
install: 441 (30 days), 1,768 (90 days), 6,831 (365 days)
install-on-request: 437 (30 days), 1,751 (90 days), 6,796 (365 days)
build-error: 0 (30 days)

I have been tortured by this problem. How did you solve it in the end?

@arshabbir
Copy link

The below combination worked for me :)

arshabbir@arshabbir-VirtualBox:/testop$ operator-sdk version
operator-sdk version: "v1.19.1", commit: "079d8852ce5b42aa5306a1e33f7ca725ec48d0e3", kubernetes version: "1.23", go version: "go1.17.8", GOOS: "linux", GOARCH: "amd64"
arshabbir@arshabbir-VirtualBox:
/testop$ go version
go version go1.17.3 linux/amd64

@gx14ac
Copy link

gx14ac commented Apr 23, 2022

this problem is solved by these two differentials.

kubernetes-sigs/controller-runtime#1657 (comment)
ministryofjustice/analytical-platform-tools-operator@fdca211

@michael-goe
Copy link

this problem is solved by these two differentials.

kubernetes-sigs/controller-runtime#1657 (comment) ministryofjustice/analytical-platform-tools-operator@fdca211

Thanks for posting. For me the first one was sufficient to resolve the problem on M1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/go Issue is related to a Go operator project lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/support Indicates an issue that is a support question.
Projects
None yet
Development

No branches or pull requests