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

compile error (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) #1313

Open
till opened this issue Oct 31, 2023 · 7 comments

Comments

@till
Copy link

till commented Oct 31, 2023

Sorry to revive this. I am using client-go with the e2e-framework (to write tests). When I compile my code, I am stuck on this error:

# k8s.io/client-go/applyconfigurations/meta/v1
/go/pkg/mod/k8s.io/client-go@v0.27.4/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

And after Googling, I found a ticket that references this as a workaround:
#1075 (comment)

But what exactly is one supposed to do to make it run? I did try updating my dependencies to the latest client-go (even though that's not what I want), but that did not help either.

@oshoval
Copy link

oshoval commented Nov 9, 2023

Hi, I used client-go 0.28.3 with
openapi v0.0.0-20230717233707-2695361300d9
and it fix this problem

but then i have other problem that the swagger which is generated is corrupted
(different issue, and not sure it affects you as well)
For visibility, fields are removed and ref is added instead (our implementation used to dereference them)

      "parameters": [
       {
-       "uniqueItems": true,
-       "type": "string",
-       "description": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
-       "name": "continue",
-       "in": "query"
+       "$ref": "#/parameters/continue-tuthsW5V"
       },

@cyclinder
Copy link

I also have an issue like this

# k8s.io/client-go/applyconfigurations/meta/v1
vendor/k8s.io/client-go/applyconfigurations/meta/v1/unstructured.go:64:38: cannot use doc (variable of type *"github.com/google/gnostic-models/openapiv2".Document) as *"github.com/google/gnostic/openapiv2".Document value in argument to proto.NewOpenAPIData
make: *** [build-bin] Error 1
go.mod
	k8s.io/api v0.28.3
	k8s.io/apimachinery v0.28.3
	k8s.io/client-go v0.28.3
	k8s.io/component-base v0.28.3
	k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect

Is there any workarounds?

@andyzhangx
Copy link
Member

reverted to k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect works in my env

@Inikowu
Copy link

Inikowu commented Dec 21, 2023

reverted to k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect works in my env

@shashidhar-patil
Copy link

I am facing the same issue client-go v1.28.1, can anyone help me out ?

@neutrinoxxx
Copy link

Using helm.sh/helm/v3 v3.13.0 and k8s.io/kubectl v0.28.3 should fix this issue.

go.mod

	helm.sh/helm/v3 v3.13.0
	k8s.io/api v0.28.3
	k8s.io/apiextensions-apiserver v0.28.3
	k8s.io/apimachinery v0.28.3
	k8s.io/cli-runtime v0.28.3
	k8s.io/client-go v0.28.3
	sigs.k8s.io/controller-runtime v0.16.5

	k8s.io/kubectl v0.28.3 // indirect

@muicoder
Copy link

Upgrading old and new packages can also solve:

# go get github.com/google/gnostic && go get github.com/google/gnostic-models
go: upgraded github.com/google/gnostic v0.6.9 => v0.7.0
go: upgraded github.com/google/gnostic-models v0.6.8 => v0.6.9-0.20230804172637-c7be7c783f49

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

8 participants