dep are you using (dep version)?
0.3.1
dep command did you run?Dep does not seem to import kubernetes/client-go code correctly. After stubbing my toe a bit on this with more complex examples, I decided to simplify and see if I could get it working with the very basic example code at https://github.com/kubernetes/client-go/blob/release-4.0/examples/in-cluster-client-configuration/main.go
I used the following Gopkg.toml file:
[[constraint]]
name = "k8s.io/client-go"
version = "4.0.0"
After getting the code in place and running dep ensure, I get the following errors when trying to compile the code:
# github.com/drud/site-manager/vendor/k8s.io/client-go/tools/clientcmd/api
vendor/k8s.io/client-go/tools/clientcmd/api/register.go:35:11: cannot use Config literal (type *Config) as type runtime.Object in argument to scheme.AddKnownTypes:
*Config does not implement runtime.Object (missing DeepCopyObject method)
# github.com/drud/site-manager/vendor/k8s.io/client-go/pkg/apis/authentication
vendor/k8s.io/client-go/pkg/apis/authentication/register.go:47:16: cannot use TokenReview literal (type *TokenReview) as type runtime.Object in argument to scheme.AddKnownTypes:
*TokenReview does not implement runtime.Object (missing DeepCopyObject method)
<a few hundred similar lines>
I also tried with this additional constraint, which I've seen listed as required in a few different places. I had similar (nonworking) results.
[[override]]
name = "k8s.io/apimachinery"
branch = "version-1.7"
Originally I was thinking client-go or one of it's dependencies was just broken, so I decided to give it a try with glide. I was able to get the exammple working with the following glide.yaml:
package: github.com/some/project
import:
- package: k8s.io/client-go
version: v4.0.0
And finally, I'm not sure if they are useful here, but this is the result of dep hash-inputs:
k8s.io/client-go
svc-^4.0.0
-IMPORTS/REQS-
k8s.io/apimachinery/pkg/api/errors
k8s.io/apimachinery/pkg/apis/meta/v1
k8s.io/client-go/kubernetes
k8s.io/client-go/rest
-IGNORES-
-OVERRIDES-
-ANALYZER-
dep
1
I'm happy to provide the .lock files generated by both dep and glide if that would be helpful. This seems like it may be related to https://github.com/golang/dep/issues/1124.
Thanks for all the effort going into making dep awesome!
hi! and ugh, sorry for slow response - i'd flipped a switch in my mind that said "this is subsumed by #1124, and doesn't need to be addressed separately." and, while i expect that a satisfactory solution to #1124 would result in this not being a problem, this should still be able to be addressed today.
it's quite likely that your issue is with some dependency of k8s.io/client-go - indeed, possibly k8s.io/apimachinery. the [[constraint]] you added on it won't have any effect unless it's a direct dependency of your own project. but, hard to be sure, so yeah - if you could provide the Gopkg.lock (and contrast with the glide.lock that did work), that'd be super helpful 😄
Hi, I have this same issue. I tried adding the constraint for apimachinnery in the toml file, and update the lock file to the right branch/revision, but it did not work either. I've attached the original files generated by dep.
As commented in https://github.com/kubernetes/client-go/issues/298 ,
[[override]]
name = "github.com/ugorji/go"
revision = "8c0409fcbb70099c748d71f714529204975f6c3f"
in Gopkg.toml makes dep ensure pull the right files. I had this same problem and that solution worked for me.
Thanks, that worked for me.
Hi all - I've created a little tool 'godep-to-dep' to try and make this easier/fix it upstream https://github.com/munnerz/godep-to-dep
If we can integrate this tool with our release process, we should be able to ship Gopkg.toml files out of the box.
v6.0.0 appears to be working via dep for me now, not sure if it's by design or luck.
[[constraint]]
name = "k8s.io/client-go"
version = "v6.0.0"
It's because they swapped out ugorji for a different library. 😀
What is the current status of this issue?
I am currently getting this error trying to use dep to install k8s.io/client-go/tools/clientcmd
See below:
dep ensure -add k8s.io/client-go/tools/clientcmd
Fetching sources...
Failed to add the dependencies:
✗ could not infer project root from dependency path: k8s.io/client-go/tools/clientcmd: unable to deduce repository and source type for "k8s.io/client-go/tools/clientcmd": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/client-go/tools/clientcmd?go-get=1": Get https://k8s.io/client-go/tools/clientcmd?go-get=1: net/http: TLS handshake timeout
adding dependencies failed
See also:
dep ensure -add k8s.io/client-go/tools/clientcmd.git
Fetching sources...
Failed to add the dependencies:
✗ failed to fetch source for k8s.io/client-go/tools/clientcmd.git: no valid source could be created:
failed to set up sources from the following URLs:
https://k8s.io/client-go/tools/clientcmd.git
: remote repository at https://k8s.io/client-go/tools/clientcmd.git does not exist, or is inaccessible: fatal: repository 'https://kubernetes.io/client-go/tools/clientcmd.git/' not found
: exit status 128
failed to set up sources from the following URLs:
ssh://k8s.io/client-go/tools/clientcmd.git
: remote repository at ssh://k8s.io/client-go/tools/clientcmd.git does not exist, or is inaccessible: ssh: connect to host k8s.io port 22: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
: exit status 128
failed to set up sources from the following URLs:
git://k8s.io/client-go/tools/clientcmd.git
: remote repository at git://k8s.io/client-go/tools/clientcmd.git does not exist, or is inaccessible: fatal: unable to connect to k8s.io:
k8s.io[0: 23.236.58.218]: errno=Operation timed out
: exit status 128
failed to set up sources from the following URLs:
http://k8s.io/client-go/tools/clientcmd.git
: remote repository at http://k8s.io/client-go/tools/clientcmd.git does not exist, or is inaccessible: fatal: repository 'https://kubernetes.io/client-go/tools/clientcmd.git/' not found
: exit status 128
adding dependencies failed
The above workarounds don't seem to work these days because of #1306. Ignore me, v7.0.0 actually moves the packages around a lot, and the way dep works by sniffing imports meant that it was actually complaining about my imports.
It appears your own code is not up to date with recent versions of the
codebase. You'll need to update your code to compile against client-go
7.0.0 (or at least, all your code should reference valid packages @ that
dependency version).
TL;DR: replace all k8s.io/pkg/api with k8s.io/api imports (their new home).
Btw - easiest way to start this process would be to remove your vendor dir
and check out the versions of k8s.io/* you want to use on your gopath.
Future upgrades won't be as bad - but because your own code is relying on
such an old v of k8s.Io/*, more significant work is required!
On Sat, 9 Jun 2018 at 02:21, Alexander Staubo notifications@github.com
wrote:
The above workarounds don't seem to work these days because of #1306
https://github.com/golang/dep/issues/1306:Solving failure: No versions of k8s.io/client-go met constraints:
v7.0.0: Could not introduce k8s.io/[email protected], as its subpackage k8s.io/client-go/pkg/api/v1 is missing. (Package is required by (root).)
[...]Very frustrating.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/golang/dep/issues/1207#issuecomment-395929229, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAMbP2pUvJAZjM2MHLh8ShG1ZNogJNapks5t6yMAgaJpZM4PhPIg
.
@munnerz Thanks, you're right. I edited my comment after I realized that I was referencing packages that had been moved. (I've never liked Dep's behaviour, where it reads your imports to determine your dependencies, as opposed to requiring explicit declarations in Gopkg.toml. Because it should at least be able to give me an understandable error message, and tell me which files tried to import the non-existent package.)
Most helpful comment
As commented in https://github.com/kubernetes/client-go/issues/298 ,
in
Gopkg.tomlmakesdep ensurepull the right files. I had this same problem and that solution worked for me.