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

Unable to download env test config based on the tags #1670

Closed
camilamacedo86 opened this issue Sep 20, 2021 · 18 comments
Closed

Unable to download env test config based on the tags #1670

camilamacedo86 opened this issue Sep 20, 2021 · 18 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@camilamacedo86
Copy link
Member

The documentation and its usage are telling us to use the latest version, however, we need to get the version based on the release tags. See:https://github.com/kubernetes-sigs/controller-runtime/tree/master/tools/setup-envtest

We cannot use the latest because it can change and have breaking changes and we need to ensure what version is compatible or not.

 $ go install sigs.k8s.io/controller-runtime/tools/setup-envtest@0.10.0
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@0.10.0: sigs.k8s.io/controller-runtime/tools/setup-envtest@0.10.0: invalid version: unknown revision 0.10.0

@camilamacedo86
Copy link
Member Author

c/c @varshaprasad96

@jmrodri
Copy link
Contributor

jmrodri commented Sep 20, 2021

/cc @varshaprasad96

@jmrodri
Copy link
Contributor

jmrodri commented Sep 20, 2021

@camilamacedo86 and you meant to use the actual tag value, v0.10.0 and not 0.10.0 right? Though v0.10.0 didn't work for me either but does give a different error:

$ go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.10.0
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.10.0: module sigs.k8s.io/controller-runtime@v0.10.0 found, but does not contain package sigs.k8s.io/controller-runtime/tools/setup-envtest

@rkennedy
Copy link

My organization's workaround for the problem is to specify a commit-ID-based version. For example:

go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20211011193703-ffa8c5001e6a

One way to determine that version string is to view the list of versions at the package documentation: https://pkg.go.dev/sigs.k8s.io/controller-runtime/tools/setup-envtest/versions?tab=versions

Another way is to temporarily download "latest," and then watch for what Go reports that it really downloaded:

$ GOPROXY= go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go: downloading sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20211011193703-ffa8c5001e6a
go: downloading sigs.k8s.io/controller-runtime v0.10.2
...

(In the above command, I clear GOPROXY before running the command because it seems that our proxy (Artifactory) for some reason doesn't include "latest" for the setup-envtest subproject. My workaround is to fetch it from the upstream proxy.golang.org instead. Once I have the desired version identifier, the Artifactory proxy can fetch it normally.)

However, I'm not aware of an easy way to determine "the setup-envtest commit best suited for working with controller-runtime version $x." I'm not sure that's required, though; they seem to be kinda independent of each other, so upgrading controller-runtime doesn't necessarily mean you also need to upgrade setup-envtest.

See also #1659.

@camilamacedo86
Copy link
Member Author

the commit is not good enough. We need the tag that ought to match with the controller runtime release as well.

@varshaprasad96
Copy link
Member

We would have to bring this up in the community meeting, and have an action item for next release process.

@camilamacedo86
Copy link
Member Author

@varshaprasad96 , @vincepri
Could we add this one as a priority?

@FillZpp
Copy link
Contributor

FillZpp commented Jan 12, 2022

go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.10.0: module sigs.k8s.io/controller-runtime@v0.10.0 found, but does not contain package sigs.k8s.io/controller-runtime/tools/setup-envtest

Actually, this is a trick of go install with modules. It is because your project does not import the "sigs.k8s.io/controller-runtime/tools/setup-envtest", rather than controller-runtime doesn't have the setup-envtest in releases.

It's easy to solve it:

  1. Require the controller-runtime in your go.mod
    sigs.k8s.io/controller-runtime v0.10.0
  1. Create a go file in your project with build tools comment and import .../setup-envtest in it. You may have done this if you have already imported code-generator or something else. You can see how Kubernetes do this. Example:
//go:build tools
// +build tools

/*
YOUR_COPYRIGHT
*/

// This package imports things required by build scripts, to force `go mod` to see them as dependencies
package tools

import (
	_ "sigs.k8s.io/controller-runtime/tools/setup-envtest"
)
  1. [Optional] Refresh your go mod, for example go mod vendor if you use vendor.

  2. Use go install without version to install setup-envtest, which will use the version you required in go.mod

go install sigs.k8s.io/controller-runtime/tools/setup-envtest

@FillZpp
Copy link
Contributor

FillZpp commented Jan 12, 2022

@camilamacedo86 We can add the steps above into document, so that users can install setup-envtest with controller-runtime version they required.

@camilamacedo86
Copy link
Member Author

camilamacedo86 commented Jan 14, 2022

Hi @FillZpp,

Thank you for your time and help on this.

My concern/motivation to raise this one is that in Kubebuilder, we are: (here)

ENVTEST = $(shell pwd)/bin/setup-envtest
.PHONY: envtest
envtest: ## Download envtest-setup locally if necessary.
	$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)

Then, a KB user scaffolds the project today. The scaffold is done with controller-runtime version X.
Afterwards, we are still producing new releases and versions. Thus, this target can begin to download a version of this module that is no longer compatible.

Kubebuilder projects are scaffold with the go.mod and with the controller-runtime dep/version already. So, if I correctly understood your suggestion, we can sort it out by removing the latest and scaffolding the build tools import:

ENVTEST = $(shell pwd)/bin/setup-envtest
.PHONY: envtest
envtest: ## Download envtest-setup locally if necessary.
	$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest)

Then, it would install the setup-envtest module version accordingly to the controller-runtime version scaffold in the go.mod.

It shows to address the need without asking the KB users to read the doc/steps. 👍

So, I am closing this one here and opening a KB issue to see if we can do that in this way.
Again, thank you for your help on that.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 14, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 14, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

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

clobrano added a commit to clobrano/machine-deletion-remediation that referenced this issue Jul 10, 2023
…ersion

Currently, the Makefile use a specific commit SHA to target
setup-envtest binary downloads.

This change let install the setup-envtest version required from the
controller-runtime version specified in go.mod

see: kubernetes-sigs/controller-runtime#1670 (comment)

Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
@camilamacedo86
Copy link
Member Author

/reopen

It still an issue see: kubernetes-sigs/kubebuilder#3715

@k8s-ci-robot
Copy link
Contributor

@camilamacedo86: Reopened this issue.

In response to this:

/reopen

It still an issue see: kubernetes-sigs/kubebuilder#3715

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.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

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.

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

7 participants