Closed hoyho closed 5 years ago
maybe the problem is that get the incorrect version of Kubernetes@1.13.2
code from gopath/pkg/mod/k8s.io/kubernetes@v1.13.2
i check the latest version of kubernetes at github:
is it? is my go mod get ther wrong kubernetes@v1.13.2?
/cc @bcmills
The problem here is some sort of version skew between the various kubernetes
modules. (See https://github.com/kubernetes/apiextensions-apiserver#compatibility.)
I'm not sure exactly which module is wrong, but it doesn't really matter: you can resolve it by running
go get -m k8s.io/apiserver@kubernetes-1.14.0-alpha.1 k8s.io/apiextensions-apiserver@kubernetes-1.14.0-alpha.1 k8s.io/apimachinery@kubernetes-1.14.0-alpha.1 k8s3io/client-go@kubernetes-1.14.0-alpha.1
thanks @bcmills , you save my day, in my case, also need to upgrade kubernetes
go get -v -m k8s.io/kubernetes@v1.14.0-alpha.1
and add it to go.mod's require
then it build successful
however, i still can't get kubernetes@v1.13.0 or 1.13.2 or else what if i have to use kubernetes@v1.13.0? can I ?
however, i still can't get kubernetes@v1.13.0 or 1.13.2 or else what if i have to use kubernetes@v1.13.0? can I ?
I have no idea. Presumably there is some 1.13 version at which all of the kubernetes
packages are compatible, but are you sure that none of your other dependencies require features introduced in 1.14?
@hoyho
k8s has a relatively complex and non-standard way to manage dependencies including custom wrapper scripts on top of godep
, I think.
If you want to get a consistent set of v1.13.2 dependecies for k8s, one approach you could try is cloning
something like github.com/kubernetes/kubernetes
, and then try to use the dependency information from Godeps.json:
https://github.com/kubernetes/kubernetes/blob/v1.13.2/Godeps/Godeps.json
You might be able to have go mod init
do most of the work for you. For example, could be something along the lines of:
$ git clone https://github.com/kubernetes/kubernetes
$ cd kubernetes/
$ go mod init temp
go: creating new go.mod: module temp
go: copying requirements from Godeps\Godeps.json
$ cat go.mod | wc -l
214
The following FAQ covers the technique in a bit more detail:
Here is a concrete example in https://github.com/golang/go/issues/28489#issuecomment-454795390 of following that technique (for docker, in that example).
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
copy a project to a folder outside of my GOPATH
What did you expect to see?
build successful
What did you see instead?
build fail with output:
content in go.mod:
try to click the link from console error
I try to trace the dependence of apiserver@v0.0.0-20190111033246-d50e9ac5404f+incompatible/pkg/util/feature/feature_gate.go and found there's function Add()..
is the dependence(apiextensions-apiserver@v0.0.0-20190119024419-80a4532647cb) can not find its correct dependence(k8s.io/apiserver/pkg/util/feature)? what 's the main reason it can not build, and how to solve it? thanks