apache / rocketmq-operator

Apache RocketMQ Operator
https://rocketmq.apache.org/
Apache License 2.0
310 stars 126 forks source link

rocketmq-operator/bin/controller-gen: No such file or directory #130

Closed koalawangyang closed 1 year ago

koalawangyang commented 1 year ago

error "rocketmq-operator/bin/controller-gen: No such file or directory" displayed when run command "make deploy" on the latest version.

I have installed all the requirements below: git、go、mercurial、docker、kubectl、dep、operator-sdk

and I have searched this error, but only few people asked. So I have to submit this issue.

Please kindly help~

koalawangyang commented 1 year ago

detailed error:

/root/rocketmq-operator/bin/controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:dir=deploy output:crd:artifacts:config=deploy/crds bash: /root/rocketmq-operator/bin/controller-gen: No such file or directory make: *** [manifests] Error 1

caigy commented 1 year ago

Please run go version to check the version of Golang, the main version should be 1.16. Idealy controller-gen should be installed when running make deploy, it seems that something was wrong when go get was executed.

koalawangyang commented 1 year ago

Please run go version to check the version of Golang, the main version should be 1.16. Idealy controller-gen should be installed when running make deploy, it seems that something was wrong when go get was executed.

Thanks for response.

I have downgraded the go version to 1.16. New error shows as below.

[root@ip-172-31-76-201 rocketmq-operator]# make deploy go: creating new go.mod: module tmp Downloading sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0 go get: added sigs.k8s.io/controller-tools v0.7.0 /root/rocketmq-operator/bin/controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:dir=deploy output:crd:artifacts:config=deploy/crds Error: err: exit status 1: stderr: go: github.com/google/uuid@v1.1.2: missing go.sum entry; to add it: go mod download github.com/google/uuid

Usage: controller-gen [flags]

Examples:

Generate RBAC manifests and crds for all types under apis/,

    # outputting crds to /tmp/crds and everything else to stdout
    controller-gen rbac:roleName=<role name> crd paths=./apis/... output:crd:dir=/tmp/crds output:stdout

    # Generate deepcopy/runtime.Object implementations for a particular file
    controller-gen object paths=./apis/v1beta1/some_types.go

    # Generate OpenAPI v3 schemas for API packages and merge them into existing CRD manifests
    controller-gen schemapatch:manifests=./manifests output:dir=./manifests paths=./pkg/apis/... 

    # Run all the generators for a given project
    controller-gen paths=./apis/...

    # Explain the markers for generating CRDs, and their arguments
    controller-gen crd -ww

Flags: -h, --detailed-help count print out more detailed help (up to -hhh for the most detailed output, or -hhhh for json output) --help print out usage and a summary of options --version show version -w, --which-markers count print out all markers available with the requested generators (up to -www for the most detailed output, or -wwww for json output)

Options

generators

+webhook package generates (partial) {Mutating,Validating}WebhookConfiguration objects.
+schemapatch[:generateEmbeddedObjectMeta=],manifests=[,maxDescLen=] package patches existing CRDs with new schemata.
+rbac:roleName= package generates ClusterRole objects.
+object[:headerFile=][,year=] package generates code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
+crd[:allowDangerousTypes=][,crdVersions=<[]string>][,generateEmbeddedObjectMeta=][,maxDescLen=] package generates CustomResourceDefinition objects.

generic

+paths=<[]string> package represents paths and go-style path patterns to use as package roots.

output rules (optionally as output::...)

+output:artifacts[:code=],config= package outputs artifacts to different locations, depending on whether they're package-associated or not.
+output:dir= package outputs each artifact to the given directory, regardless of if it's package-associated or not.
+output:none package skips outputting anything.
+output:stdout package outputs everything to standard-out, with no separation.

run controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths=./... output:dir=deploy output:crd:artifacts:config=deploy/crds -w to see all available markers, or controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths=./... output:dir=deploy output:crd:artifacts:config=deploy/crds -h for usage make: *** [manifests] Error 1

koalawangyang commented 1 year ago

And more error occurs when I use 'constroller-gen xxxxx' command directly:

[root@ip-localhost rocketmq-operator]# /root/rocketmq-operator/bin/controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:dir=deploy output:crd:artifacts:config=deploy/crds pkg/apis/rocketmq/v1alpha1/console_types.go:21:2: missing go.sum entry for module providing package k8s.io/api/apps/v1 (imported by github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1); to add: go get github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1 pkg/apis/rocketmq/v1alpha1/broker_types.go:21:2: missing go.sum entry for module providing package k8s.io/api/core/v1 (imported by github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1); to add: go get github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1 pkg/apis/rocketmq/v1alpha1/broker_types.go:22:2: missing go.sum entry for module providing package k8s.io/apimachinery/pkg/apis/meta/v1 (imported by github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1); to add: go get github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1 pkg/apis/rocketmq/v1alpha1/groupversion_info.go:26:2: missing go.sum entry for module providing package k8s.io/apimachinery/pkg/runtime/schema (imported by github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1); to add: go get github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1 pkg/apis/rocketmq/v1alpha1/groupversion_info.go:27:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/scheme (imported by github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1); to add: go get github.com/apache/rocketmq-operator/pkg/apis/rocketmq/v1alpha1 pkg/tool/k8s.go:28:2: missing go.sum entry for module providing package github.com/pkg/errors (imported by github.com/apache/rocketmq-operator/pkg/tool); to add: go get github.com/apache/rocketmq-operator/pkg/tool pkg/tool/k8s.go:30:2: missing go.sum entry for module providing package k8s.io/apimachinery/pkg/runtime (imported by github.com/apache/rocketmq-operator); to add: go get github.com/apache/rocketmq-operator pkg/tool/k8s.go:31:2: missing go.sum entry for module providing package k8s.io/client-go/kubernetes (imported by github.com/apache/rocketmq-operator/pkg/tool); to add: go get github.com/apache/rocketmq-operator/pkg/tool pkg/tool/k8s.go:32:2: missing go.sum entry for module providing package k8s.io/client-go/rest (imported by github.com/apache/rocketmq-operator/pkg/tool); to add: go get github.com/apache/rocketmq-operator/pkg/tool pkg/tool/k8s.go:33:2: missing go.sum entry for module providing package k8s.io/client-go/tools/clientcmd (imported by github.com/apache/rocketmq-operator/pkg/tool); to add: go get github.com/apache/rocketmq-operator/pkg/tool pkg/tool/k8s.go:34:2: missing go.sum entry for module providing package k8s.io/client-go/tools/remotecommand (imported by github.com/apache/rocketmq-operator/pkg/tool); to add: go get github.com/apache/rocketmq-operator/pkg/tool pkg/controller/broker/broker_controller.go:35:2: missing go.sum entry for module providing package k8s.io/apimachinery/pkg/api/errors (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:37:2: missing go.sum entry for module providing package k8s.io/apimachinery/pkg/labels (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:39:2: missing go.sum entry for module providing package k8s.io/apimachinery/pkg/types (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:40:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/client (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:41:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/controller (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:42:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/controller/controllerutil (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:43:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/handler (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:44:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/log (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:45:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/manager (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:46:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/reconcile (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker pkg/controller/broker/broker_controller.go:47:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/source (imported by github.com/apache/rocketmq-operator/pkg/controller/broker); to add: go get github.com/apache/rocketmq-operator/pkg/controller/broker main.go:34:2: missing go.sum entry for module providing package k8s.io/apimachinery/pkg/util/runtime (imported by github.com/apache/rocketmq-operator); to add: go get github.com/apache/rocketmq-operator main.go:35:2: missing go.sum entry for module providing package k8s.io/client-go/kubernetes/scheme (imported by github.com/apache/rocketmq-operator); to add: go get github.com/apache/rocketmq-operator main.go:31:2: missing go.sum entry for module providing package k8s.io/client-go/plugin/pkg/client/auth (imported by github.com/apache/rocketmq-operator); to add: go get github.com/apache/rocketmq-operator main.go:36:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime (imported by github.com/apache/rocketmq-operator); to add: go get github.com/apache/rocketmq-operator main.go:37:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/healthz (imported by github.com/apache/rocketmq-operator); to add: go get github.com/apache/rocketmq-operator main.go:38:2: missing go.sum entry for module providing package sigs.k8s.io/controller-runtime/pkg/log/zap (imported by github.com/apache/rocketmq-operator); to add: go get github.com/apache/rocketmq-operator Error: not all generators ran successfully run controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths=./... output:dir=deploy output:crd:artifacts:config=deploy/crds -w to see all available markers, or controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths=./... output:dir=deploy output:crd:artifacts:config=deploy/crds -h for usage

caigy commented 1 year ago

@koalawangyang Please try running go mod tidy. BTW, would you like to optimize the building part of README after the problem is resolved?

koalawangyang commented 1 year ago

@koalawangyang Please try running go mod tidy. BTW, would you like to optimize the building part of README after the problem is resolved?

Hi caigy, Thanks for your help. It works for me after trying 'go mod tidy'.

Yes, I'd like to optimize the part of README, but I don't know how to do it~

caigy commented 1 year ago

@koalawangyang Please try running go mod tidy. BTW, would you like to optimize the building part of README after the problem is resolved?

Hi caigy, Thanks for your help. It works for me after trying 'go mod tidy'.

Yes, I'd like to optimize the part of README, but I don't know how to do it~

@koalawangyang You can clone this project, modify README and create a pull request as contribution guide, just remember replacing the RocketMQ main repo with this Operator repo. If you have any questions, please feel free to contact us.