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

Downgrade controller-runtime in go.mod by go get k8s.io/client-go@v12.0.0 #555

Closed
binoue opened this issue Aug 8, 2019 · 9 comments
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@binoue
Copy link

binoue commented Aug 8, 2019

Hi! I am using controller-runtime but encountered the problem below.

  • Problem

    • running the go get k8s.io/client-go@v12.0.0 downgrades controller-runtime from v0.2.0-beta.4 to v0.2.0-alpha.0
    • go get sigs.k8s.io/controller-runtime@v0.2.0-beta.4 returns the error below and also downgrades client-go from v12.0.0 to v11.0.1
  • Error

$ go get sigs.k8s.io/controller-runtime@v0.2.0-beta.4
# k8s.io/client-go/rest
../../../../pkg/mod/k8s.io/client-go@v11.0.1-0.20190409021438-1a26190bd76a+incompatible/rest/request.go:598:31: not enough arguments in call to watch.NewStreamWatcher
	have (*versioned.Decoder)
	want (watch.Decoder, watch.Reporter)

I think this is a bug and the solution below will resolve this bug.

  • Solution
    I think that the current go.mod file in controller-runtime is referring to the invalid client-go version which is k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible.
    So fixing the reference to client-go in go.mod will solve this problem.

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 8, 2019
@DirectXMan12
Copy link
Contributor

It shouldn't be referring to an invalid client-go version -- I believe it's just referring to a matching kubernetes-1.y.z tag, which is more reliable than trying to match the equivalent client-go semver-ish version to the other repos' kubernetes-x.y.z tags. In general, we highly recommend that you don't try to use the semver client-go versions -- you'll cause yourself headaches with the other libraries.

@ymmt2005
Copy link

ymmt2005 commented Aug 9, 2019

@DirectXMan12
It is controller-runtime that references non-existing tag of client-go (v11.0.1) in its go.mod.

Please check existing tags of client-go; v11.0.1 does not exist.
https://github.com/kubernetes/client-go

@DirectXMan12
Copy link
Contributor

right, that's a pseudo-version that got converted over from a real tag. If you say k8s.io/client-go kubernetes-1.14.1 in your go.mod file, and then run go mod tidy, Go will convert that non-semver tag (kubernetes-1.14.1) into a pseudo-version (k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible) using an algorithm detailed in https://tip.golang.org/cmd/go/#hdr-Pseudo_versions.

It does this so that it can continue to compare versions using a uniform algorithm. So, we set all kubernetes dependencies to kubernetes-1.14.1. This is the best way to make sure you don't have any weird conflicts. Then, go mod tidy converts those to pseudo-versions. Such is life when most of the k8s.io/ dependencies don't use semver.

Trying to set client-go to a semver version, and everything else to non-semver has cause a lot of issues in the past. It's not a good idea. Again, we highly recommend that you avoid using the semver versions of client-go -- there's no real benefit, and they'll only cause you issues down the road.

@DirectXMan12
Copy link
Contributor

We'll update to kubernetes-1.15.x tags shortly after we release v0.2.0 final. At that point, we'll address any incompatibilities.

@DirectXMan12
Copy link
Contributor

DirectXMan12 commented Aug 9, 2019

(closing for now, but if there's something you don't understand, feel free to continue to ask questions. In the mean time, I'd highly recommend that you give the Go modules wiki page a read-through -- Go modules exhibit so behavior that looks strange on the surface)

@ymmt2005
Copy link

ymmt2005 commented Aug 9, 2019

@DirectXMan12 Got it. Many thanks!

@binoue
Copy link
Author

binoue commented Aug 9, 2019

@DirectXMan12 Appreciated!

@ymmt2005
Copy link

ymmt2005 commented Aug 9, 2019

BTW, client-go officially says that it should be got with its semver.

go get k8s.io/client-go@v12.0.0

https://github.com/kubernetes/client-go/blob/master/INSTALL.md#go-modules

@DirectXMan12
Copy link
Contributor

DirectXMan12 commented Aug 9, 2019

Yeah. We used to try to do that at various points in the past. It invariably caused headaches after a bit. It might be better with modules, but it's more reliably correct to use a uniform tag across all of them.

DirectXMan12 pushed a commit that referenced this issue Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants