Client-go: Compile fails due to apimachinery change

Created on 5 Jul 2017  Â·  23Comments  Â·  Source: kubernetes/client-go

Now that client-go is using apimachinery (which I wholeheartedly appreciate), upstream changes can break compile. The current compile failure was caused by this commit:
https://github.com/kubernetes/apimachinery/commit/6c263f33a6b401d0718c5c5774b5f7ab8daa8488#diff-fb24371e396c1f62cf28521fd747ffa1

client-go depends on those deleted functions in a number of places:
pkg/apis/authentication/v1/defaults.go:24
pkg/apis/authorization/v1/defaults.go:24
pkg/apis/authentication/v1beta1/defaults.go
pkg/apis/authorization/v1beta1/defaults.go:24
pkg/apis/certificates/v1beta1/defaults.go:23
pkg/api/defaults.go:26
pkg/apis/rbac/v1beta1/defaults.go:25
pkg/apis/rbac/v1alpha1/defaults.go:25

lifecyclrotten

Most helpful comment

This stuff is so stupidly difficult to get set up at the moment.... I can't even find a set of versions that compile any more, even with my old Gopkg.toml

All 23 comments

Please double check that you have vendored the right version of your
dependencies.

A given client-go branch/commit will likely only be compatible with the
dependency versions that are in its Godeps.json.

Eventually we will have better version compatibility stories for repos like
apimachinery but the paint is still wet.

On Tue, Jul 4, 2017 at 3:35 PM, Joseph Schneider notifications@github.com
wrote:

Now that client-go is using apimachinery (which I wholeheartedly
appreciate), upstream changes can break compile. The current compile
failure was caused by this commit:
kubernetes/apimachinery@6c263f3#diff-fb24371e396c1f62cf28521fd747ffa1
https://github.com/kubernetes/apimachinery/commit/6c263f33a6b401d0718c5c5774b5f7ab8daa8488#diff-fb24371e396c1f62cf28521fd747ffa1

client-go depends on those deleted functions in a number of places:
pkg/apis/authentication/v1/defaults.go:24
pkg/apis/authorization/v1/defaults.go:24
pkg/apis/authentication/v1beta1/defaults.go
pkg/apis/authorization/v1beta1/defaults.go:24
pkg/apis/certificates/v1beta1/defaults.go:23
pkg/api/defaults.go:26
pkg/apis/rbac/v1beta1/defaults.go:25
pkg/apis/rbac/v1alpha1/defaults.go:25

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/client-go/issues/232, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAngljtSxiPbSdWRKYQRjjxXvOtfxTxSks5sKr5LgaJpZM4ONuAu
.

I am seeing the same problem.

[[constraint]]
name = "k8s.io/client-go"
version="4.0.0-beta.0"

[[constraint]]
revision="abe34e4f5b4413c282a83011892cbeea5b32223b"
name = "k8s.io/apimachinery"

Results in:

$ go build

github.com/folago/nird-lb/vendor/k8s.io/api/core/v1

vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:897: in.ObjectMeta.DeepCopyInto undefined (type v1.ObjectMeta has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1013: in.ObjectMeta.DeepCopyInto undefined (type v1.ObjectMeta has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1079: in.ObjectMeta.DeepCopyInto undefined (type v1.ObjectMeta has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1440: in.StartedAt.DeepCopyInto undefined (type v1.Time has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1457: in.StartedAt.DeepCopyInto undefined (type v1.Time has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1458: in.FinishedAt.DeepCopyInto undefined (type v1.Time has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1788: in.ObjectMeta.DeepCopyInto undefined (type v1.ObjectMeta has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1967: in.ObjectMeta.DeepCopyInto undefined (type v1.ObjectMeta has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1970: in.FirstTimestamp.DeepCopyInto undefined (type v1.Time has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1971: in.LastTimestamp.DeepCopyInto undefined (type v1.Time has no field or method DeepCopyInto)
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go:1971: too many errors

Should some file be regenerated?
Is this documented somewhere and i missed it?

@folago were you able to resolve your issue?

No, but the head revisions of client-go and apimachinery worked so I pinned those with dep.

@folago Could you tell me which head revision fixed the issue?

  • package: k8s.io/client-go
    version: 1850dd66e4213a26bd70d0b85fee4176d324b845
  • package: k8s.io/api
    version: e532fdb5587debfd7aade56dabe9eb5df9544baf
  • package: k8s.io/apimachinery
    version: a13245d02534abe88286859b547d041816f9a3f4
  • package: k8s.io/apiextensions-apiserver
    version: 6d8c23d2e66ce61e2a7e34f92e8eb3eec13279fa

this works.
hope this can be fixed asap in release version.

I had a similar issue and was able to get my code to compile by locking down the following versions using dep to what was in the Godeps.json for tag v3.0.0:

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

[[override]]
  name = "k8s.io/apimachinery"
  revision = "85ace5365f33b16fc735c866a12e3c765b9700f2"

I'm unable to get this to work with any of the pins mentioned in this comment :(. For reference, I'm using glide

@pratikmallya May be this helps?

- package: k8s.io/apimachinery
  version: 12d70001ef0c75fc5a26057ca73d3caf5e2cf682
- package: k8s.io/api
- package: k8s.io/client-go
  version: 45673e060eb921b510677b1123737ad1158e49fa

@jinankjain unfortunately, that doesn't seem to work either. I get a lot of errors like:
[ERROR] Error scanning k8s.io/client-go/util/retry: open /Users/mallya/.glide/cache/src/https-k8s.io-client-go/util/retry: no such file or directory

Just remove your glide cache or update it rm -rf ~/.glide/

On Sep 14, 2017 5:39 PM, "Pratik Mallya" notifications@github.com wrote:

@jinankjain https://github.com/jinankjain unfortunately, that doesn't
seem to work either. I get a lot of errors like:
[ERROR] Error scanning k8s.io/client-go/util/retry: open
/Users/mallya/.glide/cache/src/https-k8s.io-client-go/util/retry: no such
file or directory

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/client-go/issues/232#issuecomment-329616622,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADrSOHXgEA46YgaQAshTkIomu5mjIHh4ks5siZ0OgaJpZM4ONuAu
.

@jinankjain that's the first thing I tried. Those errors are present even after removing the folder (and running glide cc).

I am hitting similar issues, except I need to be using k8s.io/kubernetes 1.8.0-beta.1. Keep getting issues like the following when using the following:

  • k8s.io/client-go

    • c6f8cf2c47d21d55fa0df928291b2580544886c8

  • k8s.io/apimachinery

    • 1168e538ea3ccf444854d1fdd5681d2d876680a7

  • k8s.io/api

    • 0b011bb8613011ab0909c6a759d9d811dc21a156

  • k8s.io/apiextensions-apiserver

    • 2bfb07d318ed549813240d1165fcebad6250c666

  • k8s.io/kubernetes

    • ~1.8.0-beta.1

Is there a way we can see what versions of Kubernetes components work with each other in terms of tags, commits, etc. in some type of table? What are the best practices for using multiple Kubernetes dependencies in the same project?

This stuff is so stupidly difficult to get set up at the moment.... I can't even find a set of versions that compile any more, even with my old Gopkg.toml

I have the following versions working for compilation:

k8s.io/apiextensions-apiserver 8b0133f28359c1325bd4799207a34fd935367ba2
k8s.io/apimachinery b63e1e4b3f7d0681e9a6e15bd4729d3014049e4e
k8s.io/client-go 2554b0b4622d739c8af9da548e8fe2223176803c
k8s.io/kubernetes v1.8.0-beta.1
k8s.io/api a9acc2b601dbe3c7d3782209b99f09b2232bd15a
k8s.io/kube-openapi 80f07ef71bb4f781233c65aa8d0369e4ecafab87

@ianvernon this doesn't seem to work either. Specifically, glide can't seem to fetch all the dependencies

I finally just resorted to using Godeps. Here is my FULL godeps.json (most deps are probably unnecessary): https://gist.github.com/paralin/4e88551a6099d83bf46c20f8f45d973a

I've confirmed this works in a fresh environment, by deleting the vendor dir, and restoring in a completely otherwise blank Go workspace (by building in Docker)

@pratikmallya while I admire what glide tries to do, I think it tries to automate too much of the dependency process and can result in a state that is very hard to debug / fix if something goes wrong. I find vndr to be pretty good for this:

For your interest, when using glide, this works for me.

- package: k8s.io/client-go
  version: v4.0.0
- package: k8s.io/apiextensions-apiserver
  version: release-1.7
- package: k8s.io/apimachinery
  version: release-1.7

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

/close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prestonvanloon picture prestonvanloon  Â·  6Comments

jgrobbel picture jgrobbel  Â·  3Comments

AdheipSingh picture AdheipSingh  Â·  5Comments

strugglingyouth picture strugglingyouth  Â·  5Comments

yashbhutwala picture yashbhutwala  Â·  4Comments