Minikube: Change dependency management from godep to dep

Created on 2 Aug 2018  路  9Comments  路  Source: kubernetes/minikube

Looks like we are still using godep which is way older and not in active maintenance. I think we should switch to dep which right now in active development and maintenance.

arebuild-release arecode-deps kincleanup lifecyclactive

Most helpful comment

@praveenkumar I don't think it is something I can generate a PR for, as everyone's Gopkg.toml will be different, but if you paste the following:

[[constraint]]
  name = "k8s.io/api"
  version = "kubernetes-1.11.2"

[[constraint]]
  name = "k8s.io/apimachinery"
  version = "kubernetes-1.11.2"

[[constraint]]
  name = "k8s.io/client-go"
  version = "8.0.0"

and do a dep ensure, things should build as normal. Those are the current 1.11.x versions at this time, so if anyone plugging the error into Google finds this(this thread is the top hit as of last week), they may be different.

All 9 comments

Looks like some issue when doing dep init for the project, need to look bit more.

$ dep init
Importing configuration from glide. These are only initial constraints, and are further refined during the solve process.
init failed: unable to solve the dependency graph: Solving failure: No versions of github.com/google/go-containerregistry met constraints:
    master: Could not introduce github.com/google/go-containerregistry@master due to multiple problematic subpackages:
    Subpackage github.com/google/go-containerregistry/authn is missing. (Package is required by (root).)    Subpackage github.com/google/go-containerregistry/name is missing. (Package is required by (root).) Subpackage github.com/google/go-containerregistry/v1/remote is missing. (Package is required by (root).)    Subpackage github.com/google/go-containerregistry/v1/tarball is missing. (Package is required by (root).)
    add-the-tip: Could not introduce github.com/google/go-containerregistry@add-the-tip due to multiple problematic subpackages:
    Subpackage github.com/google/go-containerregistry/name is missing. (Package is required by (root).) Subpackage github.com/google/go-containerregistry/v1/remote is missing. (Package is required by (root).)    Subpackage github.com/google/go-containerregistry/v1/tarball is missing. (Package is required by (root).)   Subpackage github.com/google/go-containerregistry/authn is missing. (Package is required by (root).)

After creating the vendor directory from the dep side looks like now have different problem :(

$ make
GOPATH=/home/prkumar/work/github/practice/go ./makedepend.sh out/docker-machine-driver-kvm2 k8s.io ./cmd/drivers/kvm/  > out/docker-machine-driver-kvm2.d
GOPATH=/home/prkumar/work/github/practice/go ./makedepend.sh out/storage-provisioner k8s.io ./cmd/storage-provisioner  > out/storage-provisioner.d
GOPATH=/home/prkumar/work/github/practice/go ./makedepend.sh out/docker-machine-driver-hyperkit k8s.io ./cmd/drivers/hyperkit  > out/docker-machine-driver-hyperkit.d
which go-bindata || GOBIN=/home/prkumar/work/github/practice/go/bin go get github.com/jteeuwen/go-bindata/...
/home/prkumar/work/github/practice/go/bin/go-bindata
PATH="/home/prkumar/work/github/practice/go/bin:/usr/libexec/python3-sphinx:/usr/lib64/qt-3.3/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/prkumar/.local/bin:/home/prkumar/bin:/home/prkumar/work/github/practice/go/bin" go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/...
GOPATH=/home/prkumar/work/github/practice/go ./makedepend.sh -t test k8s.io ./... pkg/minikube/assets/assets.go > out/test.d
GOPATH=/home/prkumar/work/github/practice/go ./makedepend.sh out/minikube-linux-amd64 k8s.io ./cmd/minikube/ pkg/minikube/assets/assets.go > out/minikube.d
GOOS=linux GOARCH=amd64 go build -tags "container_image_ostree_stub containers_image_openpgp" -ldflags="-X k8s.io/minikube/pkg/version.version=v0.28.2 -X k8s.io/minikube/pkg/version.isoVersion=v0.28.1 -X k8s.io/minikube/pkg/version.isoPath=minikube/iso" -a -o out/minikube-linux-amd64 k8s.io/minikube/cmd/minikube
# k8s.io/minikube/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1
vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/zz_generated.conversion.go:39:15: scheme.AddGeneratedConversionFuncs undefined (type *runtime.Scheme has no field or method AddGeneratedConversionFuncs)
# k8s.io/minikube/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1
vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go:39:15: scheme.AddGeneratedConversionFuncs undefined (type *runtime.Scheme has no field or method AddGeneratedConversionFuncs)
make: *** [Makefile:106: out/minikube-linux-amd64] Error 2

it could be they apply fixes on top of the vendor. might this be the cause
of this?

It is because dep isn't able to pick up the internal dependencies of k8s.io/client-go. You need to explicitly pin the correct versions of k8s.io/api and k8s.io/apimachinery in Gopkg.toml. For example,

[[constraint]]
  name = "k8s.io/api"
  version = "kubernetes-1.11.x"

[[constraint]]
  name = "k8s.io/apimachinery"
  version = "kubernetes-1.11.x"

[[constraint]]
  name = "k8s.io/client-go"
  version = "8.0.0"

Depending on your version of k8s.io/client-go, the version of the other two will change.

@jlnaps I will try that also and let you know. By any chance if you are able to do it successfully can you send PR?

@praveenkumar I don't think it is something I can generate a PR for, as everyone's Gopkg.toml will be different, but if you paste the following:

[[constraint]]
  name = "k8s.io/api"
  version = "kubernetes-1.11.2"

[[constraint]]
  name = "k8s.io/apimachinery"
  version = "kubernetes-1.11.2"

[[constraint]]
  name = "k8s.io/client-go"
  version = "8.0.0"

and do a dep ensure, things should build as normal. Those are the current 1.11.x versions at this time, so if anyone plugging the error into Google finds this(this thread is the top hit as of last week), they may be different.

@jlnaps just wanted to say thanks for your reply. I came here from the top result of Google and was able to get working on 1.10 cluster with the following:

[[override]]
  name = "k8s.io/api"
  version = "kubernetes-1.10.7"

[[override]]
  name = "k8s.io/apimachinery"
  version = "kubernetes-1.10.7"

[[constraint]]
  name = "k8s.io/client-go"
  version = "7.0.0"

I think we should change to dep. I tried once and got stuck, but I'll happily take a PR that gets us there :)

Awesome. @praveenkumar and I spoke recently with @balopat and agreed godep
for now is the way to go. Although 1.11 will offer vgo, it would be too
early to adapt this... and aligning between minishift and minikube at this
stage is more important.

Was this page helpful?
0 / 5 - 0 ratings