-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
31 lines (27 loc) · 1.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
CONTROLLER_TOOLS_VERSION ?= v0.15.0
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
CODEGEN = $(LOCALBIN)/kube-codegen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
manifests: controller-gen
@for dir in apps cluster; do \
mkdir -p "config/crd/$$dir"; \
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./$$dir/..." output:crd:artifacts:config="config/crd/$$dir"; \
done
generate: codegen controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
#@scripts/generate_client.sh
# $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CODEGEN) code-gen --go-header-file=./hack/boilerplate.go.txt --code-generator-version=v0.27.16 --apis-path=./ --generators=deepcopy,register
codegen: $(CODEGEN) # Download kube-codegen locally if necessary. If wrong version is installed, it will be overwritten.
$(CODEGEN):
ifeq (, $(shell command -v $(CODEGEN)))
@cd $(shell mktemp -d) && \
git clone https://github.com/zoumo/kube-codegen.git && \
cd kube-codegen && \
GOBIN=$(LOCALBIN) go install ./cmd/kube-codegen
endif