controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

proper versioning for setup-envtest

Open lukas016 opened this issue 1 year ago • 14 comments

Hi,

we have little problem with kubebuilder which using go install for installation of setup-envtest in latest version. Using latest version creates unexpected problems with synchronization between developers.

It is possible little optimize and use branch name for installation the same minor version, but if we want to use really the same version, it isn't possible.

Main problem is with go install which requires own tag for every submodule.

go install sigs.k8s.io/controller-runtime/tools/[email protected]
go: sigs.k8s.io/controller-runtime/tools/[email protected]: module sigs.k8s.io/[email protected] found, but does not contain package sigs.k8s.io/controller-runtime/tools/setup-envtest

Is possible start doing proper version for multimodule repository where tag contains path to submodule too? Ideally if you create release v0.16.4, you will create tag tools/setup-envtest/v0.16.4 too.

go install github.com/lukas016/controller-runtime/tools/setup-envtest@tools/setup-envtest/v0.16.3
go: finding module for package sigs.k8s.io/controller-runtime/tools/setup-envtest/remote
go: finding module for package sigs.k8s.io/controller-runtime/tools/setup-envtest/workflows
...

lukas016 avatar Jan 10 '24 18:01 lukas016

/kind support

troy0820 avatar Jan 10 '24 22:01 troy0820

There is a work around for this as main isn't versioned along with tools/setupenv-tools. https://github.com/kubernetes-sigs/controller-runtime/issues/1670#issuecomment-1010602287

I'm not sure the impact of now bundling the new tag you request for setup-envtest to coincide with the controller-runtime's release process. I'm not aware of anything needing to change which why this needs to be hard to coordinate this with the current release process.

troy0820 avatar Jan 10 '24 22:01 troy0820

@troy0820 can i ask you why it isn't store in separate repository? I checked https://github.com/kubernetes-sigs/controller-runtime/blob/main/tools/setup-envtest/go.sum and i don't see any dependencies to controller-runtime library. It can be easy manage this tool in separate repo and we can follow standard versioning for golang tools.

lukas016 avatar Jan 11 '24 07:01 lukas016

@lukas016 I can't answer that question as I'm not a maintainer of controller-runtime. However, I believe this may have been a side effect of it having it's own go.mod and being embedded in this repository. There are ways to do multimodule version for releases and that may still be an option to satisfy this issue.

troy0820 avatar Feb 02 '24 15:02 troy0820

@vincepri can ask you why setup-env is part of this repo and it doesn't have own repo? thx

lukas016 avatar Feb 02 '24 17:02 lukas016

@alvaroaleman can we discuss proper versioning of setup-env with separate tags for keep compatibility with go install or maybe other options?

lukas016 avatar Mar 09 '24 20:03 lukas016

There is a work around for this as main isn't versioned along with tools/setupenv-tools. #1670 (comment)

I've also hit that issue and the workaround while working it's cumbersome to use. Ideally we'd be able to simply run go install sigs.k8s.io/controller-runtime/tools/setup-envtest@WHATEVER and have setup-envtest installed.

The introduction of tags in the issue description would be a rather cheap way of achieving that (compared to let's say moved the tool to a separate repo and paying the maintenance costs of that).

pmalek avatar Mar 26 '24 12:03 pmalek

I've encountered the same issue, the method mentioned in this issue regarding tags is very simple and elegant. By synchronously creating the 'tools/setup-envtest/vX.Y.Z' tag, one can easily install it using go install sigs.k8s.io/controller-runtime/tools/[email protected] Before such tags are created, a workaround can be utilized via go install sigs.k8s.io/controller-runtime/tools/setup-envtest@BRANCH. For instance go install sigs.k8s.io/controller-runtime/tools/[email protected]

Yesphet avatar Apr 02 '24 14:04 Yesphet

Hey folks, we are currently experimenting a bit on setup-envtest because the envtest binaries are today hosted on the Google-owned kubebuilder repository.

Going forward we will start hosting the envtest binaries on controller-tools releases. We currently also plan to move setup-envtest to controller-tools as it fits better there. As part of that we will build & publish the setup-envtest binary on controller-tools releases in the future. This should also give proper versioning.

sbueringer avatar Apr 19 '24 14:04 sbueringer

@sbueringer could you pls keep compatibility with go install? I like this way.

lukas016 avatar Apr 19 '24 20:04 lukas016

@lukas016 There are no plans to break go install (just has to be run against controller-tools instead of controller-runtime).

sbueringer avatar Apr 22 '24 18:04 sbueringer

Potentially this issue will just get rid of the additional module: https://github.com/kubernetes-sigs/controller-runtime/issues/2790

Then setup-envtest can be automatically installed with the CR version and there would be no need to move it to the controller-tools repo.

sbueringer avatar May 06 '24 18:05 sbueringer

Not sure if this issue still relevant or not with the changes that went in or with the workaround in the comment that I mentioned.

troy0820 avatar Jun 03 '24 21:06 troy0820

I think still okay to keep it open for now. I think two things would entirely solve it eventually

  • getting rid of the separate module or
  • attaching setup-envtest binaries to CR releases

the 2nd one is on my TODO list, just not much bandwidth atm

sbueringer avatar Jun 04 '24 11:06 sbueringer

The second one is now implemented.

Quoting my comment from another issue

Now starting with the v0.19 release setup-envtest binaries are available via release attachments (see e.g. https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.19.0) I would recommend using these binaries if:

  • a specific setup-envtest version is required
  • folks have trouble compiling the binary themselves https://github.com/kubernetes-sigs/controller-runtime/issues/2744#issuecomment-2290805873

/close

sbueringer avatar Aug 15 '24 07:08 sbueringer

@sbueringer: Closing this issue.

In response to this:

The second one is now implemented.

Quoting my comment from another issue

Now starting with the v0.19 release setup-envtest binaries are available via release attachments (see e.g. https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.19.0) I would recommend using these binaries if:

  • a specific setup-envtest version is required
  • folks have trouble compiling the binary themselves https://github.com/kubernetes-sigs/controller-runtime/issues/2744#issuecomment-2290805873

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

k8s-ci-robot avatar Aug 15 '24 07:08 k8s-ci-robot