-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add controller-gen to tools.go (#564)
## Description Modifies most of kube.mk to be better integrated with tools.go and accompanying make rules. ## Why is this needed Gets rid of recursive make calls (which are considered harmful 😄) by giving make more/better info. Also removes code that is no longer necessary (and some that never was, envsubst in kube.mk). ## How Has This Been Tested? I ran `make generate`
- Loading branch information
Showing
7 changed files
with
32 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,18 @@ | ||
GO_INSTALL = ./scripts/go_install.sh | ||
TOOLS_DIR := hack/tools | ||
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin) | ||
|
||
CONTROLLER_GEN_VER := v0.7.0 | ||
CONTROLLER_GEN_BIN := controller-gen | ||
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER) | ||
|
||
ENVSUBST_BIN := envsubst | ||
ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)-drone | ||
|
||
# -------------------------------------- | ||
# Tooling Binaries | ||
# -------------------------------------- | ||
|
||
$(CONTROLLER_GEN): # Build controller-gen from tools folder. | ||
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/controller-tools/cmd/controller-gen $(CONTROLLER_GEN_BIN) $(CONTROLLER_GEN_VER) | ||
|
||
.PHONY: generate | ||
generate: # Generate code, manifests etc. | ||
$(MAKE) generate-go | ||
$(MAKE) generate-manifests | ||
PHONY: generate | ||
generate: generate-go generate-manifests # Generate code, manifests etc. | ||
|
||
.PHONY: generate-go | ||
generate-go: $(CONTROLLER_GEN) # Generate Go code. | ||
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate/boilerplate.generatego.txt" paths="./pkg/apis/..." | ||
generate-go: bin/controller-gen bin/gofumpt # Generate Go code. | ||
controller-gen object:headerFile="hack/boilerplate/boilerplate.generatego.txt" paths="./pkg/apis/..." | ||
gofumpt -w -s ./pkg/apis | ||
|
||
.PHONY: generate-manifests | ||
generate-manifests: $(CONTROLLER_GEN) # Generate manifests e.g. CRD, RBAC etc. | ||
$(CONTROLLER_GEN) \ | ||
generate-manifests: bin/controller-gen # Generate manifests e.g. CRD, RBAC etc. | ||
controller-gen \ | ||
paths=./pkg/apis/... \ | ||
crd:crdVersions=v1 \ | ||
rbac:roleName=manager-role \ | ||
output:crd:dir=./config/crd/bases \ | ||
output:webhook:dir=./config/webhook \ | ||
webhook | ||
prettier --write ./config/crd/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters