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

go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest fails with go.mod:3: invalid go version '1.22.0': must match format 1.23 #2720

Closed
kgoutham93 opened this issue Mar 22, 2024 · 10 comments

Comments

@kgoutham93
Copy link

kgoutham93 commented Mar 22, 2024

Installing latest version of setup-envtest fails with the following error log.

go: downloading sigs.k8s.io/controller-runtime v0.17.2
go: downloading sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240322105421-affb96708000
go: sigs.k8s.io/controller-runtime/tools/setup-envtest@latest (in sigs.k8s.io/controller-runtime/tools/[email protected]): go.mod:3: invalid go version '1.22.0': must match format 1.23

Go version

$ go version
go version go1.20.7 linux/amd64

Could be related to golang/go#61888 ?

@fspaniol
Copy link

fspaniol commented Mar 22, 2024

I guess it might be related to: 4c2442e#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6R3 (there are some discussions in the original PR thread): #2693 (comment)

Previously: 1.21, now 1.22.0.

I tried to open a quick fix for it, but unfortunately I don't have time to do to it properly and thus I closed it. 😓

@sbueringer
Copy link
Member

I tried to open a quick fix for it, but unfortunately I don't have time to do to it properly and thus I closed it. 😓

@fspaniol So I assume just dropping the patch version wasn't enough? Did you find a problem with that?

raukadah pushed a commit to raukadah/openstack-operator that referenced this issue Mar 22, 2024
kubernetes-sigs/controller-runtime#2693 broke
the content provider while doing docker-build with following issue[1]

In order to unblock the CI, we are pinning
sigs.k8s.io/controller-runtime/tools/setup-envtest at previous working
commit[2]

[1]. kubernetes-sigs/controller-runtime#2720
[2]. kubernetes-sigs/controller-runtime@c7e1dc9

Signed-off-by: Chandan Kumar <[email protected]>
raukadah added a commit to raukadah/openstack-operator that referenced this issue Mar 22, 2024
kubernetes-sigs/controller-runtime#2693 broke
the content provider while doing docker-build with following issue[1]

In order to unblock the CI, we are pinning
sigs.k8s.io/controller-runtime/tools/setup-envtest at previous working
commit[2]

[1]. kubernetes-sigs/controller-runtime#2720
[2]. kubernetes-sigs/controller-runtime@c7e1dc9

Signed-off-by: Chandan Kumar <[email protected]>
fao89 added a commit to fao89/openstack-operator that referenced this issue Mar 22, 2024
kubernetes-sigs/controller-runtime#2693 broke
the content provider while doing docker-build with following issue[1]

In order to unblock the CI, we are pinning
sigs.k8s.io/controller-runtime/tools/setup-envtest at previous working
commit[2]

[1]. kubernetes-sigs/controller-runtime#2720
[2]. kubernetes-sigs/controller-runtime@c7e1dc9

Signed-off-by: Chandan Kumar <[email protected]>
(cherry picked from commit c92983c)
Signed-off-by: Fabricio Aguiar <[email protected]>
@fspaniol
Copy link

fspaniol commented Mar 22, 2024

I tried to open a quick fix for it, but unfortunately I don't have time to do to it properly and thus I closed it. 😓

@fspaniol So I assume just dropping the patch version wasn't enough? Did you find a problem with that?

I'm sorry, I should have been more specific. I didn't exactly try it out because I'm on a rush to finish some things here, what I meant was that since the PR actions failed due to the best practice checks, I closed it. The fix may be valid still, but I honestly haven't tried it out.

For now, in my repositories I just used the latest release tag.

gibizer added a commit to gibizer/nova-operator that referenced this issue Mar 22, 2024
kubernetes-sigs/controller-runtime#2693 broke
the content provider while doing docker-build with following issue[1]

In order to unblock the CI, we are pinning
sigs.k8s.io/controller-runtime/tools/setup-envtest at previous working
commit[2]

[1]. kubernetes-sigs/controller-runtime#2720
[2]. kubernetes-sigs/controller-runtime@c7e1dc9
@fspaniol
Copy link

I tried to open a quick fix for it, but unfortunately I don't have time to do to it properly and thus I closed it. 😓

@fspaniol So I assume just dropping the patch version wasn't enough? Did you find a problem with that?

Hey @sbueringer , I managed to find the time to go a bit deeper on this and opened a new PR with some insights: #2722

gibizer added a commit to gibizer/placement-operator that referenced this issue Mar 22, 2024
kubernetes-sigs/controller-runtime#2693 broke
the content provider while doing docker-build with following issue[1]

In order to unblock the CI, we are pinning
sigs.k8s.io/controller-runtime/tools/setup-envtest at previous working
commit[2]

[1]. kubernetes-sigs/controller-runtime#2720
[2]. kubernetes-sigs/controller-runtime@c7e1dc9
booxter added a commit to openstack-k8s-operators/neutron-operator that referenced this issue Mar 22, 2024
kubernetes-sigs/controller-runtime#2693 broke
the content provider while doing docker-build with following issue[1]

In order to unblock the CI, we are pinning
sigs.k8s.io/controller-runtime/tools/setup-envtest at previous working
commit[2]

[1]. kubernetes-sigs/controller-runtime#2720
[2]. kubernetes-sigs/controller-runtime@c7e1dc9

Co-Authored-By: Balazs Gibizer <[email protected]>
@karlkfi
Copy link

karlkfi commented Mar 22, 2024

If setup-envtest had git tags, that might provide a workaround. Currently, if you try to go get sigs.k8s.io/controller-runtime/tools/setup-envtest you get an auto-generated version number, because it's not taking the parent directory's version.

Alternatively, using go workspaces might allow the parent tag to work for child modules.

I ran into a similar problem trying to use setup-envtest@latest, which now requires Go 1.22. Not having tags makes it hard to pin to an old version. I ended up using go get sigs.k8s.io/controller-runtime/tools/[email protected] to puin to an old version.

booxter added a commit to booxter/ovn-operator that referenced this issue Mar 22, 2024
kubernetes-sigs/controller-runtime#2693 broke
the content provider while doing docker-build with following issue[1]

In order to unblock the CI, we are pinning
sigs.k8s.io/controller-runtime/tools/setup-envtest at previous working
commit[2]

[1]. kubernetes-sigs/controller-runtime#2720
[2]. kubernetes-sigs/controller-runtime@c7e1dc9

Co-Authored-By: Balazs Gibizer <[email protected]>
fedepaol added a commit to fedepaol/metallb that referenced this issue Mar 22, 2024
Currently being bitten by kubernetes-sigs/controller-runtime#2720

Signed-off-by: Federico Paolinelli <[email protected]>
roivaz added a commit to 3scale-ops/marin3r that referenced this issue Mar 22, 2024
bdevcich added a commit to NearNodeFlash/nnf-sos that referenced this issue Mar 22, 2024
@sbueringer
Copy link
Member

Thx for taking a closer look!

I think it's important that we have a go.mod file which won't be updated after running go mod tidy (or other go commands).

As far as I can tell there is no way to do this with go 1.22it will always be updated to go 1.22.0 if commands like go mod tidy are run with Go 1.22.

Also based on the delta here: https://go-review.googlesource.com/c/go/+/560855/8/src/cmd/vendor/golang.org/x/mod/modfile/rule.go I think they basically changed the format of the go version: invalid go version '%s': must match format 1.23.0.

So I think we have no other choice than using go 1.22.0. Folks that use older go versions will have to pin to older CR versions. But I think this also sort of makes sense and was always the case. If CR declares a go version as the "mimimum Go version" than that's the minimum required version :).

I think adding tags for tools/setup-envtestmakes it easier to pin to a specific CR version, but it won't change the fact that the minimum required version is 1.22.

ifireball added a commit to ifireball/project-controller that referenced this issue Mar 28, 2024
This will fix CI issues.
This is a work around for an upstream issue: kubernetes-sigs/controller-runtime#2720

Signed-off-by: Barak Korren <[email protected]>
mmorhun pushed a commit to konflux-ci/image-controller that referenced this issue Mar 28, 2024
* chore(deps): update rhtap references

* Pin to a non-breaking version of setup-envtest

kubernetes-sigs/controller-runtime#2720

The minimum required Go version for setup-envtes was bumped to 1.22,
breaking us. Pin to release-0.16, which doesn't use 1.22 yet. It uses
1.21, which is still higher than what we use, but back then Go didn't
enforce the version requirement yet.

Signed-off-by: Adam Cmiel <[email protected]>

---------

Signed-off-by: Adam Cmiel <[email protected]>
Co-authored-by: red-hat-konflux <123456+red-hat-konflux[bot]@users.noreply.github.com>
Co-authored-by: Adam Cmiel <[email protected]>
@twz123
Copy link
Contributor

twz123 commented Mar 28, 2024

Just a side note: controller-runtime is expected to fail with Go versions < 1.22. That's basically what the go directive in go.mod is saying. The minimum Go version is 1.22.0. So if you're trying to build controller-runtime with a Go toolchain < 1.22, you should expect failures.

yjian118 added a commit to yjian118/cloud-platform-deployment-manager that referenced this issue Mar 28, 2024
This commit pins the envtest version to work aound an upstream issue
in:  kubernetes-sigs/controller-runtime#2720

Signed-off-by: Yuxing Jiang <[email protected]>
(cherry picked from commit a40f521)
yjian118 added a commit to Wind-River/cloud-platform-deployment-manager that referenced this issue Mar 28, 2024
This commit pins the envtest version to work aound an upstream issue
in:  kubernetes-sigs/controller-runtime#2720

Signed-off-by: Yuxing Jiang <[email protected]>
(cherry picked from commit a40f521)
@karlkfi
Copy link

karlkfi commented Mar 28, 2024

Yes, but the problem is that the instructions here say to use latest when executing envtest. So if you don't have Go 1.22+ installed, that go install command suddenly started failing when controller-runtime was updated. And because there's no git tag for this submodule, there's no easy way to pin to an old version using the same semver as the parent module. So you're stuck trying to find the exact commit you need to pin to that matches the old version of config-runtime you're using.

On top of that, recent config-management changes have several reverse incompatible interface changes, making upgrade non-trivial. So everyone using envtest is now forced to do work to fix their environment.

@sbueringer
Copy link
Member

sbueringer commented Mar 28, 2024

I think if you were happy before with using latest, it should be fine to pin to a release branch, e.g. go get sigs.k8s.io/controller-runtime/tools/[email protected] (+ we should update our docs)

I wonder if we didn't have the same problem before as we specify a min go version in the tools/setup-envtest/go.mod file (before 1.22 it was 1.20).

cgroschupp added a commit to cgroschupp/opensearch-k8s-operator that referenced this issue Mar 30, 2024
stuggi pushed a commit to stuggi/openstack-operator that referenced this issue Apr 9, 2024
kubernetes-sigs/controller-runtime#2693 broke
the content provider while doing docker-build with following issue[1]

In order to unblock the CI, we are pinning
sigs.k8s.io/controller-runtime/tools/setup-envtest at previous working
commit[2]

[1]. kubernetes-sigs/controller-runtime#2720
[2]. kubernetes-sigs/controller-runtime@c7e1dc9

Signed-off-by: Chandan Kumar <[email protected]>
bjeevan-ib added a commit to infobloxopen/db-controller that referenced this issue Apr 15, 2024
bjeevan-ib added a commit to infobloxopen/db-controller that referenced this issue Apr 15, 2024
* create partman extension in partman schema and grant access

* update golang version

* pinned version of envtest to avoid kubernetes-sigs/controller-runtime#2720
jan--f added a commit to jan--f/observability-operator that referenced this issue May 14, 2024
This fixes our current ci issues. Seems like some dependencies have
updated to go1.22 and operator-sdk generate is not backwards compatible.
kubernetes-sigs/controller-runtime#2720 has
some details.

Signed-off-by: Jan Fajerski <[email protected]>
jan--f added a commit to jan--f/observability-operator that referenced this issue May 16, 2024
This fixes our current ci issues. Seems like some dependencies have
updated to go1.22 and operator-sdk generate is not backwards compatible.
kubernetes-sigs/controller-runtime#2720 has
some details.

Signed-off-by: Jan Fajerski <[email protected]>
marioferh pushed a commit to marioferh/observability-operator that referenced this issue Jun 13, 2024
This fixes our current ci issues. Seems like some dependencies have
updated to go1.22 and operator-sdk generate is not backwards compatible.
kubernetes-sigs/controller-runtime#2720 has
some details.

Signed-off-by: Jan Fajerski <[email protected]>
openshift-merge-bot bot pushed a commit to rhobs/observability-operator that referenced this issue Jun 14, 2024
* build(deps): bump k8s.io/apiextensions-apiserver from 0.29.3 to 0.30.0

Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.29.3 to 0.30.0.
- [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases)
- [Commits](kubernetes/apiextensions-apiserver@v0.29.3...v0.30.0)

---
updated-dependencies:
- dependency-name: k8s.io/apiextensions-apiserver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* build: require go v1.22

This fixes our current ci issues. Seems like some dependencies have
updated to go1.22 and operator-sdk generate is not backwards compatible.
kubernetes-sigs/controller-runtime#2720 has
some details.

Signed-off-by: Jan Fajerski <[email protected]>

* chore: generate

Signed-off-by: Jan Fajerski <[email protected]>

* chore: update controller-runtime to 0.18.2

With the go1.22 update and controller-runtime 0.17.x the project doesn't
build.

Signed-off-by: Jan Fajerski <[email protected]>

* chore: remove unused code

Signed-off-by: Jan Fajerski <[email protected]>

* ci: setup go after starting kind

Also update kind version and kind-action version.

Signed-off-by: Jan Fajerski <[email protected]>

* chore: minor fixes

Signed-off-by: Mario Fernandez <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Jan Fajerski <[email protected]>
Signed-off-by: Mario Fernandez <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jan Fajerski <[email protected]>
TeddyAndrieux added a commit to scality/metalk8s that referenced this issue Jul 24, 2024
Latest version of setup-envtest can only works with Go 1.22, since we
are not yet using it let's pin the setup-envtest version

Unfortunatly there is no real tag for setup-envtest so we have to use
long tag commit hash

Sees: kubernetes-sigs/controller-runtime#2720
(cherry picked from commit 8d67943)
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

5 participants