Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github.com/google/gnostic/openapiv2 moved to github.com/google/gnostic-models/openapiv2 #1269

Closed
licat233 opened this issue Jun 15, 2023 · 20 comments

Comments

@licat233
Copy link

~/go/pkg/mod/k8s.io/client-go@v0.27.3/applyconfigurations/meta/v1/unstructured.go:64:38: cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData

@licat233 licat233 changed the title bug in v0.27.3 There are bugs in v0.27.3 Jun 15, 2023
@nyetwurk
Copy link

nyetwurk commented Jun 16, 2023

The title of this ticket is almost entirely useless.

it should be something like github.com/google/gnostic/openapiv2 moved to github.com/google/gnostic-models/openapiv2

@nyetwurk
Copy link

#1075

@nyetwurk
Copy link

@nyetwurk
Copy link

kubernetes/kubernetes#118384

gnostic OpenAPI components were moved to the gnostic-models library. gnostic is pinned on v0.5.7-v3refs because we did not want to capture the additional dependencies introduced with later versions of gnostic. The OpenAPI component has been moved to gnostic-models so update the library path to reflect that.

@miparnisari
Copy link

miparnisari commented Jun 23, 2023

i'm getting

# k8s.io/client-go/applyconfigurations/meta/v1
../../go/pkg/mod/k8s.io/client-go@v0.27.3/applyconfigurations/meta/v1/unstructured.go:64:38: cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData

with

k8s.io/client-go v0.27.3 // indirect

I've managed to workaround this by adding this to go.mod

replace k8s.io/client-go => k8s.io/client-go v0.28.0-alpha.3

@busser
Copy link

busser commented Jun 26, 2023

I had the same issue with client-go as a direct dependency.

The following change to my go.mod fixed the problem:

  require (
    // ...
-   k8s.io/client-go v0.27.3
+   k8s.io/client-go v0.28.0-alpha.3
    // ...
  )

Thanks @miparnisari!

@sosheskaz
Copy link

In my env, this can be solved with a light touch, without using an alpha release of client-go, by running the following:

go get k8s.io/kube-openapi@2546d827e515dca59571ec245eef2302e11018e1 && go mod tidy

Kube-openapi is the entity which injects the dependency on gnostic-models and breaks backwards compatibility. This resets it to the commit before the change to gnostic-models happened.

@yasin-cs-ko-ak
Copy link

Thank you so much for this!!! I was bugging around this like two days.

@troy0820
Copy link
Member

troy0820 commented Jul 5, 2023

Definitely appreciate the workaround

trallnag added a commit to trallnag/kubestatus2cloudwatch that referenced this issue Jul 9, 2023
Done with: go get k8s.io/kube-openapi@2546d827e515dca59571ec245eef2302e11018e1 && go mod tidy

See: kubernetes/client-go#1269
tao12345666333 added a commit to tao12345666333/ingress-controller that referenced this issue Aug 4, 2023
go: downgraded k8s.io/kube-openapi v0.0.0-20230718181711-3c0fae5ee9fd =>
v0.0.0-20230525220651-2546d827e515

ref: kubernetes/client-go#1269

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
@ldemailly
Copy link

ldemailly commented Aug 4, 2023

having the same mystery issue trying to doing some updates, if anyone searches for exact error and want to use the workaround above (which worked, thx!) - my error was:

# k8s.io/client-go/applyconfigurations/meta/v1
../../go/pkg/mod/k8s.io/client-go@v0.25.12/applyconfigurations/meta/v1/unstructured.go:64:38: cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData

@liggitt
Copy link
Member

liggitt commented Aug 4, 2023

Agree that using the specific versions of dependencies like kube-openapi and gnostic matching what is referenced by the client-go version you are using is the correct solution here. See the comment at #1075 (comment) about updating to latest commits of v0 dependencies belong likely to cause issues.

@liggitt liggitt closed this as completed Aug 4, 2023
@ldemailly
Copy link

ldemailly commented Aug 5, 2023

probably a huge faq/can of worm but why isn't k8s using 1.x instead of 0.x go packages where x == k8s 1.x, why not 1.x directly?

I'm aware of issues with go and v2 but... this is not about v2... v0->v1 and v1 updates are still smooth sailing afaik?

@liggitt
Copy link
Member

liggitt commented Aug 5, 2023

The kubernetes project essentially spends all its API compatibility effort budget on maintaining REST API compatibility.

The exported go package APIs don't maintain perfect compatibility across releases (function signatures occasionally change, etc), so we don't want to make a promise about compatibility we don't think we can keep by versioning these go libraries as v1.x

@ldemailly
Copy link

ldemailly commented Aug 5, 2023

ic... it's true to the letter of semver but practically people do expect on MAJOR.MINOR.PATCH that when MINOR changes, something changed, and it would probably be less confusing if MAJOR of go matched MAJOR of k8s (== 1 for the forseable future) like you make MINOR,PATCH match

but thanks though for the rationale (and having taken the time to reply ❤️), it makes sense as well but is a bit too "pure" imo

tao12345666333 added a commit to tao12345666333/ingress-controller that referenced this issue Aug 7, 2023
go: downgraded k8s.io/kube-openapi v0.0.0-20230718181711-3c0fae5ee9fd =>
v0.0.0-20230525220651-2546d827e515

ref: kubernetes/client-go#1269

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
tao12345666333 added a commit to apache/apisix-ingress-controller that referenced this issue Aug 8, 2023
go: downgraded k8s.io/kube-openapi v0.0.0-20230718181711-3c0fae5ee9fd =>
v0.0.0-20230525220651-2546d827e515

ref: kubernetes/client-go#1269

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
xrstf added a commit to xrstf/stalk that referenced this issue Aug 10, 2023
rhmdnd added a commit to rhmdnd/oc-compliance that referenced this issue Sep 14, 2023
Update all the k8s dependencies together. Sometimes when we, or
dependabot, attempt to update dependencies separately, we get build
errors because k8s libraries are expected to run with the same semantic
version. This is noted in kubernetes/client-go#1269

Let's group the k8s dependencies into a single patch so we reduce the
possibility of build issues due to compatibility issues between client
libraries.
damdo added a commit to damdo/cluster-capi-operator that referenced this issue Oct 11, 2023
ran:
// see kubernetes/client-go#1269 (comment)
- go get k8s.io/kube-openapi@2546d827e515dca59571ec245eef2302e11018e1 && go mod tidy
// we need to use a commit hash rather than a point release because
// a new 1.5.0 release is not out yet, but 1.4.0 doesn't work with controller-runtime v0.15.z
// this will need to change to v1.5.0 once it is released.
- go get sigs.k8s.io/cluster-api-provider-gcp@f1ea13261b0f929beca8c65d932046003caa652d && go mod tidy
- go mod vendor
-
@ofey404
Copy link

ofey404 commented Oct 12, 2023

In my env, this can be solved with a light touch, without using an alpha release of client-go, by running the following:

go get k8s.io/kube-openapi@2546d827e515dca59571ec245eef2302e11018e1 && go mod tidy

Kube-openapi is the entity which injects the dependency on gnostic-models and breaks backwards compatibility. This resets it to the commit before the change to gnostic-models happened.

Thank you a lot!

The client-go is pinned to 0.26 in my environment because our web framework (an external dependency) is not migrated to 0.28.

So only your solution works!

ffromani added a commit to ffromani/deployer that referenced this issue Oct 19, 2023
plus controller-runtime, openshift API, scheduler plugins
includes fix per
kubernetes/client-go#1269

Signed-off-by: Francesco Romani <fromani@redhat.com>
ffromani added a commit to ffromani/deployer that referenced this issue Oct 19, 2023
plus controller-runtime, openshift API, scheduler plugins
includes fix per
kubernetes/client-go#1269

Signed-off-by: Francesco Romani <fromani@redhat.com>
@kwenzh
Copy link

kwenzh commented Jan 23, 2024

the same trouble in v0.27.1, change to v0.28.1, it works

 cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData

@shashidhar-patil
Copy link

the same trouble in v0.27.1, change to v0.28.1, it works

 cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData

Facing same issue in v0.28.1 . Can anyone help?

@optik-aper
Copy link

I am seeing this error when upgrading from client-go v0.28.2 to v0.30.2

@licat233 licat233 changed the title There are bugs in v0.27.3 github.com/google/gnostic/openapiv2 moved to github.com/google/gnostic-models/openapiv2 Jun 18, 2024
@chengjingtao
Copy link

chengjingtao commented Oct 23, 2024

in my env, this can be solved by upgrading version of kustomize/api and kustomize/kyaml


k8s.io/client-go v0.31.0 

go get sigs.k8s.io/kustomize/api@v0.17.2
go get sigs.k8s.io/kustomize/kyaml@v0.17.1

In fact, the kustomize version should be same as kustomize version used in https://github.com/kubernetes/kubernetes/blob/master/go.mod

Remember to confirm the version of k8s package you referenced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests