kubernetes-sigs / controller-runtime

Repo for the controller-runtime subproject of kubebuilder (sig-apimachinery)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] setup-envtest unable to find version for linux

sk593 opened this issue · comments

Running into this error when installing the setup-envtest tools on a linux-amd64 system

/bin/sh: 1: /home/runner/go/bin/setup-envtest: not found
=> Installing Kubebuilder test tools...
go: downloading sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240522175850-2e9781e9fc60
go: downloading github.com/spf13/afero v1.6.0
go: downloading go.uber.org/zap v1.26.0
go: downloading sigs.k8s.io/yaml v1.3.0
go: downloading golang.org/x/text v0.14.0
go: downloading go.uber.org/multierr v1.10.0
=> Instructions:
=> Set environment variable KUBEBUILDER_ASSETS for tests.
=> KUBEBUILDER_ASSETS=""
unable to find a version that was supported for platform linux/amd64
KUBEBUILDER_ASSETS="" CGO_ENABLED=1 gotestsum --junitfile ./dist/unit_test/results.xml -- -v ./pkg/... -race -coverprofile ./dist/unit_test/ut_coverage.out

This is happening in a makefile where the controller-runtime package gets downloaded and used: https://github.com/radius-project/radius/blob/66aad2c07b0793a1c59088b4868a83596ca3e448/build/test.mk#L51

This seems to be isolated to linux-amd64 and it's not happening for other architectures

Can you share the exact setup-envtest command your running?

Context: we merged this PR yesterday: #2811 (comment)

But all envtest binaries in controller tools are available for the same OS/ARCH permutations.

Sure, we're running into issues with the makefile. This code in test.mk where we try to download the setup-envtest package is causing the error: https://github.com/radius-project/radius/blob/66aad2c07b0793a1c59088b4868a83596ca3e448/build/test.mk#L50. Because the setup-envtest package doesnt get installed correctly, the tests that use the package fail.

This is how we use the setup-envtest package in our code: https://github.com/radius-project/radius/blob/main/test/ucp/kubeenv/testenv.go. And this is the test it gets used in: https://github.com/radius-project/radius/blob/4cacb5872861e0fcce74a9109f0cdecd361d80ed/pkg/ucp/queue/apiserver/client_test.go#L100

This started happening after #2811 was merged and only for linux which is interesting. Previous versions of the package are working as expected and I tested on a darwin machine that downloaded the binary completely fine.

@sk593 will be fixed by: kubernetes-sigs/controller-tools#979

Basically setup-envtest@latest now gets the binaries from controller-tools releases instead of GCS. We only published v1.23+.

Might be worth considering using a newer Kubernetes version than 1.23 for your tests. I have absolutely no idea why this woul only happen on linux, we published the same versions for all OS/architecture combinations.

@sk593 Should be done. Can you try again?

(xref: https://github.com/kubernetes-sigs/controller-tools/releases/tag/envtest-v1.23.5)

Just confirmed that the fix works. We'll look into using a newer Kubernetes version to avoid similar issues in the future. Thanks for the quick turnaround!

No problem. We basically just created envtest binaries for relatively recent versions at the new location (controller-tools). We stopped at 1.24 :)

/close

@sbueringer: Closing this issue.

In response to this:

No problem. We basically just created envtest binaries for relatively recent versions at the new location (controller-tools). We stopped at 1.24 :)

/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-sigs/prow repository.