-
Notifications
You must be signed in to change notification settings - Fork 1.8k
operator-sdk generate should not depend on Dockerfile existence #1686
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
Comments
HI @nrvnrvn, As described in the comment #2054 (comment) was decided not to move forward with this request. The reason for that is because we are looking for changes in the design to give more flexibility to our users. Then, for customizations like this one, we would like to suggest the usage of controller-gen directly by a Makefile. Following an example of a Makefile with targets to generate/update the CRD's in the SDK structure. # Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) paths=./... crd:trivialVersions=true output:crd:artifacts:config=deploy/crds
# find or download controller-gen
# download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
go get sigs.k8s.io/controller-tools/cmd/[email protected]
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif Then, when the command For further information about how to use the controller-gen as its options/commands see its [docs] I am closing this issue, however, please feel free to re-open if you feel that it is required. |
thank you very much. Will follow this example. |
Hi @nrvnrvn, Really thank you for your reply. Also, I'd like to recommend you keep the Dockerfile which is created automatically by the SDK in order to keep it sample and you still be able to use its commands since many of them will ensure that it is in the root dir by checking it. Then, customized what would you like as the example provided. I hope that this info can be helpful to you. |
Bug Report
What did you do?
Dockerfile is not needed for generating deepcopy and openapi files. Yet if it does not exist (or the whole build directory) it stops operator-sdk from proceeding.
Possible Solution
Remove the Dockerfile dependency.
genutil will fail anyway if it does not find the
pkg/apis
directoryoperator-sdk/cmd/operator-sdk/internal/genutil/genutil.go
Line 35 in 21668fa
Why is it needed?
for those cases when images are built using third-party tools not relying on
Dockerfile
sThe text was updated successfully, but these errors were encountered: