datawire / teleproxy

18 stars 9 forks source link

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

Closed LukeShu closed 5 years ago

LukeShu commented 5 years ago

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) https://github.com/golang/go/issues/33558#issuecomment-519752813 . 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: