kubebuilder: quickstart fails during go vet step

So i’m on a mac trying to go through the quickstart. I installed kubebuilder following the instructions but I get the following error during kubebuilder init:

$ kubebuilder init --domain k8s.io --license apache2 --owner "The Kubernetes Authors"
Run `dep ensure` to fetch dependencies (Recommended) [y/n]?
y
dep ensure
Solving failure: package k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1 does not exist within project k8s.io/client-go
2019/04/17 17:48:45 exit status 1

Then I cloned the client-go repo to $GOPAHT/src/k8s.io/ and tried again, only this time I got:

$ kubebuilder init --domain k8s.io --license apache2 --owner "The Kubernetes Authors"
Run `dep ensure` to fetch dependencies (Recommended) [y/n]?
y
dep ensure
Running make...
make
go generate ./pkg/... ./cmd/...
go fmt ./pkg/... ./cmd/...
go vet ./pkg/... ./cmd/...
# k8s.io/client-go/rest
../../../../../pkg/mod/k8s.io/client-go@v11.0.0+incompatible/rest/request.go:598:31: not enough arguments in call to watch.NewStreamWatcher
	have (*versioned.Decoder)
	want (watch.Decoder, watch.Reporter)
make: *** [vet] Error 2
2019/04/17 17:52:50 exit status 2

/kind bug

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

I had this issue and was able to fix with with go-modules by having my go.mod file contain:

go 1.12

replace (
	k8s.io/api => k8s.io/api v0.0.0-20190222213804-5cb15d344471
	k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190221221350-bfb440be4b87
	k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190221213512-86fb29eff628
	k8s.io/client-go => k8s.io/client-go v10.0.0+incompatible
)

huh. That’s like the universal package manager trick: “when in doubt, clear the package cache”.

Came here from getting a similar issue when trying to build the kubernetes client-go examples (https://github.com/kubernetes/client-go/blob/master/examples/in-cluster-client-configuration/main.go).

The version from @runyontr work for me!

It appears the dep doesn’t always work well. We are actively working on enable go modules for all 3 kubebuilder repos.