Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Streamline make generate #118

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ all: manager

# Run tests
.PHONY: test
test: generate fmt vet manifests
test: generate fmt vet
go test ./api/... ./controllers/... -coverprofile cover.out

# Build manager binary
Expand All @@ -64,20 +64,15 @@ run: generate fmt vet

# Install CRDs into a cluster
.PHONY: install
install: manifests
install: generate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this only depends on generate-manifests

kubectl apply -f config/crd/bases

# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
.PHONY: deploy
deploy: manifests
deploy: generate
kubectl apply -f config/crd/bases
kubectl kustomize config/default | kubectl apply -f -

# Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
manifests: $(CONTROLLER_GEN)
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:dir=$(CRD_ROOT) output:webhook:dir=$(WEBHOOK_ROOT) output:rbac:dir=$(RBAC_ROOT)

# Run go fmt against code
.PHONY: fmt
fmt:
Expand All @@ -91,8 +86,19 @@ vet:
# Generate code
.PHONY: generate
generate: $(CONTROLLER_GEN)
$(MAKE) generate-manifests
$(MAKE) generate-deepcopy

# Generate deepcopy files.
.PHONY: generate-deepcopy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is missing the actual target name

needs a generate-deepcopy: on the next line

generate-deepcopy: $(CONTROLLER_GEN)
$(CONTROLLER_GEN) object:headerFile=./hack/boilerplate/boilerplate.generatego.txt paths=./api/...

# Generate manifests e.g. CRD, RBAC etc.
.PHONY: generate-manifests
generate-manifests: $(CONTROLLER_GEN)
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:dir=$(CRD_ROOT) output:webhook:dir=$(WEBHOOK_ROOT) output:rbac:dir=$(RBAC_ROOT)

# Build the docker image
.PHONY: docker-build
docker-build: test
Expand Down
4 changes: 2 additions & 2 deletions hack/verify-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cleanup() {
trap "cleanup" EXIT SIGINT
cleanup

MANIFEST_ROOT=$TMP_ROOT make manifests
MANIFEST_ROOT=$TMP_ROOT make generate-manifests

echo "diffing ${DIFFROOT} against freshly generated manifests"
ret=0
Expand All @@ -37,6 +37,6 @@ if [[ $ret -eq 0 ]]
then
echo "Manifests in ${DIFFROOT} are up to date."
else
echo "Manifests in ${DIFFROOT} are out of date. Please run \`make manifests\`"
echo "Manifests in ${DIFFROOT} are out of date. Please run \`make generate-manifests\`"
exit 1
fi