You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran operator-sdk create api --group=cache --version=v1alpha1 --kind=Memcached --controller --resource. (This is after running operator-sdk init --domain=example.com --repo=github.com/example/memcached-operator and setting GO111MODULE=on.)
What did you expect to see?
When I got it working, I saw this:
~ operator-sdk create api --group=cache --version=v1alpha1 --kind=Memcached --controller --resource
Writing scaffold for you to edit...
api/v1alpha1/memcached_types.go
controllers/memcached_controller.go
Running make:
$ make
/Users/bwoolf/dev/memcached-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
go build -o bin/manager main.go
To get this to work, I had to import these packages after I initialized my environment but before I created the API:
~ go get github.com/go-logr/logr@v0.3.0
~ go get github.com/onsi/ginkgo@v1.14.1
~ go get github.com/onsi/gomega@v1.10.2
It looks like the operator-sdk requires these packages and should include them as part of its install.
What did you see instead? Under which circumstances?
When I first ran it, I saw this:
~ operator-sdk create api --group=cache --version=v1alpha1 --kind=Memcached --controller --resource
Writing scaffold for you to edit...
api/v1alpha1/memcached_types.go
controllers/memcached_controller.go
Running make:
$ make
/Users/bwoolf/dev/memcached-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
Error: go [-e -json -compiled=true -test=false -export=false -deps=true -find=false -tags ignore_autogenerated -- ./...]: exit status 1: go: github.com/example/memcached-operator/controllers: package github.com/go-logr/logr imported from implicitly required module; to add missing requirements, run:
go get github.com/go-logr/logr@v0.3.0
Usage:
controller-gen [flags]
...
I recreated my environment, ran go get github.com/go-logr/logr@v0.3.0, then ran operator-sdk create api again and got this:
~ operator-sdk create api --group=cache --version=v1alpha1 --kind=Memcached --controller --resource
Writing scaffold for you to edit...
api/v1alpha1/memcached_types.go
controllers/memcached_controller.go
Running make:
$ make
/Users/bwoolf/dev/memcached-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
go: github.com/example/memcached-operator/controllers: package github.com/onsi/ginkgo imported from implicitly required module; to add missing requirements, run:
go get github.com/onsi/ginkgo@v1.14.1
go: github.com/example/memcached-operator/controllers: package github.com/onsi/gomega imported from implicitly required module; to add missing requirements, run:
go get github.com/onsi/gomega@v1.10.2
make: *** [vet] Error 1
Error: failed to create API with "go.kubebuilder.io/v3": exit status 2
Usage:
operator-sdk create api [flags]
...
It looks like operator-sdk create api fails because it's missing three packages:
github.com/go-logr/logr@v0.3.0
github.com/onsi/ginkgo@v1.14.1
github.com/onsi/gomega@v1.10.2
Environment
Operator type:
/language go
Kubernetes cluster type:
~ oc version
Client Version: 4.6.16
Server Version: 4.5.31
Kubernetes Version: v1.18.3+e574db2
$ operator-sdk version
~ operator-sdk version
operator-sdk version: "v1.4.2", commit: "4b083393be65589358b3e0416573df04f4ae8d9b", kubernetes version: "v1.19.4", go version: "go1.15.8", GOOS: "darwin", GOARCH: "amd64"
This is an issue because you're using Go 1.16, which no longer automatically updates go.mod and go.sum as side effects of go build, go install, go test, etc.
Bug Report
What did you do?
I ran
operator-sdk create api --group=cache --version=v1alpha1 --kind=Memcached --controller --resource
. (This is after runningoperator-sdk init --domain=example.com --repo=github.com/example/memcached-operator
and settingGO111MODULE=on
.)What did you expect to see?
When I got it working, I saw this:
To get this to work, I had to import these packages after I initialized my environment but before I created the API:
It looks like the operator-sdk requires these packages and should include them as part of its install.
What did you see instead? Under which circumstances?
When I first ran it, I saw this:
I recreated my environment, ran
go get github.com/go-logr/logr@v0.3.0
, then ranoperator-sdk create api
again and got this:It looks like
operator-sdk create api
fails because it's missing three packages:Environment
Operator type:
/language go
Kubernetes cluster type:
~ oc version Client Version: 4.6.16 Server Version: 4.5.31 Kubernetes Version: v1.18.3+e574db2
$ operator-sdk version
$ go version
(if language is Go)~ go version go version go1.16 darwin/amd64
$ kubectl version
Possible Solution
The operator-sdk needs to import these three packages when it's installed:
Additional context
None.
The text was updated successfully, but these errors were encountered: