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

Upgrade client-go 11.0.0→11.0.0+patches, consul 1.4.4→1.5.0 #172

Merged
merged 5 commits into from Sep 9, 2019

Conversation

LukeShu
Copy link
Contributor

@LukeShu LukeShu commented Sep 2, 2019

A while back, I tried upgrading client-go to v12 (kube 1.15) in teleproxy.git, mostly just as an exercise to see how difficult it would be, not because I actually wanted to switch to v12. I failed to do it, and ended up in dependency hell. I came to the conclusion that trying to manage client-go's dependencies and your own dependencies at the same time was a nightmare, and that it would be a good idea to have a separate library just to isolate the dependencies of client-go.

I made that library! https://github.com/datawire/libk8s. Currently, it does nothing but anonymous-import every part of client-go, and properly declare all of the versions of dependencies.

Spoilers: There are probably 2 more reasons that extra-contributed to my trouble:

  • client-go v12 claims to be a valid Go module, but isn't. The fact that the Go 1.12 compiler accepts it is a bug in the compiler (the Go 1.13 compiler does not) proxy.golang.org returning 410 for k8s.io/client-go@v12.0.0+incompatible golang/go#33558 (comment) . I was using Go 1.12.7, but I figure this didn't help
  • It got really confused about consul. If you try to resolve a package in github.com/hashicorp/consul/api/..., it discovers "yeah, there's a github.com/hashicorp/consul/api module (that is a sub-module of github.com/hashicorp/consul)!" But it didn't become a sub-module until consul v1.5.0; we're using v1.4.4, in which it wasn't split off yet. The whole thing confuses go mod tidy.

Also, we'd been using the v11.0.0 tag of client-go. Did you know that there's a release-11.0 branch that gets bug-fixes and security fixes!?

OK, so this PR is about equal parts of several things:

  • Try out using https://github.com/datawire/libk8s to manage the dependency on client-go.
  • Try out upgrading client-go (still v11, but with a few commits from the release-11.0 branch)
  • Figure out why the hell go mod tidy was breaking the build (answer: consul)
  • I tried upgrading the version of the teleproxy library that APro uses, and got some weird error. Hopefully this fixes it.

 1. Edit ./pkg/consulwatch/*.go
    to use     github.com/hashicorp/consul/api/watch
    instead of github.com/hashicorp/consul/watch

 2. Edit ./pkg/k8s/client.go to do an anonymous import of
    github.com/datawire/libk8s.

 3. Remove the k8s.io "replace" lines from go.mod

 4. Run:

        go mod edit \
           -require=github.com/hashicorp/consul@v1.5.0 \
           -require=github.com/hashicorp/consul/api@v1.1.0 \
           -require=github.com/hashicorp/consul/sdk@v0.1.1 \
We no longer have a dependency that tries to bring in the problematic
version.
Copy link
Contributor

@ark3 ark3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo Mac CI breakage...

@LukeShu LukeShu merged commit abaf7a3 into master Sep 9, 2019
@LukeShu LukeShu deleted the lukeshu/libk8s branch September 9, 2019 18:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants